@@ -5,6 +5,7 @@ use super::operation_client::OperationClient;
55use crate :: auth:: Authentication ;
66use crate :: error:: { ClientErrorKind , Error , Result } ;
77use log:: { debug, warn} ;
8+ use parsec_interface:: operations:: can_do_crypto:: { CheckType , Operation as CanDoCrypto } ;
89use parsec_interface:: operations:: delete_client:: Operation as DeleteClient ;
910use parsec_interface:: operations:: list_authenticators:: {
1011 AuthenticatorInfo , Operation as ListAuthenticators ,
@@ -1284,6 +1285,30 @@ impl BasicClient {
12841285 }
12851286 }
12861287
1288+ /// **[Capability Discovery Operation]** Check if attributes are supported.
1289+ ///
1290+ /// Checks if the given attributes are supported for the given type of operation.
1291+ ///
1292+ /// #Errors
1293+ ///
1294+ /// This operation will either return Ok(()) or Err(PsaErrorNotSupported) indicating whether the attributes are supported.
1295+ ///
1296+ /// See the operation-specific response codes returned by the service
1297+ /// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/can_do_crypto.html#specific-response-status-codes).
1298+ pub fn can_do_crypto ( & self , check_type : CheckType , attributes : Attributes ) -> Result < ( ) > {
1299+ let crypto_provider = self . can_provide_crypto ( ) ?;
1300+ let op = CanDoCrypto {
1301+ check_type,
1302+ attributes,
1303+ } ;
1304+ let _ = self . op_client . process_operation (
1305+ NativeOperation :: CanDoCrypto ( op) ,
1306+ crypto_provider,
1307+ & self . auth_data ,
1308+ ) ?;
1309+ Ok ( ( ) )
1310+ }
1311+
12871312 fn can_provide_crypto ( & self ) -> Result < ProviderId > {
12881313 match self . implicit_provider {
12891314 ProviderId :: Core => Err ( Error :: Client ( ClientErrorKind :: InvalidProvider ) ) ,
0 commit comments