From f7b29f3703642b4d0a5c7af062d2843815487e37 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 25 May 2020 07:31:17 +0000 Subject: [PATCH] Ignore key requests from unknown devices --- lib/src/client.dart | 2 +- lib/src/utils/room_key_request.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index a0751a3..6282788 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1574,7 +1574,7 @@ class Client { deviceKeys.verified && !deviceKeys.blocked) { await roomKeyRequest.forwardKey(); - } else { + } else if (roomKeyRequest.requestingDevice != null) { onRoomKeyRequest.add(roomKeyRequest); } } diff --git a/lib/src/utils/room_key_request.dart b/lib/src/utils/room_key_request.dart index 8f3d1bd..778e93e 100644 --- a/lib/src/utils/room_key_request.dart +++ b/lib/src/utils/room_key_request.dart @@ -22,7 +22,7 @@ class RoomKeyRequest extends ToDeviceEvent { for (final key in session.forwardingCurve25519KeyChain) { forwardedKeys.add(key); } - await requestingDevice?.setVerified(true, client); + await requestingDevice.setVerified(true, client); var message = session.content; message['forwarding_curve25519_key_chain'] = forwardedKeys;