diff --git a/src/crypto/algorithms/base.js b/src/crypto/algorithms/base.js index 5d9df319d..ad19f6fd0 100644 --- a/src/crypto/algorithms/base.js +++ b/src/crypto/algorithms/base.js @@ -163,6 +163,8 @@ utils.inherits(module.exports.DecryptionError, Error); * * @constructor * @param {string} msg message describing the problem + * @param {Object} devices userId -> {deviceId -> object} + * set of unknown devices per user we're warning about * @extends Error */ module.exports.UnknownDeviceError = function(msg, devices) { diff --git a/src/crypto/algorithms/megolm.js b/src/crypto/algorithms/megolm.js index 54c2660fd..8803d31d1 100644 --- a/src/crypto/algorithms/megolm.js +++ b/src/crypto/algorithms/megolm.js @@ -423,12 +423,15 @@ MegolmEncryption.prototype.encryptMessage = function(room, eventType, content) { * Checks the devices we're about to send to and see if any are entirely * unknown to the user. If so, warn the user, and mark them as known to * give the user a chance to go verify them before re-sending this message. + * + * @param {Object} devicesInRoom userId -> {deviceId -> object} + * devices we should shared the session with. */ MegolmEncryption.prototype._checkForUnknownDevices = function(devicesInRoom) { const unknownDevices = {}; - Object.keys(devicesInRoom).forEach(userId=>{ - Object.keys(devicesInRoom[userId]).forEach(deviceId=>{ + Object.keys(devicesInRoom).forEach((userId)=>{ + Object.keys(devicesInRoom[userId]).forEach((deviceId)=>{ const device = devicesInRoom[userId][deviceId]; if (device.isUnverified() && !device.isKnown()) { // mark the devices as known to the user, given we're about to