extern crate core;
mod private_key;
pub use private_key::PrivateKey;
mod public_key;
pub use public_key::PublicKey;
pub mod aes;
pub mod k256;
pub mod totp;
pub mod error {
#[derive(Debug, PartialEq, Eq)]
pub enum Error {
LengthError(String),
HexError(String),
DecryptError(String),
EncryptError(String),
RecoveryError(String),
InvalidSignature,
PrivateKeyError,
InvalidPublicKey,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Error::LengthError(s) => write!(f, "LengthError: {}", s),
Error::HexError(s) => write!(f, "HexError: {}", s),
Error::DecryptError(s) => write!(f, "DecryptError: {}", s),
Error::EncryptError(s) => write!(f, "EncryptError: {}", s),
Error::RecoveryError(s) => write!(f, "RecoveryError: {}", s),
Error::InvalidSignature => write!(f, "InvalidSignature"),
Error::PrivateKeyError => write!(f, "PrivateKeyError"),
Error::InvalidPublicKey => write!(f, "InvalidPublicKey"),
}
}
}
impl std::error::Error for Error {}
impl From<hex::FromHexError> for Error {
fn from(value: hex::FromHexError) -> Self {
Error::HexError(value.to_string())
}
}
pub type Result<T> = std::result::Result<T, Error>;
}