You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -331,7 +331,8 @@ To obtain a reference, call [`MatrixClient.getCrypto`](https://matrix-org.github
331
331
332
332
### Secret storage
333
333
334
-
If your [secret storage](https://spec.matrix.org/v1.12/client-server-api/#secret-storage) is not set up, you need to bootstrap it before using the `CryptoApi`:
334
+
You should set up the [secret storage](https://spec.matrix.org/v1.12/client-server-api/#secret-storage) before using the end-to-end encryption. To do this, you need to call [`CryptoApi.bootstrapSecretStorage`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.CryptoApi.html#bootstrapSecretStorage).
335
+
`CryptoApi.bootstrapSecretStorage` can be called unconditionally, but it will only set up the secret storage if it is not already set up (unless you use the `setupNewSecretStorage` parameter).
// If `setupNewSecretStorage` is `true`, you need to fill `createSecretStorageKey`
351
352
setupNewSecretStorage:true,
352
353
// This function will be called if a new secret storage key (aka recovery key) is needed.
353
-
// You should remember the key you return here, because you will need it to unlock the secret storage.
354
+
// You should prompt the user to save the keu somewhere, because you will need it to unlock the secret storage.
354
355
createSecretStorageKey:async () => {
355
356
return mySecretStorageKey;
356
357
},
357
358
});
358
359
```
359
360
360
361
In the example above, we are setting up a new secret storage. The secret storage data will be encrypted using the secret storage key returned in `createSecretStorageKey`.
361
-
You should remember this key because when access to the secret storage is needed, the crypto moduel is expecting the `getSecretStorageKey` to return this key.
We recommend that you prompt the user to re-enter this key when [`CryptoCallbacks.getSecretStorageKey`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.CryptoCallbacks.html#getSecretStorageKey) is called (when the secret storage access is needed).
365
363
366
364
Also, if you don't have a [key backup](https://spec.matrix.org/v1.12/client-server-api/#server-side-key-backups) you should create one:
367
365
368
366
```javascript
367
+
// Check if we have a key backup.
368
+
// checkKeyBackupAndEnable returns null, there is no key backup.
The [`authUploadDeviceSigningKeys`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.BootstrapCrossSigningOpts.html#authUploadDeviceSigningKeys) callback
390
396
is required in order to upload newly-generated public cross-signing keys to the server.
391
397
392
-
393
398
### Verify a new device
394
399
395
400
Once the cross-signing is set up on one of your devices, you can verify another device with two methods:
0 commit comments