olm.Utility should be instanciated

This commit is contained in:
Bruno Windels 2020-08-31 16:05:21 +02:00
parent 0399562340
commit 561df45641

View File

@ -40,7 +40,7 @@ export class DeviceTracker {
this._storage = storage; this._storage = storage;
this._getSyncToken = getSyncToken; this._getSyncToken = getSyncToken;
this._identityChangedForRoom = null; this._identityChangedForRoom = null;
this._olm = olm; this._olmUtil = new olm.Utility();
} }
async writeDeviceChanges(deviceLists, txn) { async writeDeviceChanges(deviceLists, txn) {
@ -217,7 +217,7 @@ export class DeviceTracker {
throw new Error("no signature"); throw new Error("no signature");
} }
// throws when signature is invalid // throws when signature is invalid
this._olm.Utility.ed25519_verify(key, canonicalJson, signature); this._olmUtil.ed25519_verify(key, canonicalJson, signature);
return true; return true;
} catch (err) { } catch (err) {
console.warn("Invalid device signature, ignoring device.", key, canonicalJson, signature, err); console.warn("Invalid device signature, ignoring device.", key, canonicalJson, signature, err);