diff options
| -rw-r--r-- | lisp/net/secrets.el | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index f4e68d7b817..08ab942fddb 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el | |||
| @@ -687,13 +687,38 @@ ITEM can also be an object path, which is returned if contained in COLLECTION." | |||
| 687 | item (secrets-get-item-property item-path "Label")) | 687 | item (secrets-get-item-property item-path "Label")) |
| 688 | (throw 'item-found item-path))))))) | 688 | (throw 'item-found item-path))))))) |
| 689 | 689 | ||
| 690 | (defun secrets-lock-item (collection item) | ||
| 691 | "Lock collection item labeled ITEM in COLLECTION. | ||
| 692 | If successful, return the object path of the item. Does not lock | ||
| 693 | the collection." | ||
| 694 | (let ((item-path (secrets-item-path collection item))) | ||
| 695 | (unless (secrets-empty-path item-path) | ||
| 696 | (secrets-prompt | ||
| 697 | (cadr | ||
| 698 | (dbus-call-method | ||
| 699 | :session secrets-service secrets-path secrets-interface-service | ||
| 700 | "Lock" `(:array :object-path ,item-path))))) | ||
| 701 | item-path)) | ||
| 702 | |||
| 703 | (defun secrets-unlock-item (collection item) | ||
| 704 | "Unlock item labeled ITEM from collection labeled COLLECTION. | ||
| 705 | If successful, return the object path of the item." | ||
| 706 | (let ((item-path (secrets-item-path collection item))) | ||
| 707 | (unless (secrets-empty-path item-path) | ||
| 708 | (secrets-prompt | ||
| 709 | (cadr | ||
| 710 | (dbus-call-method | ||
| 711 | :session secrets-service secrets-path secrets-interface-service | ||
| 712 | "Unlock" `(:array :object-path ,item-path))))) | ||
| 713 | item-path)) | ||
| 714 | |||
| 690 | (defun secrets-get-secret (collection item) | 715 | (defun secrets-get-secret (collection item) |
| 691 | "Return the secret of item labeled ITEM in COLLECTION. | 716 | "Return the secret of item labeled ITEM in COLLECTION. |
| 692 | If there are several items labeled ITEM, it is undefined which | 717 | If there are several items labeled ITEM, it is undefined which |
| 693 | one is returned. If there is no such item, return nil. | 718 | one is returned. If there is no such item, return nil. |
| 694 | 719 | ||
| 695 | ITEM can also be an object path, which is used if contained in COLLECTION." | 720 | ITEM can also be an object path, which is used if contained in COLLECTION." |
| 696 | (let ((item-path (secrets-item-path collection item))) | 721 | (let ((item-path (secrets-unlock-item collection item))) |
| 697 | (unless (secrets-empty-path item-path) | 722 | (unless (secrets-empty-path item-path) |
| 698 | (dbus-byte-array-to-string | 723 | (dbus-byte-array-to-string |
| 699 | (nth 2 | 724 | (nth 2 |