From 366a88cc5ca7177c86cf2324a34b537ca55655e9 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 26 Jul 2017 08:04:46 +0100 Subject: [PATCH] make olm._decryptMessage asynchronous --- src/crypto/algorithms/olm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/crypto/algorithms/olm.js b/src/crypto/algorithms/olm.js index 9cfe49a9b..c28ad9de2 100644 --- a/src/crypto/algorithms/olm.js +++ b/src/crypto/algorithms/olm.js @@ -172,7 +172,7 @@ OlmDecryption.prototype.decryptEvent = async function(event) { let payloadString; try { - payloadString = this._decryptMessage(deviceKey, message); + payloadString = await this._decryptMessage(deviceKey, message); } catch (e) { throw new base.DecryptionError( "Bad Encrypted Message", { @@ -235,7 +235,9 @@ OlmDecryption.prototype.decryptEvent = async function(event) { * * @return {string} payload, if decrypted successfully. */ -OlmDecryption.prototype._decryptMessage = function(theirDeviceIdentityKey, message) { +OlmDecryption.prototype._decryptMessage = async function( + theirDeviceIdentityKey, message, +) { const sessionIds = this._olmDevice.getSessionIdsForDevice(theirDeviceIdentityKey); // try each session in turn.