Skip to content
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

Remove upgrade encryption in DeviceListener and SetupEncryptionToast #28299

Merged
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
24 changes: 9 additions & 15 deletions src/DeviceListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,27 +292,21 @@ export default class DeviceListener {
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);

// cross signing isn't enabled - nag to enable it
// There are 3 different toasts for:
// There are 2 different toasts for:
if (!(await crypto.getCrossSigningKeyId()) && (await crypto.userHasCrossSigningKeys())) {
// Cross-signing on account but this device doesn't trust the master key (verify this session)
showSetupEncryptionToast(SetupKind.VERIFY_THIS_SESSION);
this.checkKeyBackupStatus();
} else {
const backupInfo = await this.getKeyBackupInfo();
florianduros marked this conversation as resolved.
Show resolved Hide resolved
if (backupInfo) {
// No cross-signing on account but key backup available (upgrade encryption)
showSetupEncryptionToast(SetupKind.UPGRADE_ENCRYPTION);
// No cross-signing or key backup on account (set up encryption)
await cli.waitForClientWellKnown();
if (isSecureBackupRequired(cli) && isLoggedIn()) {
// If we're meant to set up, and Secure Backup is required,
// trigger the flow directly without a toast once logged in.
hideSetupEncryptionToast();
accessSecretStorage();
} else {
// No cross-signing or key backup on account (set up encryption)
await cli.waitForClientWellKnown();
if (isSecureBackupRequired(cli) && isLoggedIn()) {
// If we're meant to set up, and Secure Backup is required,
// trigger the flow directly without a toast once logged in.
hideSetupEncryptionToast();
accessSecretStorage();
} else {
showSetupEncryptionToast(SetupKind.SET_UP_ENCRYPTION);
}
showSetupEncryptionToast(SetupKind.SET_UP_ENCRYPTION);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,6 @@
},
"unable_to_setup_keys_error": "Unable to set up keys",
"unsupported": "This client does not support end-to-end encryption.",
"upgrade_toast_title": "Encryption upgrade available",
"verification": {
"accepting": "Accepting…",
"after_new_login": {
Expand Down
7 changes: 0 additions & 7 deletions src/toasts/SetupEncryptionToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ const getTitle = (kind: Kind): string => {
switch (kind) {
case Kind.SET_UP_ENCRYPTION:
return _t("encryption|set_up_toast_title");
case Kind.UPGRADE_ENCRYPTION:
return _t("encryption|upgrade_toast_title");
case Kind.VERIFY_THIS_SESSION:
return _t("encryption|verify_toast_title");
}
Expand All @@ -33,7 +31,6 @@ const getTitle = (kind: Kind): string => {
const getIcon = (kind: Kind): string => {
switch (kind) {
case Kind.SET_UP_ENCRYPTION:
case Kind.UPGRADE_ENCRYPTION:
return "secure_backup";
case Kind.VERIFY_THIS_SESSION:
return "verification_warning";
Expand All @@ -44,8 +41,6 @@ const getSetupCaption = (kind: Kind): string => {
switch (kind) {
case Kind.SET_UP_ENCRYPTION:
return _t("action|continue");
case Kind.UPGRADE_ENCRYPTION:
return _t("action|upgrade");
case Kind.VERIFY_THIS_SESSION:
return _t("action|verify");
}
Expand All @@ -54,7 +49,6 @@ const getSetupCaption = (kind: Kind): string => {
const getDescription = (kind: Kind): string => {
switch (kind) {
case Kind.SET_UP_ENCRYPTION:
case Kind.UPGRADE_ENCRYPTION:
return _t("encryption|set_up_toast_description");
case Kind.VERIFY_THIS_SESSION:
return _t("encryption|verify_toast_description");
Expand All @@ -63,7 +57,6 @@ const getDescription = (kind: Kind): string => {

export enum Kind {
SET_UP_ENCRYPTION = "set_up_encryption",
UPGRADE_ENCRYPTION = "upgrade_encryption",
VERIFY_THIS_SESSION = "verify_this_session",
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit-tests/DeviceListener-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,13 @@ describe("DeviceListener", () => {
mockCrypto!.getCrossSigningKeyId.mockResolvedValue("abc");
});

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

expect(SetupEncryptionToast.showToast).toHaveBeenCalledWith(
SetupEncryptionToast.Kind.UPGRADE_ENCRYPTION,
SetupEncryptionToast.Kind.SET_UP_ENCRYPTION,
);
});
});
Expand Down
Loading