@@ -497,12 +497,16 @@ impl Actor for SignatureManagerAdapter {
497
497
498
498
async move {
499
499
let config = config_mngr:: get ( ) . await ?;
500
- let master_key_from_file = if let Some ( master_key_path) = & config. storage . master_key_import_path {
501
- master_key_import_from_file ( master_key_path) . map ( Some )
502
- } else {
503
- Ok ( None )
504
- } ?;
505
- let master_key_from_storage: Option < ExtendedSK > = storage_mngr:: get :: < _ , ExtendedSecretKey > ( & MASTER_KEY ) . await ?. map ( Into :: into) ;
500
+ let master_key_from_file =
501
+ if let Some ( master_key_path) = & config. storage . master_key_import_path {
502
+ master_key_import_from_file ( master_key_path) . map ( Some )
503
+ } else {
504
+ Ok ( None )
505
+ } ?;
506
+ let master_key_from_storage: Option < ExtendedSK > =
507
+ storage_mngr:: get :: < _ , ExtendedSecretKey > ( & MASTER_KEY )
508
+ . await ?
509
+ . map ( Into :: into) ;
506
510
507
511
let master_key = match ( master_key_from_file, master_key_from_storage) {
508
512
// Didn't ask to import master key and no master key in storage:
@@ -513,23 +517,28 @@ impl Actor for SignatureManagerAdapter {
513
517
( None , Some ( from_storage) ) => Ok ( from_storage) ,
514
518
( Some ( from_file) , None ) => {
515
519
// Save the key into the storage
516
- persist_master_key ( from_file. clone ( ) ) . await . map ( |( ) | from_file)
517
- } ,
520
+ persist_master_key ( from_file. clone ( ) )
521
+ . await
522
+ . map ( |( ) | from_file)
523
+ }
518
524
// There is a master key in storage and imported:
519
525
( Some ( from_file) , Some ( _from_storage) ) => {
520
526
// Save the key into the storage
521
- persist_master_key ( from_file. clone ( ) ) . await . map ( |( ) | from_file. clone ( ) )
527
+ persist_master_key ( from_file. clone ( ) )
528
+ . await
529
+ . map ( |( ) | from_file. clone ( ) )
522
530
}
523
531
} ?;
524
532
525
533
crypto. send ( SetKey ( master_key) ) . await ?
526
- } . into_actor ( self )
527
- . map_err ( |err, _act, _ctx| {
528
- log:: error!( "Failed to configure master key: {}" , err) ;
529
- System :: current ( ) . stop_with_code ( 1 ) ;
530
- } )
531
- . map ( |_res : Result < ( ) , ( ) > , _act, _ctx| ( ) )
532
- . wait ( ctx) ;
534
+ }
535
+ . into_actor ( self )
536
+ . map_err ( |err, _act, _ctx| {
537
+ log:: error!( "Failed to configure master key: {}" , err) ;
538
+ System :: current ( ) . stop_with_code ( 1 ) ;
539
+ } )
540
+ . map ( |_res : Result < ( ) , ( ) > , _act, _ctx| ( ) )
541
+ . wait ( ctx) ;
533
542
534
543
let crypto = self . crypto . clone ( ) ;
535
544
async move {
0 commit comments