use secp256k1::Error as SecpError;
use thiserror::Error;
#[derive(Error, Debug, PartialEq, Eq)]
pub enum Error {
#[error("Invalid privkey")]
InvalidPrivKey,
#[error("Invalid pubkey")]
InvalidPubKey,
#[error("Invalid signature")]
InvalidSignature,
#[error("Invalid message")]
InvalidMessage,
#[error("Invalid recovery_id")]
InvalidRecoveryId,
#[error("{0}")]
Other(String),
}
impl From<SecpError> for Error {
fn from(e: SecpError) -> Self {
match e {
SecpError::InvalidPublicKey => Error::InvalidPubKey,
SecpError::InvalidSecretKey => Error::InvalidPrivKey,
SecpError::InvalidMessage => Error::InvalidMessage,
SecpError::InvalidRecoveryId => Error::InvalidRecoveryId,
_ => Error::InvalidSignature,
}
}
}