diff --git a/README.md b/README.md index 756b8c71ca9..5272706e432 100644 --- a/README.md +++ b/README.md @@ -325,6 +325,8 @@ await matrixClient.initRustCrypto(); After calling `initRustCrypto`, you can obtain a reference to the [`CryptoApi`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.CryptoApi.html) interface, which is the main entry point for end-to-end encryption, by calling [`MatrixClient.getCrypto`](https://matrix-org.github.io/matrix-js-sdk/classes/matrix.MatrixClient.html#getCrypto). +**WARNING**: the cryptography stack is not thread-safe. Having multiple `MatrixClient` instances connected to the same Indexed DB will cause data corruption and decryption failures. The application layer is responsible for ensuring that only one `MatrixClient` issue is instantiated at a time. + ## Secret storage You should normally set up [secret storage](https://spec.matrix.org/v1.12/client-server-api/#secret-storage) before using the end-to-end encryption. To do this, call [`CryptoApi.bootstrapSecretStorage`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.CryptoApi.html#bootstrapSecretStorage). diff --git a/src/client.ts b/src/client.ts index 478e2784e51..dbe1363942c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2222,6 +2222,10 @@ export class MatrixClient extends TypedEventEmitter