tendermint/crypto/
signature.rsuse core::fmt::{self, Display};
use crate::{PublicKey, Signature};
#[derive(Debug)]
pub enum Error {
VerificationFailed,
UnsupportedKeyType,
MalformedPublicKey,
MalformedSignature,
}
impl Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::VerificationFailed => f.write_str("invalid signature"),
Error::UnsupportedKeyType => f.write_str("key type not supported"),
Error::MalformedPublicKey => f.write_str("malformed public key encoding"),
Error::MalformedSignature => f.write_str("malformed signature"),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for Error {}
pub trait Verifier {
fn verify(pubkey: PublicKey, msg: &[u8], signature: &Signature) -> Result<(), Error>;
}