Struct iron_csrf::ChaCha20Poly1305CsrfProtection
[−]
[src]
pub struct ChaCha20Poly1305CsrfProtection { /* fields omitted */ }
Uses the ChaCha20Poly1305 AEAD to provide signed, encrypted CSRF tokens and cookies.
Methods
impl ChaCha20Poly1305CsrfProtection
[src]
fn from_password(password: &[u8])
-> Result<ChaCha20Poly1305CsrfProtection, CsrfError>
-> Result<ChaCha20Poly1305CsrfProtection, CsrfError>
Using scrypt
with params n=14
, r=8
, p=1
, generate the key material used for the
underlying ChaCha20Poly1305 AEAD.
Panics
This function may panic if the underlying library fails catastrophically.
Trait Implementations
impl CsrfProtection for ChaCha20Poly1305CsrfProtection
[src]
fn verify_token_pair(&self, token: &[u8], cookie: &[u8]) -> bool
Given the decoded bytes for the CSRF token and cookie, return whether or not the token is valid. Read more
fn generate_token_pair(&self,
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>
Create a CSRF token and cookie with the given TTL in seconds.