Struct http_signatures::HttpSignature [] [src]

pub struct HttpSignature<T> where
    T: Read
{ /* fields omitted */ }

The HttpSignature struct, this is the entry point for creating an Authorization header. It contains all the values required for generation.

Methods

impl<T> HttpSignature<T> where
    T: Read
[src]

[src]

Create a new HttpSignature from its components.

This method will Error if headers is empty.

Example

use http_signatures::{HttpSignature, SignatureAlgorithm, ShaSize, REQUEST_TARGET};

let key_id = "test/assets/public.der".into();
let priv_key = File::open("test/assets/private.der")?;

let alg = SignatureAlgorithm::RSA(ShaSize::FiveTwelve);

let mut headers = HashMap::new();
headers.insert(REQUEST_TARGET.into(), vec!["get /".into()]);

let http_sig = HttpSignature::new(key_id, priv_key, alg, headers)?;

[src]

[src]

[src]

[src]

Generate the Authorization Header from the HttpSignature

This method errors if signing the signing-string fails.

Example

use http_signatures::HttpSignature;

let auth_header = http_signature.authorization_header()?;

Trait Implementations

impl<T> AsHttpSignature<T> for HttpSignature<T> where
    T: Read + Clone
[src]

A default implementation of AsHttpSignature for HttpSignature.

This only works if type T is Clone in addition to Read, which is normally required. This implementation doesn't serve much of a purpose.

[src]

Gets an HttpSignature struct from an immutably borrowed Self

[src]

Generates the Authorization Header from an immutably borrowed Self