Skip to content

Commit 092a59a

Browse files
authored
Throw clearer error if createSecretStorageKey misbehaves (#4412)
element-hq/element-web#27888 shows a slightly mysterious error message, but the problem is `createSecretStorageKey` returning the wrong thing.
1 parent dbd7d26 commit 092a59a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/rust-crypto/rust-crypto.ts

+3
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,9 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
777777
// Create a new storage key and add it to secret storage
778778
this.logger.info("bootstrapSecretStorage: creating new secret storage key");
779779
const recoveryKey = await createSecretStorageKey();
780+
if (!recoveryKey) {
781+
throw new Error("createSecretStorageKey() callback did not return a secret storage key");
782+
}
780783
await this.addSecretStorageKeyToSecretStorage(recoveryKey);
781784
}
782785

0 commit comments

Comments
 (0)