Skip to content

Commit e5b55db

Browse files
authored
Remove upgrade encryption in DeviceListener and SetupEncryptionToast (#28299)
* Remove upgrade encryption in `DeviceListener` and `SetupEncryptionToast` * Update comments to `2 different toasts`
1 parent 79c9563 commit e5b55db

File tree

4 files changed

+11
-25
lines changed

4 files changed

+11
-25
lines changed

src/DeviceListener.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,27 +292,21 @@ export default class DeviceListener {
292292
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);
293293

294294
// cross signing isn't enabled - nag to enable it
295-
// There are 3 different toasts for:
295+
// There are 2 different toasts for:
296296
if (!(await crypto.getCrossSigningKeyId()) && (await crypto.userHasCrossSigningKeys())) {
297297
// Cross-signing on account but this device doesn't trust the master key (verify this session)
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@
930930
},
931931
"unable_to_setup_keys_error": "Unable to set up keys",
932932
"unsupported": "This client does not support end-to-end encryption.",
933-
"upgrade_toast_title": "Encryption upgrade available",
934933
"verification": {
935934
"accepting": "Accepting…",
936935
"after_new_login": {

src/toasts/SetupEncryptionToast.ts

Lines changed: 0 additions & 7 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,7 +49,6 @@ 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:
5852
return _t("encryption|set_up_toast_description");
5953
case Kind.VERIFY_THIS_SESSION:
6054
return _t("encryption|verify_toast_description");
@@ -63,7 +57,6 @@ const getDescription = (kind: Kind): string => {
6357

6458
export enum Kind {
6559
SET_UP_ENCRYPTION = "set_up_encryption",
66-
UPGRADE_ENCRYPTION = "upgrade_encryption",
6760
VERIFY_THIS_SESSION = "verify_this_session",
6861
}
6962

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)