diff --git a/src/matrix/e2ee/DeviceTracker.js b/src/matrix/e2ee/DeviceTracker.js index 0b4c73a2..6b6f3894 100644 --- a/src/matrix/e2ee/DeviceTracker.js +++ b/src/matrix/e2ee/DeviceTracker.js @@ -26,8 +26,8 @@ function deviceKeysAsDeviceIdentity(deviceSection) { return { userId, deviceId, - ed25519Key: deviceSection.keys?.[`ed25519:${deviceId}`], - curve25519Key: deviceSection.keys?.[`curve25519:${deviceId}`], + ed25519Key: deviceSection.keys[`ed25519:${deviceId}`], + curve25519Key: deviceSection.keys[`curve25519:${deviceId}`], algorithms: deviceSection.algorithms, displayName: deviceSection.unsigned?.device_display_name, }; @@ -200,6 +200,11 @@ export class DeviceTracker { if (deviceIdOnKeys !== deviceId) { return false; } + const ed25519Key = deviceKeys.keys?.[`ed25519:${deviceId}`]; + const curve25519Key = deviceKeys.keys?.[`curve25519:${deviceId}`]; + if (typeof ed25519Key !== "string" || typeof curve25519Key !== "string") { + return false; + } // don't store our own device if (userId === this._ownUserId && deviceId === this._ownDeviceId) { return false;