[PATCH] emacs: don't decrypt twice
Code Sensei (info)
info at rjekker.nl
Tue Jun 10 21:18:28 UTC 2025
password-store-get and password-store-get-field both decrypt the
password entry twice when called with a callback, when once would be
enough. This is annoying when using a smartcard or yubikey that is
configured to wait for user action (e.g. touch activation) before
decryption.
This patch fixes that.
---
contrib/emacs/password-store.el | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store=
.el
index c7cc991..70d46f3 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -245,12 +245,10 @@ ENTRY is the name of a password-store entry."
=20
Returns the first line of the password data. When CALLBACK is
non-`NIL', call CALLBACK with the first line instead."
- (let* ((inhibit-message t)
- (secret (auth-source-pass-get 'secret entry)))
+ (let ((inhibit-message t)
+ (secret (auth-source-pass-get 'secret entry)))
(if (not callback) secret
- (password-store--run-show
- entry
- (lambda (_) (funcall callback secret))))))
+ (funcall callback secret))))
=20
;;;###autoload
(defun password-store-get-field (entry field &optional callback)
@@ -259,13 +257,10 @@ FIELD is a string, for instance \"url\". When CALLBA=
CK is
non-`NIL', call it with the line associated to FIELD instead. If
FIELD equals to symbol secret, then this function reduces to
`password-store-get'."
- (let* ((inhibit-message t)
- (secret (auth-source-pass-get field entry)))
+ (let ((inhibit-message t)
+ (secret (auth-source-pass-get field entry)))
(if (not callback) secret
- (password-store--run-show
- entry
- (lambda (_) (and secret (funcall callback secret)))))))
-
+ (and secret (funcall callback secret)))))
=20
;;;###autoload
(defun password-store-clear (&optional field)
--=20
2.48.1
More information about the Password-Store
mailing list