pub struct AesGcmCsrfProtection { /* private fields */ }
Expand description
Uses AES-GCM to provide signed, encrypted CSRF tokens and cookies.
Implementations§
Source§impl AesGcmCsrfProtection
impl AesGcmCsrfProtection
Sourcepub fn from_key(aead_key: [u8; 32]) -> AesGcmCsrfProtection
pub fn from_key(aead_key: [u8; 32]) -> AesGcmCsrfProtection
Given an AES256 key, return an AesGcmCsrfProtection
instance.
Trait Implementations§
Source§impl CsrfProtection for AesGcmCsrfProtection
impl CsrfProtection for AesGcmCsrfProtection
Given a nonce and a time to live (TTL), create a cookie to send to the end user.
Source§fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
Given a nonce, create a token to send to the end user.
Given a decoded byte array, deserialize, decrypt, and verify the cookie.
Source§fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
Given a decoded byte array, deserialize, decrypt, and verify the token.
Source§fn verify_token_pair(
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie,
) -> bool
fn verify_token_pair( &self, token: &UnencryptedCsrfToken, cookie: &UnencryptedCsrfCookie, ) -> bool
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.
Auto Trait Implementations§
impl Freeze for AesGcmCsrfProtection
impl RefUnwindSafe for AesGcmCsrfProtection
impl Send for AesGcmCsrfProtection
impl Sync for AesGcmCsrfProtection
impl Unpin for AesGcmCsrfProtection
impl UnwindSafe for AesGcmCsrfProtection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> PersistentInto<Arc<Mutex<T>>> for T
impl<T> PersistentInto<Arc<Mutex<T>>> for T
Source§fn persistent_into(self) -> Arc<Mutex<T>>
fn persistent_into(self) -> Arc<Mutex<T>>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<Arc<RwLock<T>>> for T
impl<T> PersistentInto<Arc<RwLock<T>>> for T
Source§fn persistent_into(self) -> Arc<RwLock<T>>
fn persistent_into(self) -> Arc<RwLock<T>>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<Arc<T>> for T
impl<T> PersistentInto<Arc<T>> for T
Source§fn persistent_into(self) -> Arc<T>
fn persistent_into(self) -> Arc<T>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<T> for T
impl<T> PersistentInto<T> for T
Source§fn persistent_into(self) -> T
fn persistent_into(self) -> T
Convert
self
into a value of type T
.