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]
Returns the internal representation of a CSRF cookie given a slice of decoded bytes.
fn parse_token(&self, token: &[u8]) -> Result<CsrfTokenTransport, CsrfError>
Returns the internal representation of a CSRF token given a slice of decoded bytes.
fn generate_token_pair(&self,
previous_token: Option<Vec<u8>>,
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>
previous_token: Option<Vec<u8>>,
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>
Creates a CSRF token and cookie with the given TTL in seconds.
fn verify_token_pair(&self,
token: &CsrfTokenTransport,
cookie: &CsrfCookieTransport)
-> bool
token: &CsrfTokenTransport,
cookie: &CsrfCookieTransport)
-> bool
Returns whether