1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use hex::FromHexError;
use thiserror::*;

#[derive(Debug, Error)]
pub enum SignatureErrors {
    #[error("Could not decode Base58 string: {} {}", string, message)]
    Base58Decode { message: String, string: String },
    #[error("Could not parse hex: {}", error)]
    ParseHex { error: FromHexError },

    #[error("Could not parse hex: {}", message)]
    ByteDecode { message: String },

    #[error("Invalid Point: {}", error)]
    InvalidPoint { error: elliptic_curve::Error },

    #[error("{}", error)]
    SecpError { error: k256::ecdsa::Error },

    #[error("Something went wrong: {}", message)]
    Other { message: String },

    #[error("Unable to recover public key from signature {}", error)]
    DerivePublicKey { error: anyhow::Error },
}