use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::string::ToString;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid key: {0}")]
InvalidKey(String),
#[error("invalid message: {0}")]
InvalidMessage(String),
#[error("signing failed: {0}")]
SigningFailed(String),
#[error("hex error: {0}")]
Hex(hex::FromHexError),
}
impl From<hex::FromHexError> for Error {
fn from(e: hex::FromHexError) -> Self {
Self::Hex(e)
}
}
impl From<signer_primitives::Error> for Error {
fn from(e: signer_primitives::Error) -> Self {
Self::InvalidKey(e.to_string())
}
}