use core::fmt;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Error {
MalformedSigningKey,
MalformedVerificationKey,
InvalidSignature,
WrongSliceLength { expected: usize, found: usize },
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MalformedSigningKey => f.write_str("Malformed signing key encoding."),
Self::MalformedVerificationKey => f.write_str("Malformed verification key encoding."),
Self::InvalidSignature => f.write_str("Invalid signature."),
Self::WrongSliceLength { expected, found } => {
f.write_str("Wrong slice length, expected ")?;
expected.fmt(f)?;
f.write_str(", found ")?;
found.fmt(f)
}
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for Error {}