From acc1c0badc59f8b2cd2efe5c465d7f158809c3cc Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Thu, 2 Feb 2023 14:04:37 +0100 Subject: [PATCH] Don't remember OpenPGP key passphrase when it fails #840 --- dev/Stores/User/OpenPGP.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dev/Stores/User/OpenPGP.js b/dev/Stores/User/OpenPGP.js index ee7d150c4..fd649b3b3 100644 --- a/dev/Stores/User/OpenPGP.js +++ b/dev/Stores/User/OpenPGP.js @@ -31,12 +31,13 @@ const 'OPENPGP/'+btnTxt ); if (pass) { - pass.remember && passphrases.set(key, pass.password); - let passphrase = pass.password; - return await openpgp.decryptKey({ - privateKey: privateKey.key, - passphrase - }); + const passphrase = pass.password, + result = await openpgp.decryptKey({ + privateKey: privateKey.key, + passphrase + }); + result && pass.remember && passphrases.set(key, passphrase); + return result; } },