iron-hmac

HMAC middleware for iron

Authenticates incoming requests by computing the HMAC and performing a constant-time string comparison with the provided value. An HMAC header is computed and appended to the outgoing response.

Build Status

Usage

For a complete example, please see the examples. This snippet highlights the critical pieces of using the hmac middleware.

```rust extern crate iron_hmac;

// ...

// The bodyparser middleware is required for hmac computation chain.linkbefore(Read::::one(MAXBODY_LENGTH));

// Build the hmac middleware let (hmacbefore, hmacafter) = ironhmac::Hmac256Authentication::middleware(secret, headerkey);

// ...

chain.linkbefore(hmacbefore);

// ...

chain.linkafter(hmacafter); ```