pub struct A256KWKey { /* private fields */ }Expand description
AES-256 Key Wrap key for JWE.
This is a symmetric key that can both encrypt and decrypt JWE tokens.
Implementations§
Source§impl A256KWKey
impl A256KWKey
Sourcepub fn from_bytes(key: &[u8]) -> Result<Self, Error>
pub fn from_bytes(key: &[u8]) -> Result<Self, Error>
Create a key from raw bytes.
The key must be exactly 32 bytes (256 bits).
Sourcepub fn with_key_id(self, key_id: impl Into<String>) -> Self
pub fn with_key_id(self, key_id: impl Into<String>) -> Self
Set the key ID.
Sourcepub fn encrypt<CustomClaims: Serialize>(
&self,
claims: JWTClaims<CustomClaims>,
) -> Result<String, Error>
pub fn encrypt<CustomClaims: Serialize>( &self, claims: JWTClaims<CustomClaims>, ) -> Result<String, Error>
Encrypt claims into a JWE token.
Sourcepub fn encrypt_with_options<CustomClaims: Serialize>(
&self,
claims: JWTClaims<CustomClaims>,
options: &EncryptionOptions,
) -> Result<String, Error>
pub fn encrypt_with_options<CustomClaims: Serialize>( &self, claims: JWTClaims<CustomClaims>, options: &EncryptionOptions, ) -> Result<String, Error>
Encrypt claims into a JWE token with options.
Sourcepub fn decrypt_token<CustomClaims: DeserializeOwned>(
&self,
token: &str,
options: Option<DecryptionOptions>,
) -> Result<JWTClaims<CustomClaims>, Error>
pub fn decrypt_token<CustomClaims: DeserializeOwned>( &self, token: &str, options: Option<DecryptionOptions>, ) -> Result<JWTClaims<CustomClaims>, Error>
Decrypt a JWE token and return the claims.
Sourcepub fn decode_metadata(token: &str) -> Result<JWETokenMetadata, Error>
pub fn decode_metadata(token: &str) -> Result<JWETokenMetadata, Error>
Decode token metadata without decrypting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for A256KWKey
impl RefUnwindSafe for A256KWKey
impl Send for A256KWKey
impl Sync for A256KWKey
impl Unpin for A256KWKey
impl UnsafeUnpin for A256KWKey
impl UnwindSafe for A256KWKey
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