1//! Types for the [`m.secret_storage.default_key`] event.
2//!
3//! [`m.secret_storage.default_key`]: https://spec.matrix.org/latest/client-server-api/#key-storage
45use serde::{Deserialize, Serialize};
67use crate::macros::EventContent;
89/// The payload for `DefaultKeyEvent`.
10#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
11#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
12#[ruma_event(type = "m.secret_storage.default_key", kind = GlobalAccountData)]
13pub struct SecretStorageDefaultKeyEventContent {
14/// The ID of the default key.
15#[serde(rename = "key")]
16pub key_id: String,
17}
1819impl SecretStorageDefaultKeyEventContent {
20/// Create a new [`SecretStorageDefaultKeyEventContent`] with the given key ID.
21 ///
22 /// Uploading this to the account data will mark the secret storage key with the given key ID as
23 /// the default key.
24pub fn new(key_id: String) -> Self {
25Self { key_id }
26 }
27}