crypto: Connect the key request handling to the main state machine.

master
Damir Jelić 2020-09-29 17:40:06 +02:00
parent 78badd9af8
commit 2b8d4a21a4
1 changed files with 9 additions and 5 deletions

View File

@ -790,10 +790,6 @@ impl OlmMachine {
}
}
fn handle_room_key_request(&self, _: &ToDeviceEvent<RoomKeyRequestEventContent>) {
// TODO handle room key requests here.
}
async fn handle_verification_event(&self, mut event: &mut AnyToDeviceEvent) {
if let Err(e) = self.verification_machine.receive_event(&mut event).await {
error!("Error handling a verification event: {:?}", e);
@ -884,7 +880,9 @@ impl OlmMachine {
*event_result = decrypted_event;
}
AnyToDeviceEvent::RoomKeyRequest(e) => self.handle_room_key_request(e),
AnyToDeviceEvent::RoomKeyRequest(e) => {
self.key_request_machine.receive_incoming_key_request(e)
}
AnyToDeviceEvent::KeyVerificationAccept(..)
| AnyToDeviceEvent::KeyVerificationCancel(..)
| AnyToDeviceEvent::KeyVerificationKey(..)
@ -896,6 +894,12 @@ impl OlmMachine {
_ => continue,
}
}
// TODO remove this unwrap.
self.key_request_machine
.collect_incoming_key_requests()
.await
.unwrap();
}
/// Decrypt an event from a room timeline.