@@ -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,
@@ -691,6 +702,9 @@ pub struct PickledInboundGroupSession {
691702 /// Information on the device/sender who sent us this session
692703 #[ serde( default ) ]
693704 pub sender_data : SenderData ,
705+ /// Information on the device/sender who forwarded us this session
706+ #[ serde( default ) ]
707+ pub forwarder_data : Option < SenderData > ,
694708 /// The id of the room that the session is used in.
695709 pub room_id : OwnedRoomId ,
696710 /// Flag remembering if the session was directly sent to us by the sender
@@ -744,6 +758,7 @@ impl TryFrom<&HistoricRoomKey> for InboundGroupSession {
744758 // TODO: How do we remember that this is a historic room key and events decrypted using
745759 // this room key should always show some form of warning.
746760 sender_data : SenderData :: default ( ) ,
761+ forwarder_data : None ,
747762 history_visibility : None . into ( ) ,
748763 first_known_index,
749764 room_id : room_id. to_owned ( ) ,
@@ -784,6 +799,7 @@ impl TryFrom<&ExportedRoomKey> for InboundGroupSession {
784799 // TODO: In future, exported keys should contain sender data that we can use here.
785800 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
786801 sender_data : SenderData :: default ( ) ,
802+ forwarder_data : None ,
787803 history_visibility : None . into ( ) ,
788804 first_known_index,
789805 room_id : room_id. to_owned ( ) ,
@@ -815,6 +831,7 @@ impl From<&ForwardedMegolmV1AesSha2Content> for InboundGroupSession {
815831 // In future, exported keys should contain sender data that we can use here.
816832 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
817833 sender_data : SenderData :: default ( ) ,
834+ forwarder_data : None ,
818835 history_visibility : None . into ( ) ,
819836 first_known_index,
820837 room_id : value. room_id . to_owned ( ) ,
@@ -842,6 +859,7 @@ impl From<&ForwardedMegolmV2AesSha2Content> for InboundGroupSession {
842859 // In future, exported keys should contain sender data that we can use here.
843860 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
844861 sender_data : SenderData :: default ( ) ,
862+ forwarder_data : None ,
845863 history_visibility : None . into ( ) ,
846864 first_known_index,
847865 room_id : value. room_id . to_owned ( ) ,
@@ -982,6 +1000,7 @@ mod tests {
9821000 room_id ! ( "!test:localhost" ) ,
9831001 & create_session_key ( ) ,
9841002 SenderData :: unknown ( ) ,
1003+ None ,
9851004 EventEncryptionAlgorithm :: MegolmV1AesSha2 ,
9861005 Some ( HistoryVisibility :: Shared ) ,
9871006 false ,
0 commit comments