Skip to content

Commit

Permalink
add prompt for missing pubkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
martgil committed Oct 24, 2024
1 parent e33693f commit b185b22
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
verificationPubs,
});
if (result.success && result.content) {
const decryptedContent = result.content.toUtfStr();
const pgpBlockContent = result.content.toUtfStr();
const encryptionStatus = result.isEncrypted ? 'encrypted' : 'not encrypted';
let verificationStatus = '';
if (result?.signature) {
Expand All @@ -70,7 +70,7 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
verificationStatus = 'not signed';
}
}
const pgpBlock = this.generatePgpBlockTemplate(encryptionStatus, verificationStatus, decryptedContent);
const pgpBlock = this.generatePgpBlockTemplate(encryptionStatus, verificationStatus, pgpBlockContent);
$('body').html(pgpBlock); // xss-sanitized
} else {
const decryptErr = result as DecryptError;
Expand Down Expand Up @@ -98,15 +98,18 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
result = await MsgUtil.verifyDetached({ plaintext: detachedSignatureParams.plaintext, sigText: detachedSignatureParams.sigText, verificationPubs });
}
let verificationStatus = '';
let signedMessage = '';
if (result.match && result.content) {
verificationStatus = 'signed';
signedMessage = result.content.toUtfStr();
let pgpBlockContent = '';
if (result.content) {
verificationStatus = result.match ? 'signed' : 'not signed';
if (result.signerLongids) {
verificationStatus = `could not verify signature: missing pubkey ${result.signerLongids}`;
}
pgpBlockContent = result.content.toUtfStr();
} else if (result.error) {
verificationStatus = `could not verify signature: ${result.error}`;
signedMessage = detachedSignatureParams?.plaintext || '';
pgpBlockContent = detachedSignatureParams?.plaintext || '';
}
const pgpBlock = this.generatePgpBlockTemplate('not encrypted', verificationStatus, signedMessage);
const pgpBlock = this.generatePgpBlockTemplate('not encrypted', verificationStatus, pgpBlockContent);
$('body').html(pgpBlock); // xss-sanitized
};

Expand Down

0 comments on commit b185b22

Please sign in to comment.