@@ -241,8 +241,8 @@ impl TryFrom<(KeyTriple, ProviderIdentity, Auth)> for KeyIdentity {
241
241
} ;
242
242
Ok ( KeyIdentity {
243
243
provider : ProviderIdentity :: new ( provider_uuid, provider_identity. name ( ) . clone ( ) ) ,
244
- application : app_identity. clone ( ) ,
245
- key_name : key_triple. key_name . to_string ( ) ,
244
+ application : app_identity,
245
+ key_name : key_triple. key_name ,
246
246
} )
247
247
}
248
248
}
@@ -599,12 +599,9 @@ impl OnDiskKeyInfoManager {
599
599
let prov_key_name =
600
600
base64:: engine:: general_purpose:: URL_SAFE . encode ( prov_key_name. as_bytes ( ) ) ;
601
601
// INTERNAL_KEYS_PARSEC_DIR has already been created with the necessary permissions
602
- let key_name_file_path = self
603
- . mappings_dir_path
602
+ self . mappings_dir_path
604
603
. join ( INTERNAL_KEYS_PARSEC_DIR )
605
- . join ( prov_key_name) ;
606
-
607
- key_name_file_path
604
+ . join ( prov_key_name)
608
605
}
609
606
Auth :: Client ( _) => {
610
607
// Create the directories with base64 names.
@@ -659,20 +656,15 @@ impl OnDiskKeyInfoManager {
659
656
let prov_key_name = prov_and_key_to_str ( key_triple. provider_id , & key_name) ;
660
657
661
658
// INTERNAL_KEYS_PARSEC_DIR has already been created with the necessary permissions
662
- let key_name_file_path = self
663
- . mappings_dir_path
659
+ self . mappings_dir_path
664
660
. join ( INTERNAL_KEYS_PARSEC_DIR )
665
- . join ( prov_key_name) ;
666
- key_name_file_path
667
- }
668
- Auth :: Client ( _) => {
669
- let key_name_file_path = self
670
- . mappings_dir_path
671
- . join ( app_name)
672
- . join ( prov)
673
- . join ( key_name) ;
674
- key_name_file_path
661
+ . join ( prov_key_name)
675
662
}
663
+ Auth :: Client ( _) => self
664
+ . mappings_dir_path
665
+ . join ( app_name)
666
+ . join ( prov)
667
+ . join ( key_name) ,
676
668
} ;
677
669
if key_name_file_path. exists ( ) {
678
670
fs:: remove_file ( key_name_file_path)
@@ -747,12 +739,10 @@ impl ManageKeyInfo for OnDiskKeyInfoManager {
747
739
self . save_mapping ( & key_triple, & key_info, key_identity. application ( ) . auth ( ) )
748
740
{
749
741
Err ( err. to_string ( ) )
742
+ } else if key_identity. application ( ) . is_internal ( ) {
743
+ Ok ( self . key_store_internal . insert ( key_triple, key_info) )
750
744
} else {
751
- if key_identity. application ( ) . is_internal ( ) {
752
- Ok ( self . key_store_internal . insert ( key_triple, key_info) )
753
- } else {
754
- Ok ( self . key_store . insert ( key_triple, key_info) )
755
- }
745
+ Ok ( self . key_store . insert ( key_triple, key_info) )
756
746
}
757
747
}
758
748
@@ -772,9 +762,9 @@ impl ManageKeyInfo for OnDiskKeyInfoManager {
772
762
773
763
fn exists ( & self , key_identity : & KeyIdentity ) -> Result < bool , String > {
774
764
let key_triple = KeyTriple :: try_from ( key_identity. clone ( ) ) ?;
775
- match key_identity. application ( ) . auth ( ) {
776
- & Auth :: Internal => Ok ( self . key_store_internal . contains_key ( & key_triple) ) ,
777
- & Auth :: Client ( _) => Ok ( self . key_store . contains_key ( & key_triple) ) ,
765
+ match * key_identity. application ( ) . auth ( ) {
766
+ Auth :: Internal => Ok ( self . key_store_internal . contains_key ( & key_triple) ) ,
767
+ Auth :: Client ( _) => Ok ( self . key_store . contains_key ( & key_triple) ) ,
778
768
}
779
769
}
780
770
}
0 commit comments