Skip to content

Commit 1cad6f4

Browse files
authored
Add multiprocess health warnings to initRustCrypto (#4571)
1 parent c4ea57d commit 1cad6f4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ await matrixClient.initRustCrypto();
325325

326326
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).
327327

328+
**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.
329+
328330
## Secret storage
329331

330332
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).

src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,10 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
22222222
*
22232223
* An alternative to {@link initCrypto}.
22242224
*
2225+
* **WARNING**: the cryptography stack is not thread-safe. Having multiple `MatrixClient` instances connected to
2226+
* the same Indexed DB will cause data corruption and decryption failures. The application layer is responsible for
2227+
* ensuring that only one `MatrixClient` issue is instantiated at a time.
2228+
*
22252229
* @param args.useIndexedDB - True to use an indexeddb store, false to use an in-memory store. Defaults to 'true'.
22262230
* @param args.storageKey - A key with which to encrypt the indexeddb store. If provided, it must be exactly
22272231
* 32 bytes of data, and must be the same each time the client is initialised for a given device.

0 commit comments

Comments
 (0)