From b338cc1495055f05b101ea38b9f99bc7ca81f10e Mon Sep 17 00:00:00 2001 From: sualko Date: Thu, 28 Jun 2018 15:07:06 +0200 Subject: [PATCH] always pass the full address to isTrustedIdentity For consistency with loadIdentityKey and saveIdentity. See also 1fe18c3384ccc2c149a4679d16e523d661543f6b. --- src/SessionBuilder.js | 4 ++-- src/SessionCipher.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SessionBuilder.js b/src/SessionBuilder.js index 721851f..9a57a25 100644 --- a/src/SessionBuilder.js +++ b/src/SessionBuilder.js @@ -7,7 +7,7 @@ SessionBuilder.prototype = { processPreKey: function(device) { return Internal.SessionLock.queueJobForNumber(this.remoteAddress.toString(), function() { return this.storage.isTrustedIdentity( - this.remoteAddress.getName(), device.identityKey, this.storage.Direction.SENDING + this.remoteAddress.toString(), device.identityKey, this.storage.Direction.SENDING ).then(function(trusted) { if (!trusted) { throw new Error('Identity key changed'); @@ -60,7 +60,7 @@ SessionBuilder.prototype = { processV3: function(record, message) { var preKeyPair, signedPreKeyPair, session; return this.storage.isTrustedIdentity( - this.remoteAddress.getName(), message.identityKey.toArrayBuffer(), this.storage.Direction.RECEIVING + this.remoteAddress.toString(), message.identityKey.toArrayBuffer(), this.storage.Direction.RECEIVING ).then(function(trusted) { if (!trusted) { var e = new Error('Unknown identity key'); diff --git a/src/SessionCipher.js b/src/SessionCipher.js index 5fc0e63..b13af8c 100644 --- a/src/SessionCipher.js +++ b/src/SessionCipher.js @@ -77,7 +77,7 @@ SessionCipher.prototype = { result.set(new Uint8Array(mac, 0, 8), encodedMsg.byteLength + 1); return this.storage.isTrustedIdentity( - this.remoteAddress.getName(), util.toArrayBuffer(session.indexInfo.remoteIdentityKey), this.storage.Direction.SENDING + this.remoteAddress.toString(), util.toArrayBuffer(session.indexInfo.remoteIdentityKey), this.storage.Direction.SENDING ).then(function(trusted) { if (!trusted) { throw new Error('Identity key changed'); @@ -159,7 +159,7 @@ SessionCipher.prototype = { } return this.storage.isTrustedIdentity( - this.remoteAddress.getName(), util.toArrayBuffer(result.session.indexInfo.remoteIdentityKey), this.storage.Direction.RECEIVING + this.remoteAddress.toString(), util.toArrayBuffer(result.session.indexInfo.remoteIdentityKey), this.storage.Direction.RECEIVING ).then(function(trusted) { if (!trusted) { throw new Error('Identity key changed');