Cache S/MIME passphrases when "remember" is checked

This commit is contained in:
the-djmaze 2024-02-21 23:28:53 +01:00
parent 9941ff61f7
commit 453e73f71a
5 changed files with 46 additions and 32 deletions

View file

@ -10,7 +10,6 @@ import Remote from 'Remote/User/Fetch';
import { showScreenPopup } from 'Knoin/Knoin';
import { OpenPgpKeyPopupView } from 'View/Popup/OpenPgpKey';
import { AskPopupView } from 'View/Popup/Ask';
import { Passphrases } from 'Storage/Passphrases';
@ -25,12 +24,11 @@ const
return privateKey.key;
}
const key = privateKey.id,
pass = Passphrases.has(key)
? {password:Passphrases.get(key), remember:false}
: await AskPopupView.password(
'OpenPGP.js key<br>' + key + ' ' + privateKey.emails[0],
'CRYPTO/'+btnTxt
);
pass = await Passphrases.ask(
key,
'OpenPGP.js key<br>' + key + ' ' + privateKey.emails[0],
'CRYPTO/'+btnTxt
);
if (pass) {
const passphrase = pass.password,
result = await openpgp.decryptKey({