Refactor the verification handling in the crypto crate
The verification logic has a bunch of layers, the bottom layer is a type-safe state machine. We should be able to simplify this, at least for the SAS verification types.
One thing that would help out immensely for the type-safe state machine is the type-changing struct update syntax.
Has been in development for some while though: https://github.com/rust-lang/rust/issues/86555.
It's also a bit magical how the crypto crates handles verification events. For example in rooms, it handles it because we try to decrypt the event (there is no receive room event call similar to to_device). As a consequence verification in a clear room won't work.
It's also a bit magical how the crypto crates handles verification events. For example in rooms, it handles it because we try to decrypt the event (there is no receive room event call similar to to_device). As a consequence verification in a clear room won't work.
Oh I see there is a call for that receiveUnencryptedVerificationEvent()
Oh I see there is a call for that receiveUnencryptedVerificationEvent()
There is, but you also seem to have missed some conversation in chat:
how about we remove the implicit handling of verification events when you decrypt, deprecate the receive_unencrypted_verification_event method and instead add a receive_verification_events() method; this method takes all the verification events we received in a particular sync and we fire out the signals when this method is gone through all events?
Perhaps we'll end up with just a single method that you need to call explicitly.