Skip to main content

winterwallet_core/
error.rs

1/// Errors returned by this crate.
2#[derive(Debug)]
3pub enum WinternitzError {
4    /// The mnemonic failed BIP-39 validation: wrong word count, unknown word,
5    /// or invalid checksum.
6    InvalidMnemonic,
7    /// A byte slice supplied to a `TryFrom` impl, or a passphrase, exceeded
8    /// the expected length.
9    InvalidLength,
10    /// A signature failed to verify.
11    SignatureError,
12}
13
14impl core::fmt::Display for WinternitzError {
15    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
16        match self {
17            Self::InvalidMnemonic => write!(f, "invalid BIP-39 mnemonic"),
18            Self::InvalidLength => write!(f, "byte length does not match expected size"),
19            Self::SignatureError => write!(f, "signature verification failed"),
20        }
21    }
22}
23
24impl core::error::Error for WinternitzError {}