From 81a1573e3bc457257f9f70c28d02854d78122395 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 1 Sep 2020 17:57:59 +0200 Subject: [PATCH] make a shared olm util for the whole session --- src/matrix/Session.js | 3 ++- src/matrix/e2ee/DeviceTracker.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 90db1b68..4d30516a 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -35,10 +35,11 @@ export class Session { this._user = new User(sessionInfo.userId); this._olm = olm; this._e2eeAccount = null; + const olmUtil = olm ? new olm.Utility() : null; this._deviceTracker = olm ? new DeviceTracker({ storage, getSyncToken: () => this.syncToken, - olm, + olmUtil, }) : null; } diff --git a/src/matrix/e2ee/DeviceTracker.js b/src/matrix/e2ee/DeviceTracker.js index 5eaa23b7..b085be80 100644 --- a/src/matrix/e2ee/DeviceTracker.js +++ b/src/matrix/e2ee/DeviceTracker.js @@ -36,11 +36,11 @@ function deviceKeysAsDeviceIdentity(deviceSection) { } export class DeviceTracker { - constructor({storage, getSyncToken, olm}) { + constructor({storage, getSyncToken, olmUtil}) { this._storage = storage; this._getSyncToken = getSyncToken; this._identityChangedForRoom = null; - this._olmUtil = new olm.Utility(); + this._olmUtil = olmUtil; } async writeDeviceChanges(deviceLists, txn) {