pub trait RequestMessageSignature {
    type Error;

    // Required methods
    fn set_message_signature<T>(
        &mut self,
        signature_params: &HttpSignatureParams,
        signing_key: &T,
        signature_name: Option<&str>
    ) -> impl Future<Output = Result<(), Self::Error>> + Send
       where Self: Sized,
             T: SigningKey + Sync;
    fn verify_message_signature<T>(
        &self,
        verifying_key: &T,
        key_id: Option<&str>
    ) -> impl Future<Output = Result<(), Self::Error>> + Send
       where Self: Sized,
             T: VerifyingKey + Sync;
    fn has_message_signature(&self) -> bool;
    fn get_key_ids(&self) -> Result<Vec<String>, Self::Error>;
    fn get_signature_params(
        &self
    ) -> Result<Vec<HttpSignatureParams>, Self::Error>;
    fn extract_signatures(
        &self
    ) -> Result<Vec<(HttpSignatureBase, HttpSignatureHeaders)>, Self::Error>;
}
Expand description

A trait to set the http message signature from given http signature params

Required Associated Types§

Required Methods§

source

fn set_message_signature<T>( &mut self, signature_params: &HttpSignatureParams, signing_key: &T, signature_name: Option<&str> ) -> impl Future<Output = Result<(), Self::Error>> + Send
where Self: Sized, T: SigningKey + Sync,

Set the http message signature from given http signature params and signing key

source

fn verify_message_signature<T>( &self, verifying_key: &T, key_id: Option<&str> ) -> impl Future<Output = Result<(), Self::Error>> + Send
where Self: Sized, T: VerifyingKey + Sync,

Verify the http message signature with given verifying key if the request has signature and signature-input headers

source

fn has_message_signature(&self) -> bool

Check if the request has signature and signature-input headers

source

fn get_key_ids(&self) -> Result<Vec<String>, Self::Error>

Extract all key ids for signature bases contained in the request headers

source

fn get_signature_params(&self) -> Result<Vec<HttpSignatureParams>, Self::Error>

Extract all signature params used to generate signature bases contained in the request headers

source

fn extract_signatures( &self ) -> Result<Vec<(HttpSignatureBase, HttpSignatureHeaders)>, Self::Error>

Extract all signature bases contained in the request headers

Implementations on Foreign Types§

source§

impl<D> RequestMessageSignature for Request<D>
where D: Send + Body + Sync,

source§

async fn set_message_signature<T>( &mut self, signature_params: &HttpSignatureParams, signing_key: &T, signature_name: Option<&str> ) -> HyperSigResult<()>
where Self: Sized, T: SigningKey + Sync,

Set the http message signature from given http signature params and signing key

source§

async fn verify_message_signature<T>( &self, verifying_key: &T, key_id: Option<&str> ) -> HyperSigResult<()>
where Self: Sized, T: VerifyingKey + Sync,

Verify the http message signature with given verifying key if the request has signature and signature-input headers Return Ok(()) if the signature is valid. If invalid for the given key or error occurs (like the case where the request does not have signature and/or signature-input headers), return Err. If key_id is given, it is used to match the key id in signature params

source§

fn has_message_signature(&self) -> bool

Check if the request has signature and signature-input headers

source§

fn get_key_ids(&self) -> HyperSigResult<Vec<String>>

Extract all signature bases contained in the request headers

source§

fn get_signature_params(&self) -> Result<Vec<HttpSignatureParams>, Self::Error>

Extract all signature params used to generate signature bases contained in the request headers

source§

fn extract_signatures( &self ) -> Result<Vec<(HttpSignatureBase, HttpSignatureHeaders)>, Self::Error>

Extract all signature bases contained in the request headers

§

type Error = HyperSigError

Implementors§