pub struct A128KWKey { /* private fields */ }Expand description
AES-128 Key Wrap key for JWE.
This is a symmetric key that can both encrypt and decrypt JWE tokens. Note: A256KW is preferred for new applications.
Implementations§
Source§impl A128KWKey
impl A128KWKey
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 16 bytes (128 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 A128KWKey
impl RefUnwindSafe for A128KWKey
impl Send for A128KWKey
impl Sync for A128KWKey
impl Unpin for A128KWKey
impl UnsafeUnpin for A128KWKey
impl UnwindSafe for A128KWKey
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