mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
#89 verify PGP signatures using OpenPGP.js
This commit is contained in:
parent
93db6e6e0e
commit
da79feeaee
5 changed files with 93 additions and 72 deletions
|
|
@ -180,6 +180,7 @@ export const PgpUserStore = new class {
|
|||
if (/-----BEGIN PGP SIGNED MESSAGE-----/.test(plain) && /-----BEGIN PGP SIGNATURE-----/.test(plain)) {
|
||||
let result = await OpenPGPUserStore.verify(plain);
|
||||
console.dir(result);
|
||||
return;
|
||||
}
|
||||
if (message.pgpSigned()) {
|
||||
const sender = message.from[0].email;
|
||||
|
|
@ -188,34 +189,11 @@ export const PgpUserStore = new class {
|
|||
return GnuPGUserStore.verify(message);
|
||||
}
|
||||
if ('openpgp' === mode) {
|
||||
const publicKey = OpenPGPUserStore.getPublicKeyFor(sender);
|
||||
OpenPGPUserStore.verify(plain, null/*detachedSignature*/, publicKey).then(result => {
|
||||
if (result) {
|
||||
message.plain(result.data);
|
||||
message.viewPlain();
|
||||
console.dir({signatures:result.signatures});
|
||||
}
|
||||
/*
|
||||
if (validKey) {
|
||||
i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
|
||||
USER: validKey.user + ' (' + validKey.id + ')'
|
||||
});
|
||||
message.getText()
|
||||
} else {
|
||||
const keyIds = arrayLength(signingKeyIds) ? signingKeyIds : null,
|
||||
additional = keyIds
|
||||
? keyIds.map(item => (item && item.toHex ? item.toHex() : null)).filter(v => v).join(', ')
|
||||
: '';
|
||||
|
||||
i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE') + (additional ? ' (' + additional + ')' : '');
|
||||
}
|
||||
*/
|
||||
});
|
||||
return OpenPGPUserStore.verify(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an iframe with an editor for a new encrypted mail.
|
||||
* The iframe will be injected into the container identified by selector.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue