MessageSignatureReq

Trait MessageSignatureReq 

Source
pub trait MessageSignatureReq {
    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 set_message_signatures<T>(
        &mut self,
        params_key_name: &[(&HttpSignatureParams, &T, 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<String, Self::Error>> + Send
       where Self: Sized,
             T: VerifyingKey + Sync;
    fn verify_message_signatures<T>(
        &self,
        key_and_id: &[(&T, Option<&str>)],
    ) -> impl Future<Output = Result<Vec<Result<String, Self::Error>>, Self::Error>> + Send
       where Self: Sized,
             T: VerifyingKey + Sync;
    fn extract_signatures(
        &self,
    ) -> Result<IndexMap<String, (HttpSignatureBase, HttpSignatureHeaders)>, Self::Error>;
}
Expand description

A trait about http message signature for request

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 set_message_signatures<T>( &mut self, params_key_name: &[(&HttpSignatureParams, &T, Option<&str>)], ) -> impl Future<Output = Result<(), Self::Error>> + Send
where Self: Sized, T: SigningKey + Sync,

Set the http message signatures from given tuples of (http signature params, signing key, name)

Source

fn verify_message_signature<T>( &self, verifying_key: &T, key_id: Option<&str>, ) -> impl Future<Output = Result<String, 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 verify_message_signatures<T>( &self, key_and_id: &[(&T, Option<&str>)], ) -> impl Future<Output = Result<Vec<Result<String, Self::Error>>, Self::Error>> + Send
where Self: Sized, T: VerifyingKey + Sync,

Verify multiple signatures at once

Source

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

Extract all signature bases contained in the request headers

Implementations on Foreign Types§

Source§

impl<D> MessageSignatureReq 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<String>
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 extract_signatures( &self, ) -> Result<IndexMap<String, (HttpSignatureBase, HttpSignatureHeaders)>, Self::Error>

Extract all signature bases contained in the request headers

Source§

type Error = HyperSigError

Source§

async fn set_message_signatures<T>( &mut self, params_key_name: &[(&HttpSignatureParams, &T, Option<&str>)], ) -> Result<(), Self::Error>
where Self: Sized, T: SigningKey + Sync,

Source§

async fn verify_message_signatures<T>( &self, key_and_id: &[(&T, Option<&str>)], ) -> Result<Vec<Result<String, Self::Error>>, Self::Error>
where Self: Sized, T: VerifyingKey + Sync,

Implementors§