Skip to content

Commit 95f1328

Browse files
committed
fixup! crypto: Support for encrypting and sending room key history bundle data
1 parent 837e416 commit 95f1328

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

crates/matrix-sdk-crypto/src/session_manager/group_sessions/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ use crate::{
5151
events::{
5252
room::encrypted::{RoomEncryptedEventContent, ToDeviceEncryptedEventContent},
5353
room_key_bundle::RoomKeyBundleContent,
54+
EventType,
5455
},
5556
requests::ToDeviceRequest,
5657
},
@@ -267,7 +268,7 @@ impl GroupSessionManager {
267268
/// Encrypt the given group session key for the given devices and create
268269
/// to-device requests that sends the encrypted content to them.
269270
///
270-
/// See also [`Self::encrypt_content_for_devices_helper`] which is similar
271+
/// See also [`encrypt_key_content_for_devices`] which is similar
271272
/// but is not specific to group sessions, and does not return the
272273
/// [`ShareInfo`] data.
273274
async fn encrypt_session_for(
@@ -761,6 +762,13 @@ impl GroupSessionManager {
761762
/// a room key bundle to those devices.
762763
///
763764
/// Returns a list of to-device requests which must be sent.
765+
///
766+
/// For security reasons, only "safe" [`CollectStrategy`]s are supported, in
767+
/// which the recipient must have signed their
768+
/// devices. [`CollectStrategy::AllDevices`] and
769+
/// [`CollectStrategy::ErrorOnVerifiedUserProblem`] are "unsafe" in this
770+
/// respect,and are treated the same as
771+
/// [`CollectStrategy::IdentityBasedStrategy`].
764772
#[instrument(skip(self, bundle_data))]
765773
pub async fn share_room_key_bundle_data(
766774
&self,
@@ -791,7 +799,6 @@ impl GroupSessionManager {
791799
.await?;
792800

793801
let devices = devices.into_values().flatten().collect();
794-
use crate::types::events::EventType;
795802
let event_type = bundle_data.event_type().to_owned();
796803
let (requests, _) = self
797804
.encrypt_key_content_for_devices(devices, &event_type, bundle_data, &mut changes)

crates/matrix-sdk-crypto/src/types/events/room_key_bundle.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! Types for `io.element.msc4268.room_key_bundle` to-device events.
15+
//! Types for `io.element.msc4268.room_key_bundle` to-device events, per
16+
//! [MSC4268].
17+
//!
18+
//! [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268
1619
1720
use ruma::OwnedRoomId;
1821
use serde::{Deserialize, Serialize};
1922

2023
use super::EventType;
2124

22-
/// The `io.element.msc4268.room_key_bundle` event content.
25+
/// The `io.element.msc4268.room_key_bundle` event content. See [MSC4268].
26+
///
27+
/// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268
2328
#[derive(Clone, Debug, Serialize, Deserialize)]
2429
pub struct RoomKeyBundleContent {
2530
/// The room that these keys are for

0 commit comments

Comments
 (0)