pub struct Decrypted<T, H = ()> {
pub header: H,
pub payload: T,
}
Expand description
Rust representation of a JWE
Fields§
§header: H
Embedded header
payload: T
Payload, usually a signed/unsigned JWT
Implementations§
Source§impl<T, H> Decrypted<T, H>
impl<T, H> Decrypted<T, H>
Sourcepub fn new_with_header(payload: T, header: H) -> Self
pub fn new_with_header(payload: T, header: H) -> Self
Create a new JWE with a custom header field
Source§impl<T, H> Decrypted<T, H>
impl<T, H> Decrypted<T, H>
Sourcepub fn encrypt<CEA, KMA>(
self,
key: &KMA::Key,
key_settings: KMA::WrapSettings,
) -> Result<Encrypted<KMA, H>, Error>
pub fn encrypt<CEA, KMA>( self, key: &KMA::Key, key_settings: KMA::WrapSettings, ) -> Result<Encrypted<KMA, H>, Error>
Encrypt an Decrypted JWE.
You will need to provide a jwa::EncryptionOptions
that will differ based on your chosen
algorithms.
If your cek_algorithm
is not dir
or direct, the options provided will be used to
encrypt your content encryption key.
If your cek_algorithm
is dir
or Direct, then the options will be used to encrypt
your content directly.
Source§impl<P, H> Decrypted<ClaimsSet<P>, H>
Convenience implementation for a Compact that contains a ClaimsSet
impl<P, H> Decrypted<ClaimsSet<P>, H>
Convenience implementation for a Compact that contains a ClaimsSet
Sourcepub fn validate(&self, options: ValidationOptions) -> Result<(), Error>
pub fn validate(&self, options: ValidationOptions) -> Result<(), Error>
Validate the temporal claims in the decoded token
If None
is provided for options, the defaults will apply.
By default, no temporal claims (namely iat
, exp
, nbf
)
are required, and they will pass validation if they are missing.
Trait Implementations§
impl<T: Eq, H: Eq> Eq for Decrypted<T, H>
impl<T, H> StructuralPartialEq for Decrypted<T, H>
Auto Trait Implementations§
impl<T, H> Freeze for Decrypted<T, H>
impl<T, H> RefUnwindSafe for Decrypted<T, H>where
H: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, H> Send for Decrypted<T, H>
impl<T, H> Sync for Decrypted<T, H>
impl<T, H> Unpin for Decrypted<T, H>
impl<T, H> UnwindSafe for Decrypted<T, H>where
H: UnwindSafe,
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.