Skip to content

Commit 8903059

Browse files
committed
Remove upgrade encryption in DeviceListener and SetupEncryptionToast
1 parent 7de5c84 commit 8903059

File tree

4 files changed

+10
-26
lines changed

4 files changed

+10
-26
lines changed

src/DeviceListener.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,15 @@ export default class DeviceListener {
298298
showSetupEncryptionToast(SetupKind.VERIFY_THIS_SESSION);
299299
this.checkKeyBackupStatus();
300300
} else {
301-
const backupInfo = await this.getKeyBackupInfo();
302-
if (backupInfo) {
303-
// No cross-signing on account but key backup available (upgrade encryption)
304-
showSetupEncryptionToast(SetupKind.UPGRADE_ENCRYPTION);
301+
// No cross-signing or key backup on account (set up encryption)
302+
await cli.waitForClientWellKnown();
303+
if (isSecureBackupRequired(cli) && isLoggedIn()) {
304+
// If we're meant to set up, and Secure Backup is required,
305+
// trigger the flow directly without a toast once logged in.
306+
hideSetupEncryptionToast();
307+
accessSecretStorage();
305308
} else {
306-
// No cross-signing or key backup on account (set up encryption)
307-
await cli.waitForClientWellKnown();
308-
if (isSecureBackupRequired(cli) && isLoggedIn()) {
309-
// If we're meant to set up, and Secure Backup is required,
310-
// trigger the flow directly without a toast once logged in.
311-
hideSetupEncryptionToast();
312-
accessSecretStorage();
313-
} else {
314-
showSetupEncryptionToast(SetupKind.SET_UP_ENCRYPTION);
315-
}
309+
showSetupEncryptionToast(SetupKind.SET_UP_ENCRYPTION);
316310
}
317311
}
318312
}

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@
913913
"warning": "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings."
914914
},
915915
"reset_all_button": "Forgotten or lost all recovery methods? <a>Reset all</a>",
916-
"set_up_toast_description": "Safeguard against losing access to encrypted messages & data",
917916
"set_up_toast_title": "Set up Secure Backup",
918917
"setup_secure_backup": {
919918
"explainer": "Back up your keys before signing out to avoid losing them.",
@@ -930,7 +929,6 @@
930929
},
931930
"unable_to_setup_keys_error": "Unable to set up keys",
932931
"unsupported": "This client does not support end-to-end encryption.",
933-
"upgrade_toast_title": "Encryption upgrade available",
934932
"verification": {
935933
"accepting": "Accepting…",
936934
"after_new_login": {

src/toasts/SetupEncryptionToast.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const getTitle = (kind: Kind): string => {
2323
switch (kind) {
2424
case Kind.SET_UP_ENCRYPTION:
2525
return _t("encryption|set_up_toast_title");
26-
case Kind.UPGRADE_ENCRYPTION:
27-
return _t("encryption|upgrade_toast_title");
2826
case Kind.VERIFY_THIS_SESSION:
2927
return _t("encryption|verify_toast_title");
3028
}
@@ -33,7 +31,6 @@ const getTitle = (kind: Kind): string => {
3331
const getIcon = (kind: Kind): string => {
3432
switch (kind) {
3533
case Kind.SET_UP_ENCRYPTION:
36-
case Kind.UPGRADE_ENCRYPTION:
3734
return "secure_backup";
3835
case Kind.VERIFY_THIS_SESSION:
3936
return "verification_warning";
@@ -44,8 +41,6 @@ const getSetupCaption = (kind: Kind): string => {
4441
switch (kind) {
4542
case Kind.SET_UP_ENCRYPTION:
4643
return _t("action|continue");
47-
case Kind.UPGRADE_ENCRYPTION:
48-
return _t("action|upgrade");
4944
case Kind.VERIFY_THIS_SESSION:
5045
return _t("action|verify");
5146
}
@@ -54,16 +49,13 @@ const getSetupCaption = (kind: Kind): string => {
5449
const getDescription = (kind: Kind): string => {
5550
switch (kind) {
5651
case Kind.SET_UP_ENCRYPTION:
57-
case Kind.UPGRADE_ENCRYPTION:
58-
return _t("encryption|set_up_toast_description");
5952
case Kind.VERIFY_THIS_SESSION:
6053
return _t("encryption|verify_toast_description");
6154
}
6255
};
6356

6457
export enum Kind {
6558
SET_UP_ENCRYPTION = "set_up_encryption",
66-
UPGRADE_ENCRYPTION = "upgrade_encryption",
6759
VERIFY_THIS_SESSION = "verify_this_session",
6860
}
6961

test/unit-tests/DeviceListener-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,13 @@ describe("DeviceListener", () => {
351351
mockCrypto!.getCrossSigningKeyId.mockResolvedValue("abc");
352352
});
353353

354-
it("shows upgrade encryption toast when user has a key backup available", async () => {
354+
it("shows set up encryption toast when user has a key backup available", async () => {
355355
// non falsy response
356356
mockClient!.getKeyBackupVersion.mockResolvedValue({} as unknown as KeyBackupInfo);
357357
await createAndStart();
358358

359359
expect(SetupEncryptionToast.showToast).toHaveBeenCalledWith(
360-
SetupEncryptionToast.Kind.UPGRADE_ENCRYPTION,
360+
SetupEncryptionToast.Kind.SET_UP_ENCRYPTION,
361361
);
362362
});
363363
});

0 commit comments

Comments
 (0)