1use core::fmt;
2
3#[derive(Debug, Copy, Clone, Eq, PartialEq)]
5pub enum Error {
6 MalformedSigningKey,
8 MalformedVerificationKey,
10 InvalidSignature,
12 WrongSliceLength { expected: usize, found: usize },
14}
15
16impl fmt::Display for Error {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 Self::MalformedSigningKey => f.write_str("Malformed signing key encoding."),
20 Self::MalformedVerificationKey => f.write_str("Malformed verification key encoding."),
21 Self::InvalidSignature => f.write_str("Invalid signature."),
22 Self::WrongSliceLength { expected, found } => {
23 f.write_str("Wrong slice length, expected ")?;
24 expected.fmt(f)?;
25 f.write_str(", found ")?;
26 found.fmt(f)
27 }
28 }
29 }
30}
31
32#[cfg(feature = "std")]
33impl std::error::Error for Error {}