mirror of
https://github.com/element-hq/element-web.git
synced 2025-12-28 07:14:20 +00:00
Don't show the key storage out of sync toast when backup disabled (#31506)
This commit is contained in:
parent
cff9119324
commit
4bd8eeb17a
@ -438,7 +438,10 @@ export default class DeviceListener {
|
||||
// said we are OK with that.
|
||||
const keyBackupIsOk = keyBackupUploadActive || backupDisabled;
|
||||
|
||||
const backupKeyCached = (await crypto.getSessionBackupPrivateKey()) !== null;
|
||||
// If key backup is active and not disabled: do we have the backup key
|
||||
// cached locally?
|
||||
const backupKeyCached =
|
||||
!keyBackupUploadActive || backupDisabled || (await crypto.getSessionBackupPrivateKey()) !== null;
|
||||
|
||||
const allSystemsReady =
|
||||
isCurrentDeviceTrusted && allCrossSigningSecretsCached && keyBackupIsOk && recoveryIsOk && backupKeyCached;
|
||||
|
||||
@ -367,7 +367,7 @@ describe("DeviceListener", () => {
|
||||
expect(SetupEncryptionToast.hideToast).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows an out-of-sync toast when one of the secrets is missing locally", async () => {
|
||||
it("shows an out-of-sync toast when one of the cross-signing secrets is missing locally", async () => {
|
||||
mockCrypto!.getCrossSigningStatus.mockResolvedValue({
|
||||
publicKeysOnDevice: true,
|
||||
privateKeysInSecretStorage: true,
|
||||
@ -385,6 +385,30 @@ describe("DeviceListener", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("shows an out-of-sync toast when the backup key is missing locally", async () => {
|
||||
mockCrypto!.getSecretStorageStatus.mockResolvedValue(readySecretStorageStatus);
|
||||
mockCrypto!.getActiveSessionBackupVersion.mockResolvedValue("1");
|
||||
mockCrypto!.getSessionBackupPrivateKey.mockResolvedValue(null);
|
||||
|
||||
await createAndStart();
|
||||
|
||||
expect(SetupEncryptionToast.showToast).toHaveBeenCalledWith(
|
||||
SetupEncryptionToast.Kind.KEY_STORAGE_OUT_OF_SYNC,
|
||||
);
|
||||
});
|
||||
|
||||
it("does not show an out-of-sync toast when the backup key is missing locally but backup is purposely disabled", async () => {
|
||||
mockCrypto!.getSecretStorageStatus.mockResolvedValue(readySecretStorageStatus);
|
||||
mockCrypto!.getSessionBackupPrivateKey.mockResolvedValue(null);
|
||||
mockClient.getAccountDataFromServer.mockImplementation((eventType) =>
|
||||
eventType === BACKUP_DISABLED_ACCOUNT_DATA_KEY ? ({ disabled: true } as any) : null,
|
||||
);
|
||||
|
||||
await createAndStart();
|
||||
|
||||
expect(SetupEncryptionToast.hideToast).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("hides the out-of-sync toast after we receive the missing secrets", async () => {
|
||||
mockCrypto!.getSecretStorageStatus.mockResolvedValue(readySecretStorageStatus);
|
||||
mockCrypto!.getActiveSessionBackupVersion.mockResolvedValue("1");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user