Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extension/js/common/core/mime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type MimeContent = {
export type RichHeaders = Dict<string | string[]>;
export type SendableMsgBody = { [key: string]: string | undefined; 'text/plain'?: string; 'text/html'?: string; };
export type KeyBlockType = 'publicKey' | 'privateKey';
export type ReplaceableMsgBlockType = KeyBlockType | 'cryptupVerification' | 'signedMsg' | 'encryptedMsg' | 'encryptedMsgLink';
export type ReplaceableMsgBlockType = KeyBlockType | 'signedMsg' | 'encryptedMsg' | 'encryptedMsgLink';
export type MsgBlockType = ReplaceableMsgBlockType | 'plainText' | 'decryptedText' | 'plainHtml' | 'decryptedHtml' | 'plainAtt' | 'encryptedAtt'
| 'decryptedAtt' | 'encryptedAttLink' | 'decryptErr' | 'verifiedMsg' | 'signedHtml';
export type MsgBlock = {
Expand Down Expand Up @@ -62,7 +62,7 @@ export class Mime {
if (decoded.text) {
const blocksFromTextPart = Pgp.armor.detectBlocks(Str.normalize(decoded.text)).blocks;
// if there are some encryption-related blocks found in the text section, which we can use, and not look at the html section
if (blocksFromTextPart.find(b => b.type === 'encryptedMsg' || b.type === 'signedMsg' || b.type === 'publicKey' || b.type === 'privateKey' || b.type === 'cryptupVerification')) {
if (blocksFromTextPart.find(b => b.type === 'encryptedMsg' || b.type === 'signedMsg' || b.type === 'publicKey' || b.type === 'privateKey')) {
blocks.push(...blocksFromTextPart); // because the html most likely containt the same thing, just harder to parse pgp sections cause it's html
} else if (decoded.html) { // if no pgp blocks found in text part and there is html part, prefer html
blocks.push(Pgp.internal.msgBlockObj('plainHtml', decoded.html));
Expand Down
6 changes: 2 additions & 4 deletions extension/js/common/core/pgp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export class Pgp {
null: { begin: '-----BEGIN', end: '-----END', replace: false },
publicKey: { begin: '-----BEGIN PGP PUBLIC KEY BLOCK-----', end: '-----END PGP PUBLIC KEY BLOCK-----', replace: true },
privateKey: { begin: '-----BEGIN PGP PRIVATE KEY BLOCK-----', end: '-----END PGP PRIVATE KEY BLOCK-----', replace: true },
cryptupVerification: { begin: '-----BEGIN CRYPTUP VERIFICATION-----', end: '-----END CRYPTUP VERIFICATION-----', replace: true },
signedMsg: { begin: '-----BEGIN PGP SIGNED MESSAGE-----', middle: '-----BEGIN PGP SIGNATURE-----', end: '-----END PGP SIGNATURE-----', replace: true },
signature: { begin: '-----BEGIN PGP SIGNATURE-----', end: '-----END PGP SIGNATURE-----', replace: false },
encryptedMsg: { begin: '-----BEGIN PGP MESSAGE-----', end: '-----END PGP MESSAGE-----', replace: true },
Expand Down Expand Up @@ -229,10 +228,9 @@ export class Pgp {
{ match: '', word: 'weak', bar: 10, color: 'red', pass: false },
];

private static readonly FRIENDLY_BLOCK_TYPE_NAMES: { [type in MsgBlockType]: string } = {
private static readonly FRIENDLY_BLOCK_TYPE_NAMES: { [type in MsgBlockType]: string } = { // todo - remove this, almost useless
privateKey: 'Private Key',
publicKey: 'Public Key',
cryptupVerification: 'Cryptup Verification',
decryptErr: 'Decrypt Error',
decryptedAtt: 'Decrypted Attachment',
decryptedHtml: 'Decrypted HTML',
Expand Down Expand Up @@ -333,7 +331,7 @@ export class Pgp {
},
};

public static friendlyMsgBlockTypeName = (type: MsgBlockType) => {
public static friendlyMsgBlockTypeName = (type: MsgBlockType) => { // todo - remove this, just use the block type string
return Pgp.FRIENDLY_BLOCK_TYPE_NAMES[type];
}

Expand Down
10 changes: 0 additions & 10 deletions extension/js/common/xss_safe_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ export class XssSafeFactory {
return this.frameSrc(this.extUrl('chrome/elements/subscribe.htm'), { verificationEmailText, placement, isAuthErr });
}

srcVerificationDialog = (verificationEmailText: string) => {
return this.frameSrc(this.extUrl('chrome/elements/verification.htm'), { verificationEmailText });
}

srcAddPubkeyDialog = (emails: string[], placement: Placement) => {
return this.frameSrc(this.extUrl('chrome/elements/add_pubkey.htm'), { emails, placement });
}
Expand Down Expand Up @@ -144,10 +140,6 @@ export class XssSafeFactory {
return this.iframe(this.srcSubscribeDialog(verifEmailText, 'embedded', isAuthErr), ['short', 'embedded'], { scrolling: 'no' });
}

embeddedVerification = (verifEmailText: string) => {
return this.iframe(this.srcVerificationDialog(verifEmailText), ['short', 'embedded'], { scrolling: 'no' });
}

embeddedAtta = (meta: Att, isEncrypted: boolean) => {
return Ui.e('span', { class: 'pgp_attachment', html: this.iframe(this.srcPgpAttIframe(meta, isEncrypted)) });
}
Expand Down Expand Up @@ -270,8 +262,6 @@ export class XssSafeFactory {
return factory.embeddedBackup(Pgp.armor.normalize(block.content.toString(), 'privateKey'));
} else if (block.type === 'encryptedMsgLink') {
return factory.embeddedMsg('', msgId, isOutgoing, senderEmail, true, undefined, block.content.toString()); // here block.content is message short id
} else if (block.type === 'cryptupVerification') {
return factory.embeddedVerification(block.content.toString());
} else if (block.type === 'encryptedAtt') {
return block.attMeta ? factory.embeddedAtta(new Att(block.attMeta), true) : '[missing encrypted attachment details]';
} else if (block.type === 'signedHtml') {
Expand Down