matrix_sdk_crypto/types/events/room_key_bundle.rs
1// Copyright 2025 The Matrix.org Foundation C.I.C.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Types for `m.room_key_bundle` to-device events, per [MSC4268].
16//!
17//! [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268
18
19use ruma::{OwnedRoomId, events::room::EncryptedFile};
20use serde::{Deserialize, Serialize};
21
22use super::EventType;
23
24/// The `m.room_key_bundle` event content. See [MSC4268].
25///
26/// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268
27#[derive(Clone, Debug, Serialize, Deserialize)]
28pub struct RoomKeyBundleContent {
29 /// The room that these keys are for.
30 pub room_id: OwnedRoomId,
31
32 /// The location and encryption info of the key bundle.
33 pub file: EncryptedFile,
34}
35
36impl RoomKeyBundleContent {
37 /// The unstable event type for MSC4268 m.room_key_bundle
38 pub const UNSTABLE_EVENT_TYPE: &'static str = "io.element.msc4268.room_key_bundle";
39}
40
41impl EventType for RoomKeyBundleContent {
42 const EVENT_TYPE: &'static str = "m.room_key_bundle";
43}