use std::collections::BTreeMap;
use ruma_common::{OwnedTransactionId, serde::Base64};
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use crate::relation::Reference;
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[ruma_event(type = "m.key.verification.mac", kind = ToDevice)]
pub struct ToDeviceKeyVerificationMacEventContent {
pub transaction_id: OwnedTransactionId,
pub mac: BTreeMap<String, Base64>,
pub keys: Base64,
}
impl ToDeviceKeyVerificationMacEventContent {
pub fn new(
transaction_id: OwnedTransactionId,
mac: BTreeMap<String, Base64>,
keys: Base64,
) -> Self {
Self { transaction_id, mac, keys }
}
}
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[ruma_event(type = "m.key.verification.mac", kind = MessageLike)]
pub struct KeyVerificationMacEventContent {
pub mac: BTreeMap<String, Base64>,
pub keys: Base64,
#[serde(rename = "m.relates_to")]
pub relates_to: Reference,
}
impl KeyVerificationMacEventContent {
pub fn new(mac: BTreeMap<String, Base64>, keys: Base64, relates_to: Reference) -> Self {
Self { mac, keys, relates_to }
}
}