You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Make some OlmDevice megolm methods async
* OlmDevice.hasInboundSessionKeys * OlmDevice.getInboundGroupSessionKey The latter means that MegolmDecryption.shareKeysWithDevice takes longer before it sends out the keyshare, so means the unit test needed an update
This commit is contained in:
@@ -725,7 +725,7 @@ MegolmDecryption.prototype.onRoomKeyEvent = function(event) {
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
MegolmDecryption.prototype.hasKeysForKeyRequest = async function(keyRequest) {
|
||||
MegolmDecryption.prototype.hasKeysForKeyRequest = function(keyRequest) {
|
||||
const body = keyRequest.requestBody;
|
||||
|
||||
return this._olmDevice.hasInboundSessionKeys(
|
||||
@@ -766,10 +766,10 @@ MegolmDecryption.prototype.shareKeysWithDevice = function(keyRequest) {
|
||||
+ userId + ":" + deviceId,
|
||||
);
|
||||
|
||||
const payload = this._buildKeyForwardingMessage(
|
||||
return this._buildKeyForwardingMessage(
|
||||
body.room_id, body.sender_key, body.session_id,
|
||||
);
|
||||
|
||||
}).then((payload) => {
|
||||
const encryptedContent = {
|
||||
algorithm: olmlib.OLM_ALGORITHM,
|
||||
sender_key: this._olmDevice.deviceCurve25519Key,
|
||||
@@ -797,10 +797,10 @@ MegolmDecryption.prototype.shareKeysWithDevice = function(keyRequest) {
|
||||
}).done();
|
||||
};
|
||||
|
||||
MegolmDecryption.prototype._buildKeyForwardingMessage = function(
|
||||
MegolmDecryption.prototype._buildKeyForwardingMessage = async function(
|
||||
roomId, senderKey, sessionId,
|
||||
) {
|
||||
const key = this._olmDevice.getInboundGroupSessionKey(
|
||||
const key = await this._olmDevice.getInboundGroupSessionKey(
|
||||
roomId, senderKey, sessionId,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user