1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-07 23:02:56 +03:00

Throw clearer error if createSecretStorageKey misbehaves (#4412)

https://github.com/element-hq/element-web/issues/27888 shows a slightly
mysterious error message, but the problem is `createSecretStorageKey`
returning the wrong thing.
This commit is contained in:
Richard van der Hoff
2024-09-23 11:25:42 +01:00
committed by GitHub
parent dbd7d26968
commit 092a59af66

View File

@@ -777,6 +777,9 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
// Create a new storage key and add it to secret storage
this.logger.info("bootstrapSecretStorage: creating new secret storage key");
const recoveryKey = await createSecretStorageKey();
if (!recoveryKey) {
throw new Error("createSecretStorageKey() callback did not return a secret storage key");
}
await this.addSecretStorageKeyToSecretStorage(recoveryKey);
}