From 1c31d31be1832a5014914655f0f65831d1e69ec1 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 20 Jun 2021 18:36:28 +0200 Subject: [PATCH] events: More consistent item ordering for room::encrypted --- crates/ruma-events/src/room/encrypted.rs | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/ruma-events/src/room/encrypted.rs b/crates/ruma-events/src/room/encrypted.rs index abe88809..73bad635 100644 --- a/crates/ruma-events/src/room/encrypted.rs +++ b/crates/ruma-events/src/room/encrypted.rs @@ -15,20 +15,6 @@ use crate::{ /// An event that has been encrypted. pub type EncryptedEvent = MessageEvent; -/// The encryption scheme for `EncryptedEventContent` -#[derive(Clone, Debug, Deserialize, Serialize)] -#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] -#[serde(tag = "algorithm")] -pub enum EncryptedEventScheme { - /// An event encrypted with *m.olm.v1.curve25519-aes-sha2*. - #[serde(rename = "m.olm.v1.curve25519-aes-sha2")] - OlmV1Curve25519AesSha2(OlmV1Curve25519AesSha2Content), - - /// An event encrypted with *m.megolm.v1.aes-sha2*. - #[serde(rename = "m.megolm.v1.aes-sha2")] - MegolmV1AesSha2(MegolmV1AesSha2Content), -} - /// The content payload for `EncryptedEvent`. #[derive(Clone, Debug, Deserialize, Serialize, EventContent)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] @@ -45,6 +31,9 @@ pub struct EncryptedEventContent { pub relates_to: Option, } +/// The to-device version of the payload for the `EncryptedEvent`. +pub type EncryptedToDeviceEventContent = EncryptedEventContent; + impl EncryptedEventContent { /// Creates a new `EncryptedEventContent` with the given scheme and relation. pub fn new(scheme: EncryptedEventScheme, relates_to: Option) -> Self { @@ -58,8 +47,19 @@ impl From for EncryptedEventContent { } } -/// The to-device version of the payload for the `EncryptedEvent`. -pub type EncryptedToDeviceEventContent = EncryptedEventContent; +/// The encryption scheme for `EncryptedEventContent` +#[derive(Clone, Debug, Deserialize, Serialize)] +#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] +#[serde(tag = "algorithm")] +pub enum EncryptedEventScheme { + /// An event encrypted with *m.olm.v1.curve25519-aes-sha2*. + #[serde(rename = "m.olm.v1.curve25519-aes-sha2")] + OlmV1Curve25519AesSha2(OlmV1Curve25519AesSha2Content), + + /// An event encrypted with *m.megolm.v1.aes-sha2*. + #[serde(rename = "m.megolm.v1.aes-sha2")] + MegolmV1AesSha2(MegolmV1AesSha2Content), +} /// The payload for `EncryptedEvent` using the *m.olm.v1.curve25519-aes-sha2* algorithm. #[derive(Clone, Debug, Serialize, Deserialize)]