diff --git a/crates/ruma-events/src/enums.rs b/crates/ruma-events/src/enums.rs index 87f6ce64..8de18163 100644 --- a/crates/ruma-events/src/enums.rs +++ b/crates/ruma-events/src/enums.rs @@ -115,6 +115,9 @@ event_enum! { "m.key.verification.accept", "m.key.verification.key", "m.key.verification.mac", + #[cfg(feature = "unstable-pre-spec")] + #[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))] + "m.key.verification.done", "m.room.encrypted", ] } diff --git a/crates/ruma-events/src/event_type.rs b/crates/ruma-events/src/event_type.rs index 53138dc5..b2d75484 100644 --- a/crates/ruma-events/src/event_type.rs +++ b/crates/ruma-events/src/event_type.rs @@ -48,6 +48,10 @@ pub enum EventType { #[ruma_enum(rename = "m.key.verification.cancel")] KeyVerificationCancel, + /// m.key.verification.done + #[ruma_enum(rename = "m.key.verification.done")] + KeyVerificationDone, + /// m.key.verification.key #[ruma_enum(rename = "m.key.verification.key")] KeyVerificationKey, @@ -231,6 +235,7 @@ mod tests { serde_json_eq(EventType::FullyRead, json!("m.fully_read")); serde_json_eq(EventType::KeyVerificationAccept, json!("m.key.verification.accept")); serde_json_eq(EventType::KeyVerificationCancel, json!("m.key.verification.cancel")); + serde_json_eq(EventType::KeyVerificationDone, json!("m.key.verification.done")); serde_json_eq(EventType::KeyVerificationKey, json!("m.key.verification.key")); serde_json_eq(EventType::KeyVerificationMac, json!("m.key.verification.mac")); serde_json_eq(EventType::KeyVerificationReady, json!("m.key.verification.ready")); diff --git a/crates/ruma-events/src/key/verification/done.rs b/crates/ruma-events/src/key/verification/done.rs index bcf33194..4ddebb15 100644 --- a/crates/ruma-events/src/key/verification/done.rs +++ b/crates/ruma-events/src/key/verification/done.rs @@ -1,6 +1,6 @@ //! Types for the *m.key.verification.done* event. -use ruma_events_macros::MessageEventContent; +use ruma_events_macros::{EventContent, MessageEventContent}; use serde::{Deserialize, Serialize}; use super::Relation; @@ -10,7 +10,17 @@ use crate::MessageEvent; /// concluded. pub type DoneEvent = MessageEvent; -/// The payload for `DoneEvent`. +/// The payload for a to-device `m.key.verification.done` event. +#[derive(Clone, Debug, Deserialize, Serialize, EventContent)] +#[ruma_event(type = "m.key.verification.done")] +pub struct DoneToDeviceEventContent { + /// An opaque identifier for the verification process. + /// + /// Must be the same as the one used for the *m.key.verification.start* message. + pub transaction_id: String, +} + +/// The payload for a in-room `m.key.verification.done` event. #[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)] #[ruma_event(type = "m.key.verification.done")] pub struct DoneEventContent {