cleanup OpenPGP.js askPassphrase

This commit is contained in:
the-djmaze 2022-08-08 14:33:45 +02:00
parent c99503980f
commit 04083f478a

View file

@ -18,14 +18,14 @@ const
key.emails.includes(query) || query == key.id || query == key.fingerprint
),
askPassphrase = async (privateKey, btnTxt) =>
await AskPopupView.password('OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt),
decryptKey = async (privateKey, btnTxt = 'LABEL_SIGN') => {
if (privateKey.key.isDecrypted()) {
return privateKey.key;
}
const passphrase = await askPassphrase(privateKey, btnTxt);
const passphrase = await AskPopupView.password(
'OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0],
'OPENPGP/'+btnTxt
);
if (null !== passphrase) {
return await openpgp.decryptKey({
privateKey: privateKey.key,