@@ -9,7 +9,6 @@ import { KeyUtil } from '../../../common/core/crypto/key.js';
99import { DecryptError , DecryptErrTypes , MsgUtil , VerifyRes } from '../../../common/core/crypto/pgp/msg-util.js' ;
1010import { OpenPGPKey } from '../../../common/core/crypto/pgp/openpgp-key.js' ;
1111import { PgpArmor } from '../../../common/core/crypto/pgp/pgp-armor' ;
12- import { Catch } from '../../../common/platform/catch' ;
1312import { ContactStore } from '../../../common/platform/store/contact-store.js' ;
1413import { KeyStore } from '../../../common/platform/store/key-store.js' ;
1514import { Xss } from '../../../common/platform/xss.js' ;
@@ -33,21 +32,19 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
3332 this . acctEmail = ( await BrowserMsg . send . bg . await . thunderbirdGetCurrentUser ( ) ) ! ;
3433 const emailBodyToParse = $ ( 'div.moz-text-plain' ) . text ( ) . trim ( ) || $ ( 'div.moz-text-html' ) . text ( ) . trim ( ) || $ ( 'div.moz-text-flowed' ) . text ( ) . trim ( ) ;
3534 const { processableAttachments : fcAttachments , from : signerEmail } = await BrowserMsg . send . bg . await . thunderbirdGetDownloadableAttachment ( ) ;
36- if ( Catch . isThunderbirdMail ( ) ) {
37- const parsedPubs = ( await ContactStore . getOneWithAllPubkeys ( undefined , signerEmail ) ) ?. sortedPubkeys ?? [ ] ;
38- const verificationPubs = parsedPubs . map ( key => KeyUtil . armor ( key . pubkey ) ) ;
39- if ( this . resemblesAsciiArmoredMsg ( emailBodyToParse ) ) {
40- await this . messageDecrypt ( verificationPubs , this . emailBodyFromThunderbirdMail ) ;
41- } else if ( this . resemblesSignedMsg ( emailBodyToParse ) ) {
42- await this . messageVerify ( verificationPubs ) ;
43- }
44- if ( fcAttachments . length ) {
45- for ( const fcAttachment of fcAttachments ) {
46- await this . attachmentUiRenderer ( fcAttachment , verificationPubs , emailBodyToParse ) ;
47- }
35+ const parsedPubs = ( await ContactStore . getOneWithAllPubkeys ( undefined , signerEmail ) ) ?. sortedPubkeys ?? [ ] ;
36+ const verificationPubs = parsedPubs . map ( key => KeyUtil . armor ( key . pubkey ) ) ;
37+ if ( this . resemblesAsciiArmoredMsg ( emailBodyToParse ) ) {
38+ await this . messageDecrypt ( verificationPubs , this . emailBodyFromThunderbirdMail ) ;
39+ } else if ( this . resemblesSignedMsg ( emailBodyToParse ) ) {
40+ await this . messageVerify ( verificationPubs ) ;
41+ }
42+ if ( fcAttachments . length ) {
43+ for ( const fcAttachment of fcAttachments ) {
44+ await this . attachmentUiRenderer ( fcAttachment , verificationPubs , emailBodyToParse ) ;
4845 }
49- $ ( 'body' ) . show ( ) ;
5046 }
47+ $ ( 'body' ) . show ( ) ;
5148 } ;
5249
5350 private messageDecrypt = async ( verificationPubs : string [ ] , encryptedData : string | Buf ) => {
0 commit comments