Signer

Trait Signer 

pub trait Signer {
    type Signature: AsRef<[u8]>;
    type Error: Into<Box<dyn Error + Send + Sync>>;

    // Required methods
    fn set_headers(
        &self,
        protected_headers: &mut Headers,
        unprotected_headers: &mut Headers,
    ) -> Result<(), Self::Error>;
    fn sign(&self, data: &str) -> Result<Self::Signature, Self::Error>;
}
Available on crate feature crypto only.
Expand description

Signer implements all methods which are needed to sign our JWS requests, and add the needed info to our JOSE headers (JOSE headers = protected + unprotected headers)

Required Associated Types§

type Signature: AsRef<[u8]>

type Error: Into<Box<dyn Error + Send + Sync>>

Required Methods§

fn set_headers( &self, protected_headers: &mut Headers, unprotected_headers: &mut Headers, ) -> Result<(), Self::Error>

Set headers which are needed to verify the final Signature

Example headers are: alg, curve

fn sign(&self, data: &str) -> Result<Self::Signature, Self::Error>

Sign the str encoded payload

Implementors§