Key storage out of sync: reset key backup when needed (#31279)
* add function to pause device listener * add function to check if key backup key missing both locally and in 4s * reset backup if backup key missing both locally and in 4s * fixup! add function to check if key backup key missing both locally and in 4s * Drop KEY_STORAGE_OUT_OF_SYNC_STORE in favour of checking cross-signing Check if cross-signing needs resetting, because that seems to be what KEY_STORAGE_OUT_OF_SYNC_STORE is actually trying to do. * add a function for resetting key backup and waiting until it's ready * trigger key storage out of sync toast when missing backup key locally and fetch it when user enters their recovery key * reset backup when needed if user forgets recovery key * rename function as suggested in code review
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2025 Element Creations Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { type CryptoApi } from "matrix-js-sdk/src/crypto-api";
|
||||
|
||||
/**
|
||||
* Creates a new key backup version, and wait until it is enabled.
|
||||
*
|
||||
* This is typically used within a {@link DeviceListener.pause()} call, to
|
||||
* ensure that the device listener doesn't check the backup status until after the
|
||||
* key backup is active.
|
||||
*/
|
||||
export async function resetKeyBackupAndWait(crypto: CryptoApi): Promise<void> {
|
||||
await crypto.resetKeyBackup();
|
||||
await crypto.checkKeyBackupAndEnable();
|
||||
}
|
||||
Reference in New Issue
Block a user