@@ -4,7 +4,9 @@ use std::{borrow::Borrow, ops::Deref};
4
4
5
5
use eyeball:: shared:: Observable as SharedObservable ;
6
6
#[ cfg( feature = "e2e-encryption" ) ]
7
- use matrix_sdk_base:: RoomMemberships ;
7
+ use futures_core:: Stream ;
8
+ #[ cfg( feature = "e2e-encryption" ) ]
9
+ use matrix_sdk_base:: { crypto:: store:: RoomKeyInfo , RoomMemberships } ;
8
10
use matrix_sdk_common:: instant:: { Duration , Instant } ;
9
11
use mime:: { self , Mime } ;
10
12
use ruma:: {
@@ -440,6 +442,23 @@ impl Joined {
440
442
Ok ( ( ) )
441
443
}
442
444
445
+ /// Receive notifications of a room keys for this room being received.
446
+ ///
447
+ /// Each time a room key for this room is updated in any way, an update will
448
+ /// be sent to the stream. Updates that happen at the same time are
449
+ /// batched into a [`Vec`].
450
+ ///
451
+ /// If the reader of the stream lags too far behind, a warning will be
452
+ /// logged and items will be dropped.
453
+ #[ cfg( feature = "e2e-encryption" ) ]
454
+ pub async fn room_keys_received_stream ( & self ) -> impl Stream < Item = Vec < RoomKeyInfo > > {
455
+ self . client
456
+ . encryption ( )
457
+ . room_keys_for_room_received_stream ( self . room_id ( ) )
458
+ . await
459
+ . expect ( "OlmMachine must be set up before a room::Joined object is created" )
460
+ }
461
+
443
462
/// Wait for the room to be fully synced.
444
463
///
445
464
/// This method makes sure the room that was returned when joining a room
0 commit comments