parent
6e22c0fcb4
commit
3a802eb193
3 changed files with 40 additions and 0 deletions
|
|
@ -62,6 +62,7 @@ pub enum MechanismError {
|
|||
|
||||
CannotDecodeResponse,
|
||||
InvalidKeyLength(hmac::digest::InvalidLength),
|
||||
RandomFailure(getrandom::Error),
|
||||
NoProof,
|
||||
CannotDecodeProof,
|
||||
AuthenticationFailed,
|
||||
|
|
@ -98,6 +99,12 @@ impl From<hmac::digest::InvalidLength> for MechanismError {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<getrandom::Error> for MechanismError {
|
||||
fn from(err: getrandom::Error) -> MechanismError {
|
||||
MechanismError::RandomFailure(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ProviderError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "provider error")
|
||||
|
|
@ -139,6 +146,9 @@ impl fmt::Display for MechanismError {
|
|||
|
||||
MechanismError::CannotDecodeResponse => write!(fmt, "can’t decode response"),
|
||||
MechanismError::InvalidKeyLength(err) => write!(fmt, "invalid key length: {}", err),
|
||||
MechanismError::RandomFailure(err) => {
|
||||
write!(fmt, "failure to get random data: {}", err)
|
||||
}
|
||||
MechanismError::NoProof => write!(fmt, "no proof"),
|
||||
MechanismError::CannotDecodeProof => write!(fmt, "can’t decode proof"),
|
||||
MechanismError::AuthenticationFailed => write!(fmt, "authentication failed"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue