[−][src]Struct csrf::ChaCha20Poly1305CsrfProtection
Uses ChaCha20Poly1305 to provide signed, encrypted CSRF tokens and cookies.
Methods
impl ChaCha20Poly1305CsrfProtection
[src]
pub fn from_key(aead_key: [u8; 32]) -> Self
[src]
Given a key, return a ChaCha20Poly1305CsrfProtection
instance.
Trait Implementations
impl CsrfProtection for ChaCha20Poly1305CsrfProtection
[src]
fn generate_cookie(
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
[src]
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
[src]
fn parse_cookie(
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
[src]
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
[src]
fn verify_token_pair(
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie
) -> bool
[src]
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie
) -> bool
fn random_bytes(&self, buf: &mut [u8]) -> Result<(), CsrfError>
[src]
fn generate_token_pair(
&self,
previous_token_value: Option<&[u8; 64]>,
ttl_seconds: i64
) -> Result<(CsrfToken, CsrfCookie), CsrfError>
[src]
&self,
previous_token_value: Option<&[u8; 64]>,
ttl_seconds: i64
) -> Result<(CsrfToken, CsrfCookie), CsrfError>
Auto Trait Implementations
impl Send for ChaCha20Poly1305CsrfProtection
impl Sync for ChaCha20Poly1305CsrfProtection
impl Unpin for ChaCha20Poly1305CsrfProtection
impl UnwindSafe for ChaCha20Poly1305CsrfProtection
impl RefUnwindSafe for ChaCha20Poly1305CsrfProtection
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,