1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

make olm._decryptMessage asynchronous

This commit is contained in:
Richard van der Hoff
2017-07-26 08:04:46 +01:00
parent 951df61aa0
commit 366a88cc5c

View File

@@ -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.