#89 Decrypt and verify with OpenPGP.js and GnuPG

This commit is contained in:
the-djmaze 2022-02-11 11:01:07 +01:00
parent 85f9209176
commit e0e490c64f
8 changed files with 354 additions and 315 deletions

View file

@ -214,9 +214,14 @@ export const OpenPGPUserStore = new class {
data.Folder = message.folder;
data.Uid = message.uid;
data.GnuPG = 0;
let response = data.SigPartId
? await Remote.post('MessagePgpVerify', null, data)
: { Result: { text: message.plain(), signature: null } };
let response;
if (data.SigPartId) {
response = await Remote.post('MessagePgpVerify', null, data);
} else if (data.BodyPart) {
response = { Result: { text: data.BodyPart.raw, signature: data.SigPart.body } };
} else {
response = { Result: { text: message.plain(), signature: null } };
}
if (response) {
const signature = response.Result.signature
? await openpgp.readSignature({ armoredSignature: response.Result.signature })