Struct Decrypted

Source
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> Decrypted<T>

Source

pub fn new(payload: T) -> Self

Create a new JWE

Source§

impl<T> Decrypted<Json<T>>

Source

pub fn new_json(payload: T) -> Self

Create a new json JWE

Source§

impl<T, H> Decrypted<T, H>

Source

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>

Source

pub fn encrypt<CEA, KMA>( self, key: &KMA::Key, key_settings: KMA::WrapSettings, ) -> Result<Encrypted<KMA, H>, Error>
where CEA: CEA, KMA: KMA,

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

Source

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§

Source§

impl<T: Clone, H: Clone> Clone for Decrypted<T, H>

Source§

fn clone(&self) -> Decrypted<T, H>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, H: Debug> Debug for Decrypted<T, H>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq, H: PartialEq> PartialEq for Decrypted<T, H>

Source§

fn eq(&self, other: &Decrypted<T, H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq, H: Eq> Eq for Decrypted<T, H>

Source§

impl<T, H> StructuralPartialEq for Decrypted<T, H>

Auto Trait Implementations§

§

impl<T, H> Freeze for Decrypted<T, H>
where H: Freeze, T: Freeze,

§

impl<T, H> RefUnwindSafe for Decrypted<T, H>

§

impl<T, H> Send for Decrypted<T, H>
where H: Send, T: Send,

§

impl<T, H> Sync for Decrypted<T, H>
where H: Sync, T: Sync,

§

impl<T, H> Unpin for Decrypted<T, H>
where H: Unpin, T: Unpin,

§

impl<T, H> UnwindSafe for Decrypted<T, H>
where H: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V