Skip to content

Commit

Permalink
Throw clearer error if createSecretStorageKey misbehaves (#4412)
Browse files Browse the repository at this point in the history
element-hq/element-web#27888 shows a slightly
mysterious error message, but the problem is `createSecretStorageKey`
returning the wrong thing.
  • Loading branch information
richvdh authored Sep 23, 2024
1 parent dbd7d26 commit 092a59a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rust-crypto/rust-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 092a59a

Please sign in to comment.