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

Make a start on a unit test for megolm alg impl

not much here yet, but it's a start at least.
This commit is contained in:
Richard van der Hoff
2017-06-20 11:41:52 +01:00
parent e2f4c0ffd1
commit be3fb0f917
2 changed files with 114 additions and 2 deletions

View File

@@ -520,6 +520,9 @@ function MegolmDecryption(params) {
// events which we couldn't decrypt due to unknown sessions / indexes: map from
// senderKey|sessionId to list of MatrixEvents
this._pendingEvents = {};
// this gets stubbed out by the unit tests.
this.olmlib = olmlib;
}
utils.inherits(MegolmDecryption, base.DecryptionAlgorithm);
@@ -698,7 +701,7 @@ MegolmDecryption.prototype.shareKeysWithDevice = function(keyRequest) {
const deviceInfo = this._crypto.getStoredDevice(userId, deviceId);
const body = keyRequest.requestBody;
olmlib.ensureOlmSessionsForDevices(
this.olmlib.ensureOlmSessionsForDevices(
this._olmDevice, this._baseApis, {
[userId]: [deviceInfo],
},
@@ -741,7 +744,7 @@ MegolmDecryption.prototype.shareKeysWithDevice = function(keyRequest) {
ciphertext: {},
};
olmlib.encryptMessageForDevice(
this.olmlib.encryptMessageForDevice(
encryptedContent.ciphertext,
this._userId,
this._deviceId,