@@ -35,7 +35,7 @@ use parsec_interface::operations::psa_sign_hash::Operation as PsaSignHash;
3535use parsec_interface:: operations:: psa_verify_hash:: Operation as PsaVerifyHash ;
3636use parsec_interface:: operations:: { NativeOperation , NativeResult } ;
3737use parsec_interface:: requests:: AuthType ;
38- use parsec_interface:: requests:: { Opcode , ProviderID } ;
38+ use parsec_interface:: requests:: { Opcode , ProviderId } ;
3939use parsec_interface:: secrecy:: { ExposeSecret , Secret } ;
4040use std:: collections:: HashSet ;
4141use zeroize:: Zeroizing ;
@@ -69,7 +69,7 @@ use zeroize::Zeroizing;
6969///```no_run
7070///# use parsec_client::auth::Authentication;
7171///# use parsec_client::BasicClient;
72- ///# use parsec_client::core::interface::requests::ProviderID ;
72+ ///# use parsec_client::core::interface::requests::ProviderId ;
7373///# let client: BasicClient = BasicClient::new(Some(String::from("app-name"))).unwrap();
7474///let res = client.ping();
7575///
@@ -91,7 +91,7 @@ use zeroize::Zeroizing;
9191///```no_run
9292///# use parsec_client::auth::Authentication;
9393///# use parsec_client::BasicClient;
94- ///# use parsec_client::core::interface::requests::ProviderID ;
94+ ///# use parsec_client::core::interface::requests::ProviderId ;
9595///# let client: BasicClient = BasicClient::new(Some(String::from("app-name"))).unwrap();
9696///use parsec_interface::operations::list_providers::Uuid;
9797///
@@ -113,11 +113,11 @@ use zeroize::Zeroizing;
113113///```no_run
114114///# use parsec_client::auth::Authentication;
115115///# use parsec_client::BasicClient;
116- ///# use parsec_client::core::interface::requests::ProviderID ;
116+ ///# use parsec_client::core::interface::requests::ProviderId ;
117117///# let mut client: BasicClient = BasicClient::new(Some(String::from("app-name"))).unwrap();
118118///use parsec_client::core::interface::requests::Opcode;
119119///
120- ///let desired_provider = ProviderID ::Pkcs11;
120+ ///let desired_provider = ProviderId ::Pkcs11;
121121///let provider_opcodes = client
122122/// .list_opcodes(desired_provider)
123123/// .expect("Failed to list opcodes");
@@ -134,7 +134,7 @@ use zeroize::Zeroizing;
134134///```no_run
135135///# use parsec_client::auth::Authentication;
136136///# use parsec_client::BasicClient;
137- ///# use parsec_client::core::interface::requests::ProviderID ;
137+ ///# use parsec_client::core::interface::requests::ProviderId ;
138138///# let client: BasicClient = BasicClient::new(Some(String::from("app-name"))).unwrap();
139139///use parsec_client::core::interface::operations::psa_algorithm::{Algorithm, AsymmetricSignature, Hash};
140140///use parsec_client::core::interface::operations::psa_key_attributes::{Attributes, Lifetime, Policy, Type, UsageFlags};
@@ -178,7 +178,7 @@ use zeroize::Zeroizing;
178178pub struct BasicClient {
179179 pub ( crate ) op_client : OperationClient ,
180180 pub ( crate ) auth_data : Authentication ,
181- pub ( crate ) implicit_provider : ProviderID ,
181+ pub ( crate ) implicit_provider : ProviderId ,
182182}
183183
184184/// Main client functionality.
@@ -204,7 +204,7 @@ impl BasicClient {
204204 let mut client = BasicClient {
205205 op_client : OperationClient :: new ( ) ?,
206206 auth_data : Authentication :: None ,
207- implicit_provider : ProviderID :: Core ,
207+ implicit_provider : ProviderId :: Core ,
208208 } ;
209209 client. set_default_provider ( ) ?;
210210 client. set_default_auth ( app_name) ?;
@@ -229,7 +229,7 @@ impl BasicClient {
229229 BasicClient {
230230 op_client : Default :: default ( ) ,
231231 auth_data : Authentication :: None ,
232- implicit_provider : ProviderID :: Core ,
232+ implicit_provider : ProviderId :: Core ,
233233 }
234234 }
235235
@@ -302,22 +302,22 @@ impl BasicClient {
302302 }
303303
304304 /// Set the provider that the client will be implicitly working with.
305- pub fn set_implicit_provider ( & mut self , provider : ProviderID ) {
305+ pub fn set_implicit_provider ( & mut self , provider : ProviderId ) {
306306 self . implicit_provider = provider;
307307 }
308308
309309 /// Retrieve client's implicit provider.
310- pub fn implicit_provider ( & self ) -> ProviderID {
310+ pub fn implicit_provider ( & self ) -> ProviderId {
311311 self . implicit_provider
312312 }
313313
314314 /// **[Core Operation]** List the opcodes supported by the specified provider.
315- pub fn list_opcodes ( & self , provider : ProviderID ) -> Result < HashSet < Opcode > > {
315+ pub fn list_opcodes ( & self , provider : ProviderId ) -> Result < HashSet < Opcode > > {
316316 let res = self . op_client . process_operation (
317317 NativeOperation :: ListOpcodes ( ListOpcodes {
318318 provider_id : provider,
319319 } ) ,
320- ProviderID :: Core ,
320+ ProviderId :: Core ,
321321 & self . auth_data ,
322322 ) ?;
323323
@@ -334,7 +334,7 @@ impl BasicClient {
334334 pub fn list_providers ( & self ) -> Result < Vec < ProviderInfo > > {
335335 let res = self . op_client . process_operation (
336336 NativeOperation :: ListProviders ( ListProviders { } ) ,
337- ProviderID :: Core ,
337+ ProviderId :: Core ,
338338 & self . auth_data ,
339339 ) ?;
340340 if let NativeResult :: ListProviders ( res) = res {
@@ -350,7 +350,7 @@ impl BasicClient {
350350 pub fn list_authenticators ( & self ) -> Result < Vec < AuthenticatorInfo > > {
351351 let res = self . op_client . process_operation (
352352 NativeOperation :: ListAuthenticators ( ListAuthenticators { } ) ,
353- ProviderID :: Core ,
353+ ProviderId :: Core ,
354354 & self . auth_data ,
355355 ) ?;
356356 if let NativeResult :: ListAuthenticators ( res) = res {
@@ -366,7 +366,7 @@ impl BasicClient {
366366 pub fn list_keys ( & self ) -> Result < Vec < KeyInfo > > {
367367 let res = self . op_client . process_operation (
368368 NativeOperation :: ListKeys ( ListKeys { } ) ,
369- ProviderID :: Core ,
369+ ProviderId :: Core ,
370370 & self . auth_data ,
371371 ) ?;
372372 if let NativeResult :: ListKeys ( res) = res {
@@ -395,7 +395,7 @@ impl BasicClient {
395395 pub fn list_clients ( & self ) -> Result < Vec < String > > {
396396 let res = self . op_client . process_operation (
397397 NativeOperation :: ListClients ( ListClients { } ) ,
398- ProviderID :: Core ,
398+ ProviderId :: Core ,
399399 & self . auth_data ,
400400 ) ?;
401401 if let NativeResult :: ListClients ( res) = res {
@@ -411,7 +411,7 @@ impl BasicClient {
411411 pub fn delete_client ( & self , client : String ) -> Result < ( ) > {
412412 let res = self . op_client . process_operation (
413413 NativeOperation :: DeleteClient ( DeleteClient { client } ) ,
414- ProviderID :: Core ,
414+ ProviderId :: Core ,
415415 & self . auth_data ,
416416 ) ?;
417417 if let NativeResult :: DeleteClient ( _) = res {
@@ -431,7 +431,7 @@ impl BasicClient {
431431 pub fn ping ( & self ) -> Result < ( u8 , u8 ) > {
432432 let res = self . op_client . process_operation (
433433 NativeOperation :: Ping ( Ping { } ) ,
434- ProviderID :: Core ,
434+ ProviderId :: Core ,
435435 & Authentication :: None ,
436436 ) ?;
437437
@@ -460,7 +460,7 @@ impl BasicClient {
460460 /// If this method returns an error, no key will have been generated and
461461 /// the name used will still be available for another key.
462462 ///
463- /// If the implicit client provider is `ProviderID ::Core`, a client error
463+ /// If the implicit client provider is `ProviderId ::Core`, a client error
464464 /// of `InvalidProvider` type is returned.
465465 ///
466466 /// See the operation-specific response codes returned by the service
@@ -490,7 +490,7 @@ impl BasicClient {
490490 ///
491491 /// # Errors
492492 ///
493- /// If the implicit client provider is `ProviderID ::Core`, a client error
493+ /// If the implicit client provider is `ProviderId ::Core`, a client error
494494 /// of `InvalidProvider` type is returned.
495495 ///
496496 /// See the operation-specific response codes returned by the service
@@ -530,7 +530,7 @@ impl BasicClient {
530530 /// If this method returns an error, no key will have been imported and the
531531 /// name used will still be available for another key.
532532 ///
533- /// If the implicit client provider is `ProviderID ::Core`, a client error
533+ /// If the implicit client provider is `ProviderId ::Core`, a client error
534534 /// of `InvalidProvider` type is returned.
535535 ///
536536 /// See the operation-specific response codes returned by the service
@@ -568,7 +568,7 @@ impl BasicClient {
568568 ///
569569 /// # Errors
570570 ///
571- /// If the implicit client provider is `ProviderID ::Core`, a client error
571+ /// If the implicit client provider is `ProviderId ::Core`, a client error
572572 /// of `InvalidProvider` type is returned.
573573 ///
574574 /// See the operation-specific response codes returned by the service
@@ -602,7 +602,7 @@ impl BasicClient {
602602 ///
603603 /// # Errors
604604 ///
605- /// If the implicit client provider is `ProviderID ::Core`, a client error
605+ /// If the implicit client provider is `ProviderId ::Core`, a client error
606606 /// of `InvalidProvider` type is returned.
607607 ///
608608 /// See the operation-specific response codes returned by the service
@@ -641,7 +641,7 @@ impl BasicClient {
641641 ///
642642 /// # Errors
643643 ///
644- /// If the implicit client provider is `ProviderID ::Core`, a client error
644+ /// If the implicit client provider is `ProviderId ::Core`, a client error
645645 /// of `InvalidProvider` type is returned.
646646 ///
647647 /// See the operation-specific response codes returned by the service
@@ -690,7 +690,7 @@ impl BasicClient {
690690 ///
691691 /// # Errors
692692 ///
693- /// If the implicit client provider is `ProviderID ::Core`, a client error
693+ /// If the implicit client provider is `ProviderId ::Core`, a client error
694694 /// of `InvalidProvider` type is returned.
695695 ///
696696 /// See the operation-specific response codes returned by the service
@@ -736,7 +736,7 @@ impl BasicClient {
736736 ///
737737 /// # Errors
738738 ///
739- /// If the implicit client provider is `ProviderID ::Core`, a client error
739+ /// If the implicit client provider is `ProviderId ::Core`, a client error
740740 /// of `InvalidProvider` type is returned.
741741 ///
742742 /// See the operation-specific response codes returned by the service
@@ -788,7 +788,7 @@ impl BasicClient {
788788 ///
789789 /// # Errors
790790 ///
791- /// If the implicit client provider is `ProviderID ::Core`, a client error
791+ /// If the implicit client provider is `ProviderId ::Core`, a client error
792792 /// of `InvalidProvider` type is returned.
793793 ///
794794 /// See the operation-specific response codes returned by the service
@@ -800,10 +800,7 @@ impl BasicClient {
800800 ciphertext : & [ u8 ] ,
801801 salt : Option < & [ u8 ] > ,
802802 ) -> Result < Vec < u8 > > {
803- let salt = match salt {
804- Some ( salt) => Some ( Zeroizing :: new ( salt. to_vec ( ) ) ) ,
805- None => None ,
806- } ;
803+ let salt = salt. map ( |salt| Zeroizing :: new ( salt. to_vec ( ) ) ) ;
807804 let crypto_provider = self . can_provide_crypto ( ) ?;
808805
809806 let op = PsaAsymDecrypt {
@@ -833,7 +830,7 @@ impl BasicClient {
833830 ///
834831 /// # Errors
835832 ///
836- /// If the implicit client provider is `ProviderID ::Core`, a client error
833+ /// If the implicit client provider is `ProviderId ::Core`, a client error
837834 /// of `InvalidProvider` type is returned.
838835 ///
839836 /// See the operation-specific response codes returned by the service
@@ -866,7 +863,7 @@ impl BasicClient {
866863 ///
867864 /// # Errors
868865 ///
869- /// If the implicit client provider is `ProviderID ::Core`, a client error
866+ /// If the implicit client provider is `ProviderId ::Core`, a client error
870867 /// of `InvalidProvider` type is returned.
871868 ///
872869 /// See the operation-specific response codes returned by the service
@@ -901,7 +898,7 @@ impl BasicClient {
901898 ///
902899 /// # Errors
903900 ///
904- /// If the implicit client provider is `ProviderID ::Core`, a client error
901+ /// If the implicit client provider is `ProviderId ::Core`, a client error
905902 /// of `InvalidProvider` type is returned.
906903 ///
907904 /// See the operation-specific response codes returned by the service
@@ -954,7 +951,7 @@ impl BasicClient {
954951 ///
955952 /// # Errors
956953 ///
957- /// If the implicit client provider is `ProviderID ::Core`, a client error
954+ /// If the implicit client provider is `ProviderId ::Core`, a client error
958955 /// of `InvalidProvider` type is returned.
959956 ///
960957 /// See the operation-specific response codes returned by the service
@@ -1005,7 +1002,7 @@ impl BasicClient {
10051002 ///
10061003 /// # Errors
10071004 ///
1008- /// If the implicit client provider is `ProviderID ::Core`, a client error
1005+ /// If the implicit client provider is `ProviderId ::Core`, a client error
10091006 /// of `InvalidProvider` type is returned.
10101007 ///
10111008 /// See the operation-specific response codes returned by the service
@@ -1044,7 +1041,7 @@ impl BasicClient {
10441041 ///
10451042 /// If this method returns an error, no bytes will have been generated.
10461043 ///
1047- /// If the implicit client provider is `ProviderID ::Core`, a client error
1044+ /// If the implicit client provider is `ProviderId ::Core`, a client error
10481045 /// of `InvalidProvider` type is returned.
10491046 ///
10501047 /// See the operation-specific response codes returned by the service
@@ -1069,9 +1066,9 @@ impl BasicClient {
10691066 }
10701067 }
10711068
1072- fn can_provide_crypto ( & self ) -> Result < ProviderID > {
1069+ fn can_provide_crypto ( & self ) -> Result < ProviderId > {
10731070 match self . implicit_provider {
1074- ProviderID :: Core => Err ( Error :: Client ( ClientErrorKind :: InvalidProvider ) ) ,
1071+ ProviderId :: Core => Err ( Error :: Client ( ClientErrorKind :: InvalidProvider ) ) ,
10751072 crypto_provider => Ok ( crypto_provider) ,
10761073 }
10771074 }
0 commit comments