Skip to content

Commit

Permalink
Throw clearer error if createSecretStorageKey misbehaves
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 committed Sep 17, 2024
1 parent 53b599f commit 739c458
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 @@ -763,6 +763,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 739c458

Please sign in to comment.