Struct csrf::HmacCsrfProtection [] [src]

pub struct HmacCsrfProtection { /* fields omitted */ }

Uses HMAC to provide authenticated CSRF tokens and cookies.

Methods

impl HmacCsrfProtection
[src]

Given an HMAC key, return an HmacCsrfProtection instance.

Trait Implementations

impl CsrfProtection for HmacCsrfProtection
[src]

Using scrypt with params n=12, r=8, p=1, generate the key material used for the underlying crypto functions.

Panics

This function may panic if the underlying crypto library fails catastrophically.

Provide a random number generator for other functions.

Given a nonce and a time to live (TTL), create a cookie to send to the end user.

Given a nonce, create a token to send to the end user.

Given a decoded byte array, deserialize, decrypt, and verify the cookie.

Given a decoded byte array, deserialize, decrypt, and verify the token.

Given a token pair that has been parsed, decoded, decrypted, and verified, return whether or not the token matches the cookie and they have not expired. Read more

Given a buffer, fill it with random bytes or error if this is not possible.

Given an optional previous token and a TTL, generate a matching token and cookie pair.