Use new trait bounds for KeyId to only allow specific types.
Change the KeyId validation to be generic over the key name type.
Remove the KeyName type and replace it with the more specific
ServerSigningKeyVersion.
Loop through the events only once to detect both whether there is
markdown and whether the markdown is inline.
Fix more cases of false negatives in markdown detection, like
whitespaces that are removed or the string beginning by a backslash
escape.
It seems that we cant count on serde_json::to_value to detect
duplicates,
because it swallows them instead of returning an error.
The only solution then is to serialize to string and try to deserialize
again.
This allows deserializing all the `*EventContent` types into a parent `Any{...}EventContent`, assuming we know the type of the underlying event.
Required for serializing/deserializing the content of events we'd like to send, across application restarts, as in https://github.com/matrix-org/matrix-rust-sdk/issues/3361 for the Rust SDK.
---
* events: add deserialize_with_type to all the *EventContent types
* events: add smoke test for deserializing an event content with a type
* events: add a test for deserializing a secret storage key event content
* events: add fix for correctly matching events with a type fragment
* Address review comments.