branch: elpa/totp-auth commit 9957bcb6705e445e9dc555dadff2337ad1a08456 Author: Vivek Das Mohapatra <vi...@collabora.com> Commit: Vivek Das Mohapatra <vi...@collabora.com>
totp-auth-get-backend-for-secret: default to an encrypted backend If a secret has been stored we return the current backend, whether or not that happens to be encrypted. However even if the user has configured an unencrypted backend as the default we will not store a new secret there - we use the first encrypred backend instead. Bug reported by Morgan Willcock <morgan@ice9.digital> --- totp-auth.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/totp-auth.el b/totp-auth.el index 98deb9c82b..2c65b74cd9 100644 --- a/totp-auth.el +++ b/totp-auth.el @@ -396,10 +396,11 @@ same, ie probably intended for the same target." (equal (assq :user a) (assq :user b)))) (defun totp-auth-get-backend-for-secret (s) - "Return the backend in which secret S is store, or the default backend." + "Return the backend in which secret S is stored, +or the default encrypted backend, or nil." (let (backends vault default target secrets) (setq backends (totp-auth-storage-backends) - default (car backends)) + default (car (totp-auth-storage-backends :encrypted))) (while (and (not target) backends) (setq vault (car backends) secrets (totp-auth-get-secrets-from-backend vault)