Skip to main content

http_msgsign_draft/
sign.rs

1use crate::errors::VerificationError;
2
3mod base;
4mod component;
5mod field;
6mod input;
7pub mod params;
8mod request;
9mod response;
10
11pub(crate) use self::base::*;
12pub(crate) use self::input::*;
13pub use self::params::*;
14
15pub use self::request::*;
16pub use self::response::*;
17
18pub mod headers {
19    pub use super::input::*;
20}
21
22pub trait SignerKey: 'static + Sync + Send {
23    fn id(&self) -> String;
24    fn algorithm(&self) -> String;
25
26    fn sign(&self, target: &[u8]) -> Vec<u8>;
27}
28
29pub trait VerifierKey: 'static + Sync + Send {
30    fn id(&self) -> String;
31    fn algorithm(&self) -> String;
32
33    fn verify(&self, target: &[u8], sig: &[u8]) -> Result<(), VerificationError>;
34}