ruma_events/key/verification/
key.rs1use ruma_common::{serde::Base64, OwnedTransactionId};
6use ruma_macros::EventContent;
7use serde::{Deserialize, Serialize};
8
9use crate::relation::Reference;
10
11#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
15#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
16#[ruma_event(type = "m.key.verification.key", kind = ToDevice)]
17pub struct ToDeviceKeyVerificationKeyEventContent {
18 pub transaction_id: OwnedTransactionId,
22
23 pub key: Base64,
25}
26
27impl ToDeviceKeyVerificationKeyEventContent {
28 pub fn new(transaction_id: OwnedTransactionId, key: Base64) -> Self {
31 Self { transaction_id, key }
32 }
33}
34
35#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
39#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
40#[ruma_event(type = "m.key.verification.key", kind = MessageLike)]
41pub struct KeyVerificationKeyEventContent {
42 pub key: Base64,
44
45 #[serde(rename = "m.relates_to")]
47 pub relates_to: Reference,
48}
49
50impl KeyVerificationKeyEventContent {
51 pub fn new(key: Base64, relates_to: Reference) -> Self {
53 Self { key, relates_to }
54 }
55}