From 1a98634fd6f81c53581cde30263925347b3e4032 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Fri, 12 Jun 2020 12:32:42 +0000 Subject: [PATCH] fix key request sending --- lib/encryption/key_manager.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/encryption/key_manager.dart b/lib/encryption/key_manager.dart index 59394c1..4782695 100644 --- a/lib/encryption/key_manager.dart +++ b/lib/encryption/key_manager.dart @@ -513,10 +513,24 @@ class RoomKeyRequest extends ToDeviceEvent { for (final key in session.forwardingCurve25519KeyChain) { forwardedKeys.add(key); } - await requestingDevice.setVerified(true, keyManager.client); var message = session.content; message['forwarding_curve25519_key_chain'] = forwardedKeys; + message['sender_key'] = request.senderKey; + message['sender_claimed_ed25519_key'] = + forwardedKeys.isEmpty ? keyManager.encryption.fingerprintKey : null; + if (message['sender_claimed_ed25519_key'] == null) { + for (final value in keyManager.client.userDeviceKeys.values) { + for (final key in value.deviceKeys.values) { + if (key.curve25519Key == forwardedKeys.first) { + message['sender_claimed_ed25519_key'] = key.ed25519Key; + } + } + if (message['sender_claimed_ed25519_key'] != null) { + break; + } + } + } message['session_key'] = session.inboundGroupSession .export_session(session.inboundGroupSession.first_known_index()); // send the actual reply of the key back to the requester