mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Allow private keys without passphrase in local browser storage as requested by #429
This commit is contained in:
parent
2458a82031
commit
7a85a75ca9
1 changed files with 10 additions and 6 deletions
|
|
@ -178,16 +178,20 @@ export const OpenPGPUserStore = new class {
|
|||
}
|
||||
}
|
||||
if (privateKey) try {
|
||||
let decryptedKey;
|
||||
if (privateKey.key.isDecrypted()) {
|
||||
decryptedKey = privateKey;
|
||||
} else {
|
||||
const passphrase = await askPassphrase(privateKey, 'BUTTON_DECRYPT');
|
||||
|
||||
if (null !== passphrase) {
|
||||
const
|
||||
publicKey = findOpenPGPKey(this.publicKeys, sender/*, sign*/),
|
||||
decryptedKey = await openpgp.decryptKey({
|
||||
privateKey: privateKey.key,
|
||||
passphrase
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
if (decryptedKey) {
|
||||
const publicKey = findOpenPGPKey(this.publicKeys, sender/*, sign*/);
|
||||
return await openpgp.decrypt({
|
||||
message,
|
||||
verificationKeys: publicKey && publicKey.key,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue