Skip to content

Commit aad897b

Browse files
author
Joe Ellis
committed
Add ListKeys support
Signed-off-by: Joe Ellis <[email protected]>
1 parent a078365 commit aad897b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/core/basic_client.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::error::{ClientErrorKind, Error, Result};
77
use parsec_interface::operations::list_authenticators::{
88
AuthenticatorInfo, Operation as ListAuthenticators,
99
};
10+
use parsec_interface::operations::list_keys::{KeyInfo, Operation as ListKeys};
1011
use parsec_interface::operations::list_opcodes::Operation as ListOpcodes;
1112
use parsec_interface::operations::list_providers::{Operation as ListProviders, ProviderInfo};
1213
use parsec_interface::operations::ping::Operation as Ping;
@@ -271,6 +272,22 @@ impl BasicClient {
271272
}
272273
}
273274

275+
/// **[Core Operation]** List all keys belonging to the application.
276+
pub fn list_keys(&self) -> Result<Vec<KeyInfo>> {
277+
let res = self.op_client.process_operation(
278+
NativeOperation::ListKeys(ListKeys {}),
279+
ProviderID::Core,
280+
&self.auth_data,
281+
)?;
282+
if let NativeResult::ListKeys(res) = res {
283+
Ok(res.keys)
284+
} else {
285+
// Should really not be reached given the checks we do, but it's not impossible if some
286+
// changes happen in the interface
287+
Err(Error::Client(ClientErrorKind::InvalidServiceResponseType))
288+
}
289+
}
290+
274291
/// **[Core Operation]** Send a ping request to the service.
275292
///
276293
/// This operation is intended for testing connectivity to the

0 commit comments

Comments
 (0)