From b1963220d886666de1f478898add1b997ae4b267 Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Tue, 13 Jun 2023 23:59:08 -0400 Subject: [PATCH] ctap2-proto: Implement std::fmt::Display for authenticator::client_pin::Error --- .../src/authenticator/client_pin/mod.rs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/crates/ctap2-proto/src/authenticator/client_pin/mod.rs b/crates/ctap2-proto/src/authenticator/client_pin/mod.rs index 14d5232..9509c39 100644 --- a/crates/ctap2-proto/src/authenticator/client_pin/mod.rs +++ b/crates/ctap2-proto/src/authenticator/client_pin/mod.rs @@ -105,26 +105,6 @@ pub enum Error { UserVerificationInvalid, } -impl std::fmt::Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Error::MissingParameter => write!(f, "Missing parameter"), - Error::InvalidParameter => write!(f, "Invalid parameter"), - Error::PinAuthInvalid => write!(f, "PIN auth invalid"), - Error::PinPolicyViolation => write!(f, "PIN policy violation"), - Error::PinBlocked => write!(f, "PIN blocked"), - Error::PinAuthBlocked => write!(f, "PIN auth blocked"), - Error::PinInvalid => write!(f, "PIN invalid"), - Error::OperationDenied => write!(f, "Operation denied"), - Error::UnauthorizedPermission => write!(f, "Unauthorized permission"), - Error::NotAllowed => write!(f, "Not allowed"), - Error::UserVerificationBlocked => write!(f, "User verification blocked"), - Error::UserActionTimeout => write!(f, "User action timeout"), - Error::UserVerificationInvalid => write!(f, "User verification invalid"), - } - } -} - /// > When obtaining a `pinUvAuthToken`, the platform requests permissions /// > appropriate for the operations it intends to perform. Consequently, the /// > `pinUvAuthToken` can only be used for those operations. @@ -154,3 +134,23 @@ pub enum Permission { /// > `authenticatorConfig` command. AuthenticatorConfiguration, } + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Error::MissingParameter => write!(f, "Missing parameter"), + Error::InvalidParameter => write!(f, "Invalid parameter"), + Error::PinAuthInvalid => write!(f, "PIN auth invalid"), + Error::PinPolicyViolation => write!(f, "PIN policy violation"), + Error::PinBlocked => write!(f, "PIN blocked"), + Error::PinAuthBlocked => write!(f, "PIN auth blocked"), + Error::PinInvalid => write!(f, "PIN invalid"), + Error::OperationDenied => write!(f, "Operation denied"), + Error::UnauthorizedPermission => write!(f, "Unauthorized permission"), + Error::NotAllowed => write!(f, "Not allowed"), + Error::UserVerificationBlocked => write!(f, "User verification blocked"), + Error::UserActionTimeout => write!(f, "User action timeout"), + Error::UserVerificationInvalid => write!(f, "User verification invalid"), + } + } +}