@@ -5,6 +5,7 @@ use super::operation_client::OperationClient;
5
5
use crate :: auth:: Authentication ;
6
6
use crate :: error:: { ClientErrorKind , Error , Result } ;
7
7
use log:: { debug, warn} ;
8
+ use parsec_interface:: operations:: can_do_crypto:: { CheckType , Operation as CanDoCrypto } ;
8
9
use parsec_interface:: operations:: delete_client:: Operation as DeleteClient ;
9
10
use parsec_interface:: operations:: list_authenticators:: {
10
11
AuthenticatorInfo , Operation as ListAuthenticators ,
@@ -1284,6 +1285,30 @@ impl BasicClient {
1284
1285
}
1285
1286
}
1286
1287
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
+
1287
1312
fn can_provide_crypto ( & self ) -> Result < ProviderId > {
1288
1313
match self . implicit_provider {
1289
1314
ProviderId :: Core => Err ( Error :: Client ( ClientErrorKind :: InvalidProvider ) ) ,
0 commit comments