This commit is contained in:
the-djmaze 2023-02-02 12:39:21 +01:00
parent af3cecb2e1
commit a52881fb67
43 changed files with 79 additions and 11 deletions

View file

@ -18,15 +18,21 @@ const
key.emails.includes(query) || query == key.id || query == key.fingerprint
),
passphrases = new Map(),
decryptKey = async (privateKey, btnTxt = 'LABEL_SIGN') => {
if (privateKey.key.isDecrypted()) {
return privateKey.key;
}
const passphrase = await AskPopupView.password(
'OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0],
'OPENPGP/'+btnTxt
);
if (null !== passphrase) {
const key = privateKey.id,
pass = passphrases.has(key)
? {password:passphrases.get(key), remember:false}
: await AskPopupView.password(
'OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0],
'OPENPGP/'+btnTxt
);
if (pass) {
pass.remember && passphrases.set(key, pass.password);
let passphrase = pass.password;
return await openpgp.decryptKey({
privateKey: privateKey.key,
passphrase