mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Resolve #840
This commit is contained in:
parent
af3cecb2e1
commit
a52881fb67
43 changed files with 79 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue