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.
This commit is contained in:
kaczmarczyck
2023-04-21 08:03:46 +02:00
committed by GitHub
parent 5f7eb3177b
commit a88a1b2a22
2 changed files with 3 additions and 0 deletions

View File

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

View File

@@ -91,6 +91,7 @@ impl From<UserPresenceError> 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,
}
}
}