mirror of https://github.com/vector-im/riot-web
Remove upgrade encryption in `DeviceListener` and `SetupEncryptionToast` (#28299)
* Remove upgrade encryption in `DeviceListener` and `SetupEncryptionToast` * Update comments to `2 different toasts`pull/28319/head
parent
79c956388f
commit
e5b55db1db
|
@ -292,16 +292,11 @@ export default class DeviceListener {
|
||||||
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);
|
await crypto.getUserDeviceInfo([cli.getSafeUserId()]);
|
||||||
|
|
||||||
// cross signing isn't enabled - nag to enable it
|
// 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())) {
|
if (!(await crypto.getCrossSigningKeyId()) && (await crypto.userHasCrossSigningKeys())) {
|
||||||
// Cross-signing on account but this device doesn't trust the master key (verify this session)
|
// Cross-signing on account but this device doesn't trust the master key (verify this session)
|
||||||
showSetupEncryptionToast(SetupKind.VERIFY_THIS_SESSION);
|
showSetupEncryptionToast(SetupKind.VERIFY_THIS_SESSION);
|
||||||
this.checkKeyBackupStatus();
|
this.checkKeyBackupStatus();
|
||||||
} else {
|
|
||||||
const backupInfo = await this.getKeyBackupInfo();
|
|
||||||
if (backupInfo) {
|
|
||||||
// No cross-signing on account but key backup available (upgrade encryption)
|
|
||||||
showSetupEncryptionToast(SetupKind.UPGRADE_ENCRYPTION);
|
|
||||||
} else {
|
} else {
|
||||||
// No cross-signing or key backup on account (set up encryption)
|
// No cross-signing or key backup on account (set up encryption)
|
||||||
await cli.waitForClientWellKnown();
|
await cli.waitForClientWellKnown();
|
||||||
|
@ -315,7 +310,6 @@ export default class DeviceListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// This needs to be done after awaiting on getUserDeviceInfo() above, so
|
// This needs to be done after awaiting on getUserDeviceInfo() above, so
|
||||||
// we make sure we get the devices after the fetch is done.
|
// we make sure we get the devices after the fetch is done.
|
||||||
|
|
|
@ -930,7 +930,6 @@
|
||||||
},
|
},
|
||||||
"unable_to_setup_keys_error": "Unable to set up keys",
|
"unable_to_setup_keys_error": "Unable to set up keys",
|
||||||
"unsupported": "This client does not support end-to-end encryption.",
|
"unsupported": "This client does not support end-to-end encryption.",
|
||||||
"upgrade_toast_title": "Encryption upgrade available",
|
|
||||||
"verification": {
|
"verification": {
|
||||||
"accepting": "Accepting…",
|
"accepting": "Accepting…",
|
||||||
"after_new_login": {
|
"after_new_login": {
|
||||||
|
|
|
@ -23,8 +23,6 @@ const getTitle = (kind: Kind): string => {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Kind.SET_UP_ENCRYPTION:
|
case Kind.SET_UP_ENCRYPTION:
|
||||||
return _t("encryption|set_up_toast_title");
|
return _t("encryption|set_up_toast_title");
|
||||||
case Kind.UPGRADE_ENCRYPTION:
|
|
||||||
return _t("encryption|upgrade_toast_title");
|
|
||||||
case Kind.VERIFY_THIS_SESSION:
|
case Kind.VERIFY_THIS_SESSION:
|
||||||
return _t("encryption|verify_toast_title");
|
return _t("encryption|verify_toast_title");
|
||||||
}
|
}
|
||||||
|
@ -33,7 +31,6 @@ const getTitle = (kind: Kind): string => {
|
||||||
const getIcon = (kind: Kind): string => {
|
const getIcon = (kind: Kind): string => {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Kind.SET_UP_ENCRYPTION:
|
case Kind.SET_UP_ENCRYPTION:
|
||||||
case Kind.UPGRADE_ENCRYPTION:
|
|
||||||
return "secure_backup";
|
return "secure_backup";
|
||||||
case Kind.VERIFY_THIS_SESSION:
|
case Kind.VERIFY_THIS_SESSION:
|
||||||
return "verification_warning";
|
return "verification_warning";
|
||||||
|
@ -44,8 +41,6 @@ const getSetupCaption = (kind: Kind): string => {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Kind.SET_UP_ENCRYPTION:
|
case Kind.SET_UP_ENCRYPTION:
|
||||||
return _t("action|continue");
|
return _t("action|continue");
|
||||||
case Kind.UPGRADE_ENCRYPTION:
|
|
||||||
return _t("action|upgrade");
|
|
||||||
case Kind.VERIFY_THIS_SESSION:
|
case Kind.VERIFY_THIS_SESSION:
|
||||||
return _t("action|verify");
|
return _t("action|verify");
|
||||||
}
|
}
|
||||||
|
@ -54,7 +49,6 @@ const getSetupCaption = (kind: Kind): string => {
|
||||||
const getDescription = (kind: Kind): string => {
|
const getDescription = (kind: Kind): string => {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Kind.SET_UP_ENCRYPTION:
|
case Kind.SET_UP_ENCRYPTION:
|
||||||
case Kind.UPGRADE_ENCRYPTION:
|
|
||||||
return _t("encryption|set_up_toast_description");
|
return _t("encryption|set_up_toast_description");
|
||||||
case Kind.VERIFY_THIS_SESSION:
|
case Kind.VERIFY_THIS_SESSION:
|
||||||
return _t("encryption|verify_toast_description");
|
return _t("encryption|verify_toast_description");
|
||||||
|
@ -63,7 +57,6 @@ const getDescription = (kind: Kind): string => {
|
||||||
|
|
||||||
export enum Kind {
|
export enum Kind {
|
||||||
SET_UP_ENCRYPTION = "set_up_encryption",
|
SET_UP_ENCRYPTION = "set_up_encryption",
|
||||||
UPGRADE_ENCRYPTION = "upgrade_encryption",
|
|
||||||
VERIFY_THIS_SESSION = "verify_this_session",
|
VERIFY_THIS_SESSION = "verify_this_session",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,13 +351,13 @@ describe("DeviceListener", () => {
|
||||||
mockCrypto!.getCrossSigningKeyId.mockResolvedValue("abc");
|
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
|
// non falsy response
|
||||||
mockClient!.getKeyBackupVersion.mockResolvedValue({} as unknown as KeyBackupInfo);
|
mockClient!.getKeyBackupVersion.mockResolvedValue({} as unknown as KeyBackupInfo);
|
||||||
await createAndStart();
|
await createAndStart();
|
||||||
|
|
||||||
expect(SetupEncryptionToast.showToast).toHaveBeenCalledWith(
|
expect(SetupEncryptionToast.showToast).toHaveBeenCalledWith(
|
||||||
SetupEncryptionToast.Kind.UPGRADE_ENCRYPTION,
|
SetupEncryptionToast.Kind.SET_UP_ENCRYPTION,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue