@@ -187,6 +187,11 @@ pub struct InboundGroupSession {
187187 /// key.
188188 pub sender_data : SenderData ,
189189
190+ /// If this session was shared-on-invite as part of an MSC4268 key bundle,
191+ /// information about the user who forwarded us the session information.
192+ /// This is distinct from [`InboundGroupSession::sender_data`].
193+ pub forwarder_data : Option < SenderData > ,
194+
190195 /// The Room this GroupSession belongs to
191196 pub room_id : OwnedRoomId ,
192197
@@ -263,6 +268,7 @@ impl InboundGroupSession {
263268 room_id : & RoomId ,
264269 session_key : & SessionKey ,
265270 sender_data : SenderData ,
271+ forwarder_data : Option < SenderData > ,
266272 encryption_algorithm : EventEncryptionAlgorithm ,
267273 history_visibility : Option < HistoryVisibility > ,
268274 shared_history : bool ,
@@ -286,6 +292,7 @@ impl InboundGroupSession {
286292 signing_keys : keys. into ( ) ,
287293 } ,
288294 sender_data,
295+ forwarder_data,
289296 room_id : room_id. into ( ) ,
290297 imported : false ,
291298 algorithm : encryption_algorithm. into ( ) ,
@@ -325,6 +332,7 @@ impl InboundGroupSession {
325332 room_id,
326333 session_key,
327334 SenderData :: unknown ( ) ,
335+ None ,
328336 EventEncryptionAlgorithm :: MegolmV1AesSha2 ,
329337 None ,
330338 * shared_history,
@@ -380,6 +388,7 @@ impl InboundGroupSession {
380388 sender_key : self . creator_info . curve25519_key ,
381389 signing_key : ( * self . creator_info . signing_keys ) . clone ( ) ,
382390 sender_data : self . sender_data . clone ( ) ,
391+ forwarder_data : self . forwarder_data . clone ( ) ,
383392 room_id : self . room_id ( ) . to_owned ( ) ,
384393 imported : self . imported ,
385394 backed_up : self . backed_up ( ) ,
@@ -459,6 +468,7 @@ impl InboundGroupSession {
459468 sender_key,
460469 signing_key,
461470 sender_data,
471+ forwarder_data,
462472 room_id,
463473 imported,
464474 backed_up,
@@ -479,6 +489,7 @@ impl InboundGroupSession {
479489 signing_keys : signing_key. into ( ) ,
480490 } ,
481491 sender_data,
492+ forwarder_data,
482493 history_visibility : history_visibility. into ( ) ,
483494 first_known_index,
484495 room_id,
@@ -693,6 +704,9 @@ pub struct PickledInboundGroupSession {
693704 /// Information on the device/sender who sent us this session
694705 #[ serde( default ) ]
695706 pub sender_data : SenderData ,
707+ /// Information on the device/sender who forwarded us this session
708+ #[ serde( default ) ]
709+ pub forwarder_data : Option < SenderData > ,
696710 /// The id of the room that the session is used in.
697711 pub room_id : OwnedRoomId ,
698712 /// Flag remembering if the session was directly sent to us by the sender
@@ -746,6 +760,7 @@ impl TryFrom<&HistoricRoomKey> for InboundGroupSession {
746760 // TODO: How do we remember that this is a historic room key and events decrypted using
747761 // this room key should always show some form of warning.
748762 sender_data : SenderData :: default ( ) ,
763+ forwarder_data : None ,
749764 history_visibility : None . into ( ) ,
750765 first_known_index,
751766 room_id : room_id. to_owned ( ) ,
@@ -786,6 +801,7 @@ impl TryFrom<&ExportedRoomKey> for InboundGroupSession {
786801 // TODO: In future, exported keys should contain sender data that we can use here.
787802 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
788803 sender_data : SenderData :: default ( ) ,
804+ forwarder_data : None ,
789805 history_visibility : None . into ( ) ,
790806 first_known_index,
791807 room_id : room_id. to_owned ( ) ,
@@ -817,6 +833,7 @@ impl From<&ForwardedMegolmV1AesSha2Content> for InboundGroupSession {
817833 // In future, exported keys should contain sender data that we can use here.
818834 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
819835 sender_data : SenderData :: default ( ) ,
836+ forwarder_data : None ,
820837 history_visibility : None . into ( ) ,
821838 first_known_index,
822839 room_id : value. room_id . to_owned ( ) ,
@@ -844,6 +861,7 @@ impl From<&ForwardedMegolmV2AesSha2Content> for InboundGroupSession {
844861 // In future, exported keys should contain sender data that we can use here.
845862 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
846863 sender_data : SenderData :: default ( ) ,
864+ forwarder_data : None ,
847865 history_visibility : None . into ( ) ,
848866 first_known_index,
849867 room_id : value. room_id . to_owned ( ) ,
@@ -984,6 +1002,7 @@ mod tests {
9841002 room_id ! ( "!test:localhost" ) ,
9851003 & create_session_key ( ) ,
9861004 SenderData :: unknown ( ) ,
1005+ None ,
9871006 EventEncryptionAlgorithm :: MegolmV1AesSha2 ,
9881007 Some ( HistoryVisibility :: Shared ) ,
9891008 false ,
0 commit comments