From a88a1b2a22640fbb06154318a11c79cd776578e2 Mon Sep 17 00:00:00 2001 From: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com> Date: Fri, 21 Apr 2023 08:03:46 +0200 Subject: [PATCH] Adds a hardware failure state for user presence (#616) Introduced in https://github.com/google/OpenSK/pull/580 The conversion to libtock's ErrorCode has to happen outside of the library. --- libraries/opensk/src/api/user_presence.rs | 2 ++ libraries/opensk/src/ctap/status_code.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/libraries/opensk/src/api/user_presence.rs b/libraries/opensk/src/api/user_presence.rs index d5f2699..6b0dbbe 100644 --- a/libraries/opensk/src/api/user_presence.rs +++ b/libraries/opensk/src/api/user_presence.rs @@ -20,6 +20,8 @@ pub enum UserPresenceError { Canceled, /// User presence check timed out. Timeout, + /// Unexpected (e.g., hardware) failures + Fail, } pub type UserPresenceResult = Result<(), UserPresenceError>; diff --git a/libraries/opensk/src/ctap/status_code.rs b/libraries/opensk/src/ctap/status_code.rs index 58d02a4..2a2f6cb 100644 --- a/libraries/opensk/src/ctap/status_code.rs +++ b/libraries/opensk/src/ctap/status_code.rs @@ -91,6 +91,7 @@ impl From for Ctap2StatusCode { UserPresenceError::Timeout => Self::CTAP2_ERR_USER_ACTION_TIMEOUT, UserPresenceError::Declined => Self::CTAP2_ERR_OPERATION_DENIED, UserPresenceError::Canceled => Self::CTAP2_ERR_KEEPALIVE_CANCEL, + UserPresenceError::Fail => Self::CTAP2_ERR_VENDOR_HARDWARE_FAILURE, } } }