You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-23 17:02:25 +03:00
CryptoApi.resetEncryption should always create a new key backup (#4648)
* fix(crypto api): `resetEncryption` always calls `resetKeyBackup` * test(crypto api): update `resetEncryption` tests * chore(crypto api): add logging in `resetEncryption`
This commit is contained in:
@@ -1477,7 +1477,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
|
||||
* Implementation of {@link CryptoApi#resetEncryption}.
|
||||
*/
|
||||
public async resetEncryption(authUploadDeviceSigningKeys: UIAuthCallback<void>): Promise<void> {
|
||||
const backupEnabled = (await this.backupManager.getActiveBackupVersion()) !== null;
|
||||
this.logger.debug("resetEncryption: resetting encryption");
|
||||
|
||||
// Disable backup, and delete all the backups from the server
|
||||
await this.backupManager.deleteAllKeyBackupVersions();
|
||||
@@ -1491,10 +1491,10 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
|
||||
authUploadDeviceSigningKeys,
|
||||
});
|
||||
|
||||
// If key backup was enabled, we create a new backup
|
||||
if (backupEnabled) {
|
||||
await this.resetKeyBackup();
|
||||
}
|
||||
// Create a new key backup
|
||||
await this.resetKeyBackup();
|
||||
|
||||
this.logger.debug("resetEncryption: ended");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user