diff --git a/crates/ctap2-proto/src/authenticator/reset/mod.rs b/crates/ctap2-proto/src/authenticator/reset/mod.rs index 4799666..6f8ddf7 100644 --- a/crates/ctap2-proto/src/authenticator/reset/mod.rs +++ b/crates/ctap2-proto/src/authenticator/reset/mod.rs @@ -1,4 +1,5 @@ /// Possible errors for the [`Ctap2Device::reset`] command. +#[derive(Debug)] pub enum Error { /// Returned if the `reset` operation is disabled for the transport used or /// if user precense is explicitly denied. diff --git a/crates/ctap2-proto/src/lib.rs b/crates/ctap2-proto/src/lib.rs index bc095de..a0cd325 100644 --- a/crates/ctap2-proto/src/lib.rs +++ b/crates/ctap2-proto/src/lib.rs @@ -48,7 +48,7 @@ pub trait Ctap2_2Authenticator { #[allow(clippy::missing_errors_doc)] /// > This method is used by the client to reset an authenticator back to a /// > factory default state. - fn reset() -> Result<(), reset::Error>; + fn reset(&mut self) -> Result<(), reset::Error>; // fn bio_enrollment( // request: bio_enrollment::Request, diff --git a/crates/hid-ctap2-proto/src/lib.rs b/crates/hid-ctap2-proto/src/lib.rs index e15be0f..f0f717f 100644 --- a/crates/hid-ctap2-proto/src/lib.rs +++ b/crates/hid-ctap2-proto/src/lib.rs @@ -28,8 +28,9 @@ impl Ctap2_2Authenticator for HidAuthenticator { todo!() } - fn reset() -> Result<(), reset::Error> { - todo!() + fn reset(&mut self) -> Result<(), reset::Error> { + let _: () = self.send(Command::AuthenticatorReset, ()).unwrap(); + Ok(()) } fn selection() -> Result<(), ctap2_proto::authenticator::selection::Error> { @@ -67,6 +68,16 @@ mod tests { None } + // #[test] + fn reset() { + init(); + + let mut guard = AUTHENTICATOR.lock().unwrap(); + let authenticator = guard.as_mut().unwrap(); + + authenticator.reset().unwrap(); + } + #[test] fn test_get_info() { init();