@@ -332,24 +332,36 @@ impl InboundGroupSession {
332
332
/// * `pickle_mode` - The mode that was used to pickle the session, either
333
333
/// an unencrypted mode or an encrypted using passphrase.
334
334
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 ( ) ;
336
348
let first_known_index = session. first_known_index ( ) ;
337
349
let session_id = session. session_id ( ) ;
338
350
339
351
Ok ( InboundGroupSession {
340
352
inner : Mutex :: new ( session) . into ( ) ,
341
353
session_id : session_id. into ( ) ,
342
354
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 ( ) ,
345
357
} ,
346
- sender_data : pickle . sender_data ,
347
- history_visibility : pickle . history_visibility . into ( ) ,
358
+ sender_data,
359
+ history_visibility : history_visibility. into ( ) ,
348
360
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,
353
365
} )
354
366
}
355
367
@@ -554,25 +566,35 @@ impl TryFrom<&ExportedRoomKey> for InboundGroupSession {
554
566
type Error = SessionCreationError ;
555
567
556
568
fn try_from ( key : & ExportedRoomKey ) -> Result < Self , Self :: Error > {
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
+
557
579
let config = OutboundGroupSession :: session_config ( & key. algorithm ) ?;
558
- let session = InnerSession :: import ( & key . session_key , config) ;
580
+ let session = InnerSession :: import ( session_key, config) ;
559
581
let first_known_index = session. first_known_index ( ) ;
560
582
561
583
Ok ( InboundGroupSession {
562
584
inner : Mutex :: new ( session) . into ( ) ,
563
- session_id : key . session_id . to_owned ( ) . into ( ) ,
585
+ session_id : session_id. to_owned ( ) . into ( ) ,
564
586
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 ( ) ,
567
589
} ,
568
590
// TODO: In future, exported keys should contain sender data that we can use here.
569
591
// See https://github.com/matrix-org/matrix-rust-sdk/issues/3548
570
592
sender_data : SenderData :: default ( ) ,
571
593
history_visibility : None . into ( ) ,
572
594
first_known_index,
573
- room_id : key . room_id . to_owned ( ) ,
595
+ room_id : room_id. to_owned ( ) ,
574
596
imported : true ,
575
- algorithm : key . algorithm . to_owned ( ) . into ( ) ,
597
+ algorithm : algorithm. to_owned ( ) . into ( ) ,
576
598
backed_up : AtomicBool :: from ( false ) . into ( ) ,
577
599
} )
578
600
}
0 commit comments