Implement reset command for HID authenticator

dev
Nick Zana 2 years ago
parent 1daffb7db7
commit ce905e422d

@ -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.

@ -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,

@ -28,8 +28,9 @@ impl<D: ctaphid::HidDevice> Ctap2_2Authenticator for HidAuthenticator<D> {
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();

Loading…
Cancel
Save