tendermint/crypto/
signature.rs1use core::fmt::{self, Display};
2
3use crate::{PublicKey, Signature};
4
5#[derive(Debug)]
8pub enum Error {
9 VerificationFailed,
11 UnsupportedKeyType,
13 MalformedPublicKey,
15 MalformedSignature,
17}
18
19impl Display for Error {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 match self {
22 Error::VerificationFailed => f.write_str("invalid signature"),
23 Error::UnsupportedKeyType => f.write_str("key type not supported"),
24 Error::MalformedPublicKey => f.write_str("malformed public key encoding"),
25 Error::MalformedSignature => f.write_str("malformed signature"),
26 }
27 }
28}
29
30#[cfg(feature = "std")]
31impl std::error::Error for Error {}
32
33pub trait Verifier {
34 fn verify(pubkey: PublicKey, msg: &[u8], signature: &Signature) -> Result<(), Error>;
35}