pub struct Key(/* private fields */);
Available on crate feature
key
only.Expand description
An encryption key to authenticate and encrypt/decrypt cookie values
This currently uses the ChaCha20-Poly1305 algorithm as defined in RFC 7539.
Implementations§
source§impl Key
impl Key
sourcepub fn from_hex_lower(s: &[u8]) -> Result<Self, Error>
pub fn from_hex_lower(s: &[u8]) -> Result<Self, Error>
Create key from slice of hexadecimal characters
This will fail if the length of the slice is not equal to 32.
pub fn decrypt<'a>( &self, aad: &[u8], input: &'a mut [u8] ) -> Result<&'a [u8], Error>
pub fn encrypt(&self, aad: &[u8], buf: &mut Vec<u8>) -> Result<(), Error>
Auto Trait Implementations§
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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