diff --git a/src/ctap2/commands/credential_management.rs b/src/ctap2/commands/credential_management.rs index 2a58bb17..41a97743 100644 --- a/src/ctap2/commands/credential_management.rs +++ b/src/ctap2/commands/credential_management.rs @@ -62,7 +62,7 @@ impl Serialize for CredManagementParams { } #[derive(Debug, Clone, Deserialize, Serialize)] -pub(crate) enum CredManagementCommand { +pub enum CredManagementCommand { GetCredsMetadata, EnumerateRPsBegin, EnumerateRPsGetNextRP, @@ -98,9 +98,9 @@ impl CredManagementCommand { } #[derive(Debug)] pub struct CredentialManagement { - pub(crate) subcommand: CredManagementCommand, // subCommand currently being requested - pin_uv_auth_param: Option, // First 16 bytes of HMAC-SHA-256 of contents using pinUvAuthToken. - use_legacy_preview: bool, + pub subcommand: CredManagementCommand, // subCommand currently being requested + pub pin_uv_auth_param: Option, // First 16 bytes of HMAC-SHA-256 of contents using pinUvAuthToken. + pub use_legacy_preview: bool, } impl CredentialManagement { @@ -408,9 +408,9 @@ impl RequestCtap2 for CredentialManagement { fn send_to_virtual_device( &self, - _dev: &mut Dev, + dev: &mut Dev, ) -> Result { - unimplemented!() + dev.manage_credentials(self) } } diff --git a/src/ctap2/mod.rs b/src/ctap2/mod.rs index bc45ceb9..5ae0c8ca 100644 --- a/src/ctap2/mod.rs +++ b/src/ctap2/mod.rs @@ -743,8 +743,8 @@ pub(crate) fn reset_helper>( } } -pub(crate) fn set_or_change_pin_helper>( - dev: &mut Device, +pub fn set_or_change_pin_helper, Dev: FidoDevice>( + dev: &mut Dev, mut current_pin: Option, new_pin: Pin, status: Sender, @@ -1104,8 +1104,8 @@ pub(crate) fn bio_enrollment( false } -pub(crate) fn credential_management( - dev: &mut Device, +pub fn credential_management( + dev: &mut Dev, puat_result: Option, command: CredManagementCmd, status: Sender, diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 318934ed..ad01854a 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -4,6 +4,9 @@ use crate::ctap2::commands::client_pin::{ GetPinUvAuthTokenUsingPinWithPermissions, GetPinUvAuthTokenUsingUvWithPermissions, PinUvAuthTokenPermission, }; +use crate::ctap2::commands::credential_management::{ + CredentialManagement, CredentialManagementResponse, +}; use crate::ctap2::commands::get_assertion::{GetAssertion, GetAssertionResult}; use crate::ctap2::commands::get_info::{AuthenticatorInfo, AuthenticatorVersion, GetInfo}; use crate::ctap2::commands::get_version::{GetVersion, U2FInfo}; @@ -366,4 +369,8 @@ pub trait VirtualFidoDevice: FidoDevice { fn make_credentials(&self, req: &MakeCredentials) -> Result; fn reset(&self, req: &Reset) -> Result<(), HIDError>; fn selection(&self, req: &Selection) -> Result<(), HIDError>; + fn manage_credentials( + &mut self, + req: &CredentialManagement, + ) -> Result; }