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

@ -12,8 +12,15 @@ import { OpenPgpKeyPopupView } from 'View/Popup/OpenPgpKey';
import { AskPopupView } from 'View/Popup/Ask';
const
askPassphrase = async (privateKey, btnTxt = 'LABEL_SIGN') =>
await AskPopupView.password('GnuPG key<br>' + privateKey.id + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt),
passphrases = new Map(),
askPassphrase = async (privateKey, btnTxt = 'LABEL_SIGN') => {
const key = privateKey.id,
pass = passphrases.has(key)
? {password:passphrases.get(key), remember:false}
: await AskPopupView.password('GnuPG key<br>' + key + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt);
pass && pass.remember && passphrases.set(key, pass.password);
return pass.password;
},
findGnuPGKey = (keys, query/*, sign*/) =>
keys.find(key =>