@@ -332,24 +332,36 @@ impl InboundGroupSession {
332332 /// * `pickle_mode` - The mode that was used to pickle the session, either
333333 /// an unencrypted mode or an encrypted using passphrase.
334334 pub fn from_pickle ( pickle : PickledInboundGroupSession ) -> Result < Self , PickleError > {
335- let session: InnerSession = pickle. pickle . into ( ) ;
335+ let PickledInboundGroupSession {
336+ pickle,
337+ sender_key,
338+ signing_key,
339+ sender_data,
340+ room_id,
341+ imported,
342+ backed_up,
343+ history_visibility,
344+ algorithm,
345+ } = pickle;
346+
347+ let session: InnerSession = pickle. into ( ) ;
336348 let first_known_index = session. first_known_index ( ) ;
337349 let session_id = session. session_id ( ) ;
338350
339351 Ok ( InboundGroupSession {
340352 inner : Mutex :: new ( session) . into ( ) ,
341353 session_id : session_id. into ( ) ,
342354 creator_info : SessionCreatorInfo {
343- curve25519_key : pickle . sender_key ,
344- signing_keys : pickle . signing_key . into ( ) ,
355+ curve25519_key : sender_key,
356+ signing_keys : signing_key. into ( ) ,
345357 } ,
346- sender_data : pickle . sender_data ,
347- history_visibility : pickle . history_visibility . into ( ) ,
358+ sender_data,
359+ history_visibility : history_visibility. into ( ) ,
348360 first_known_index,
349- room_id : ( * pickle . room_id ) . into ( ) ,
350- backed_up : AtomicBool :: from ( pickle . backed_up ) . into ( ) ,
351- algorithm : pickle . algorithm . into ( ) ,
352- imported : pickle . imported ,
361+ room_id,
362+ backed_up : AtomicBool :: from ( backed_up) . into ( ) ,
363+ algorithm : algorithm. into ( ) ,
364+ imported,
353365 } )
354366 }
355367
@@ -554,25 +566,35 @@ impl TryFrom<&ExportedRoomKey> for InboundGroupSession {
554566 type Error = SessionCreationError ;
555567
556568 fn try_from ( key : & ExportedRoomKey ) -> Result < Self , Self :: Error > {
557- let config = OutboundGroupSession :: session_config ( & key. algorithm ) ?;
558- let session = InnerSession :: import ( & key. session_key , config) ;
569+ let ExportedRoomKey {
570+ algorithm,
571+ room_id,
572+ sender_key,
573+ session_id,
574+ session_key,
575+ sender_claimed_keys,
576+ forwarding_curve25519_key_chain : _,
577+ } = key;
578+
579+ let config = OutboundGroupSession :: session_config ( algorithm) ?;
580+ let session = InnerSession :: import ( session_key, config) ;
559581 let first_known_index = session. first_known_index ( ) ;
560582
561583 Ok ( InboundGroupSession {
562584 inner : Mutex :: new ( session) . into ( ) ,
563- session_id : key . session_id . to_owned ( ) . into ( ) ,
585+ session_id : session_id. to_owned ( ) . into ( ) ,
564586 creator_info : SessionCreatorInfo {
565- curve25519_key : key . sender_key ,
566- signing_keys : key . sender_claimed_keys . to_owned ( ) . into ( ) ,
587+ curve25519_key : * sender_key,
588+ signing_keys : sender_claimed_keys. to_owned ( ) . into ( ) ,
567589 } ,
568590 // TODO: In future, exported keys should contain sender data that we can use here.
569591 // See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
570592 sender_data : SenderData :: default ( ) ,
571593 history_visibility : None . into ( ) ,
572594 first_known_index,
573- room_id : key . room_id . to_owned ( ) ,
595+ room_id : room_id. to_owned ( ) ,
574596 imported : true ,
575- algorithm : key . algorithm . to_owned ( ) . into ( ) ,
597+ algorithm : algorithm. to_owned ( ) . into ( ) ,
576598 backed_up : AtomicBool :: from ( false ) . into ( ) ,
577599 } )
578600 }
0 commit comments