You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-05 17:02:07 +03:00
Allow getSecretStorageKey to be async
This commit is contained in:
@@ -215,7 +215,7 @@ function keyFromRecoverySession(session, decryptionKey) {
|
|||||||
* @param {function} [opts.cryptoCallbacks.getSecretStorageKey]
|
* @param {function} [opts.cryptoCallbacks.getSecretStorageKey]
|
||||||
* Optional. Function called when an encryption key for secret storage
|
* Optional. Function called when an encryption key for secret storage
|
||||||
* is required. One or more keys will be described in the keys object.
|
* is required. One or more keys will be described in the keys object.
|
||||||
* The callback function should return with an array of:
|
* The callback function should return a promise with an array of:
|
||||||
* [<key name>, <UInt8Array private key>] or null if it cannot provide
|
* [<key name>, <UInt8Array private key>] or null if it cannot provide
|
||||||
* any of the keys.
|
* any of the keys.
|
||||||
* Args:
|
* Args:
|
||||||
|
|||||||
@@ -533,9 +533,7 @@ export default class SecretStorage extends EventEmitter {
|
|||||||
throw new Error("No getSecretStorageKey callback supplied");
|
throw new Error("No getSecretStorageKey callback supplied");
|
||||||
}
|
}
|
||||||
|
|
||||||
const returned = await Promise.resolve(
|
const returned = await this._cryptoCallbacks.getSecretStorageKey({ keys });
|
||||||
this._cryptoCallbacks.getSecretStorageKey({keys}),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!returned) {
|
if (!returned) {
|
||||||
throw new Error("getSecretStorageKey callback returned falsey");
|
throw new Error("getSecretStorageKey callback returned falsey");
|
||||||
|
|||||||
Reference in New Issue
Block a user