From 6de213483cbe3ad23fbcd93be9e429378d4da755 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 31 Oct 2018 18:31:56 +0000 Subject: [PATCH] Change getDeviceByIdentityKey() to just the 2 arg version --- src/crypto/DeviceList.js | 15 ++++----------- src/crypto/index.js | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/crypto/DeviceList.js b/src/crypto/DeviceList.js index 417aa0dfb..57bc74a4f 100644 --- a/src/crypto/DeviceList.js +++ b/src/crypto/DeviceList.js @@ -377,22 +377,15 @@ export default class DeviceList { /** * Find a device by curve25519 identity key * - * @param {string} userId owner of the device (optional) * @param {string} algorithm encryption algorithm * @param {string} senderKey curve25519 key to match * * @return {module:crypto/deviceinfo?} */ - getDeviceByIdentityKey(userId, algorithm, senderKey) { - if (arguments.length === 2) { - // if userId is omitted, shift the other arguments, and look up the - // userid - senderKey = algorithm; - algorithm = userId; - userId = this._userByIdentityKey[senderKey]; - if (!userId) { - return null; - } + getDeviceByIdentityKey(algorithm, senderKey) { + const userId = this._userByIdentityKey[senderKey]; + if (!userId) { + return null; } if ( diff --git a/src/crypto/index.js b/src/crypto/index.js index 3918ec862..97244f7b3 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -713,7 +713,7 @@ Crypto.prototype.getEventSenderDeviceInfo = function(event) { // identity key of the device which set up the Megolm session. const device = this._deviceList.getDeviceByIdentityKey( - event.getSender(), algorithm, senderKey, + algorithm, senderKey, ); if (device === null) {