aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/secrets.el27
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.
692If successful, return the object path of the item. Does not lock
693the 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.
705If 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.
692If there are several items labeled ITEM, it is undefined which 717If there are several items labeled ITEM, it is undefined which
693one is returned. If there is no such item, return nil. 718one is returned. If there is no such item, return nil.
694 719
695ITEM can also be an object path, which is used if contained in COLLECTION." 720ITEM 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