Skip to content

#5999 Add fingerprint when rendering private backups #6004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 23, 2025
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
10 changes: 8 additions & 2 deletions extension/chrome/elements/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Url, Str } from '../../js/common/core/common.js';
import { View } from '../../js/common/view.js';
import { initPassphraseToggle } from '../../js/common/ui/passphrase-ui.js';
import { KeyStore } from '../../js/common/platform/store/key-store.js';
import { Xss } from '../../js/common/platform/xss.js';

View.run(
class BackupView extends View {
Expand Down Expand Up @@ -48,10 +49,15 @@ View.run(
}
[this.storedPrvWithMatchingLongid] = await KeyStore.get(this.acctEmail, [fingerprint]);
if (this.storedPrvWithMatchingLongid) {
$('.line .private_key_status').text('This Private Key is already imported.');
$('.line .private_key_status').html(
`This private key with fingerprint <span class="green">${Xss.escape(Str.spaced(fingerprint))}</span> has already been imported.`
);
} else {
$('.line .private_key_status')
.text('This private key was not imported yet. We suggest to import all backups so that you can read all incoming encrypted emails.')
.html(
`The private key <span class="green">${Xss.escape(Str.spaced(fingerprint))}</span> has not been imported yet. \n` +
`We recommend importing all backups to ensure you can read all incoming encrypted emails.`
)
.after('<div class="line"><button class="button green" id="action_import_key">Import Missing Private Key</button></div>'); // xss-direct
}
this.sendResizeMsg();
Expand Down
28 changes: 24 additions & 4 deletions test/source/tests/decrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,21 @@ export const defineDecryptTests = (testVariant: TestVariant, testWithBrowser: Te
const { acctEmail, authHdr } = await BrowserRecipe.setupCommonAcctWithAttester(t, browser, 'compatibility');
const inboxPage = await browser.newExtensionPage(t, `chrome/settings/inbox/inbox.htm?acctEmail=${acctEmail}&threadId=${threadId}`);
await inboxPage.waitForSelTestState('ready');
await (await inboxPage.getFrame(['backup.htm'])).waitForContent('@private-key-status', 'This Private Key is already imported.');
await (
await inboxPage.getFrame(['backup.htm'])
).waitForContent(
'@private-key-status',
'This private key with fingerprint 5520 CACE 2CB6 1EA7 13E5 B005 7FDE 6855 48AE A788 has already been imported.'
);
await inboxPage.close();
const gmailPage = await browser.newPage(t, `${t.context.urls?.mockGmailUrl()}/${threadId}`, undefined, authHdr);
await gmailPage.waitAll('iframe');
await (await gmailPage.getFrame(['backup.htm'])).waitForContent('@private-key-status', 'This Private Key is already imported.');
await (
await gmailPage.getFrame(['backup.htm'])
).waitForContent(
'@private-key-status',
'This private key with fingerprint 5520 CACE 2CB6 1EA7 13E5 B005 7FDE 6855 48AE A788 has already been imported.'
);
await gmailPage.close();
})
);
Expand All @@ -88,11 +98,21 @@ export const defineDecryptTests = (testVariant: TestVariant, testWithBrowser: Te
const { acctEmail, authHdr } = await BrowserRecipe.setupCommonAcctWithAttester(t, browser, 'compatibility');
const inboxPage = await browser.newExtensionPage(t, `chrome/settings/inbox/inbox.htm?acctEmail=${acctEmail}&threadId=${threadId}`);
await inboxPage.waitForSelTestState('ready');
await (await inboxPage.getFrame(['backup.htm'])).waitForContent('@private-key-status', 'This Private Key is already imported.');
await (
await inboxPage.getFrame(['backup.htm'])
).waitForContent(
'@private-key-status',
'This private key with fingerprint E8F0 517B A6D7 DAB6 081C 96E4 ADAC 279C 9509 3207 has already been imported.'
);
await inboxPage.close();
const gmailPage = await browser.newPage(t, `${t.context.urls?.mockGmailUrl()}/${threadId}`, undefined, authHdr);
await gmailPage.waitAll('iframe');
await (await gmailPage.getFrame(['backup.htm'])).waitForContent('@private-key-status', 'This Private Key is already imported.');
await (
await gmailPage.getFrame(['backup.htm'])
).waitForContent(
'@private-key-status',
'This private key with fingerprint E8F0 517B A6D7 DAB6 081C 96E4 ADAC 279C 9509 3207 has already been imported.'
);
await gmailPage.close();
})
);
Expand Down
Loading