1use hex::FromHexError;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum Error {
6 #[error("Secret Key provided has wrong length")]
7 SecretKeyLenMismatch,
8 #[error("Error converting from hex")]
9 FromHexError(FromHexError),
10 #[error("Invalid secret key")]
11 InvalidSecretKey(secp256k1::Error),
12}
13
14impl From<FromHexError> for Error {
15 fn from(value: FromHexError) -> Self {
16 Self::FromHexError(value)
17 }
18}
19
20impl From<secp256k1::Error> for Error {
21 fn from(value: secp256k1::Error) -> Self {
22 Self::InvalidSecretKey(value)
23 }
24}