Skip to content

Commit b185b22

Browse files
committed
add prompt for missing pubkeys
1 parent e33693f commit b185b22

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

extension/js/content_scripts/webmail/thunderbird/thunderbird-element-replacer.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
5858
verificationPubs,
5959
});
6060
if (result.success && result.content) {
61-
const decryptedContent = result.content.toUtfStr();
61+
const pgpBlockContent = result.content.toUtfStr();
6262
const encryptionStatus = result.isEncrypted ? 'encrypted' : 'not encrypted';
6363
let verificationStatus = '';
6464
if (result?.signature) {
@@ -70,7 +70,7 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
7070
verificationStatus = 'not signed';
7171
}
7272
}
73-
const pgpBlock = this.generatePgpBlockTemplate(encryptionStatus, verificationStatus, decryptedContent);
73+
const pgpBlock = this.generatePgpBlockTemplate(encryptionStatus, verificationStatus, pgpBlockContent);
7474
$('body').html(pgpBlock); // xss-sanitized
7575
} else {
7676
const decryptErr = result as DecryptError;
@@ -98,15 +98,18 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
9898
result = await MsgUtil.verifyDetached({ plaintext: detachedSignatureParams.plaintext, sigText: detachedSignatureParams.sigText, verificationPubs });
9999
}
100100
let verificationStatus = '';
101-
let signedMessage = '';
102-
if (result.match && result.content) {
103-
verificationStatus = 'signed';
104-
signedMessage = result.content.toUtfStr();
101+
let pgpBlockContent = '';
102+
if (result.content) {
103+
verificationStatus = result.match ? 'signed' : 'not signed';
104+
if (result.signerLongids) {
105+
verificationStatus = `could not verify signature: missing pubkey ${result.signerLongids}`;
106+
}
107+
pgpBlockContent = result.content.toUtfStr();
105108
} else if (result.error) {
106109
verificationStatus = `could not verify signature: ${result.error}`;
107-
signedMessage = detachedSignatureParams?.plaintext || '';
110+
pgpBlockContent = detachedSignatureParams?.plaintext || '';
108111
}
109-
const pgpBlock = this.generatePgpBlockTemplate('not encrypted', verificationStatus, signedMessage);
112+
const pgpBlock = this.generatePgpBlockTemplate('not encrypted', verificationStatus, pgpBlockContent);
110113
$('body').html(pgpBlock); // xss-sanitized
111114
};
112115

0 commit comments

Comments
 (0)