Extend secrets.el by lock/unlock item
* lisp/net/secrets.el (secrets-lock-item, secrets-unlock-item): New defuns. (secrets-get-secret): Use `secrets-unlock-item'. (Bug#62952)
This commit is contained in:
parent
3adc1e7f37
commit
0e4cc6a8bf
1 changed files with 26 additions and 1 deletions
|
@ -687,13 +687,38 @@ ITEM can also be an object path, which is returned if contained in COLLECTION."
|
|||
item (secrets-get-item-property item-path "Label"))
|
||||
(throw 'item-found item-path)))))))
|
||||
|
||||
(defun secrets-lock-item (collection item)
|
||||
"Lock collection item labeled ITEM in COLLECTION.
|
||||
If successful, return the object path of the item. Does not lock
|
||||
the collection."
|
||||
(let ((item-path (secrets-item-path collection item)))
|
||||
(unless (secrets-empty-path item-path)
|
||||
(secrets-prompt
|
||||
(cadr
|
||||
(dbus-call-method
|
||||
:session secrets-service secrets-path secrets-interface-service
|
||||
"Lock" `(:array :object-path ,item-path)))))
|
||||
item-path))
|
||||
|
||||
(defun secrets-unlock-item (collection item)
|
||||
"Unlock item labeled ITEM from collection labeled COLLECTION.
|
||||
If successful, return the object path of the item."
|
||||
(let ((item-path (secrets-item-path collection item)))
|
||||
(unless (secrets-empty-path item-path)
|
||||
(secrets-prompt
|
||||
(cadr
|
||||
(dbus-call-method
|
||||
:session secrets-service secrets-path secrets-interface-service
|
||||
"Unlock" `(:array :object-path ,item-path)))))
|
||||
item-path))
|
||||
|
||||
(defun secrets-get-secret (collection item)
|
||||
"Return the secret of item labeled ITEM in COLLECTION.
|
||||
If there are several items labeled ITEM, it is undefined which
|
||||
one is returned. If there is no such item, return nil.
|
||||
|
||||
ITEM can also be an object path, which is used if contained in COLLECTION."
|
||||
(let ((item-path (secrets-item-path collection item)))
|
||||
(let ((item-path (secrets-unlock-item collection item)))
|
||||
(unless (secrets-empty-path item-path)
|
||||
(dbus-byte-array-to-string
|
||||
(nth 2
|
||||
|
|
Loading…
Add table
Reference in a new issue