UnsealedToken

Struct UnsealedToken 

Source
pub struct UnsealedToken<V, P, M, F = ()> {
    pub claims: M,
    pub footer: F,
    /* private fields */
}
Expand description

An unsealed token.

This represents a PASETO which has had signatures or encryption validated. Using one of the following aliases is suggested

This type is un-serializable as it isn’t sealed. For that you will want SealedToken.

Fields§

§claims: M

The message that was contained in the token

§footer: F

The footer that was sent with the token

Implementations§

Source§

impl<V: Version, T: Purpose, M> UnsealedToken<V, T, M>

Source

pub fn new(claims: M) -> Self

Create a new UnsealedToken builder with the given message payload

Source§

impl<V, T, M> UnsealedToken<V, T, M, ()>

Set the footer for this token.

Footers are embedded into the token as base64 only. They are authenticated but not encrypted.

Source§

impl<V, P, M, F> UnsealedToken<V, P, M, F>
where V: SealingVersion<P>, P: Purpose, M: Payload, F: Footer,

Source

pub fn seal( self, key: &Key<V, P::SealingKey>, aad: &[u8], ) -> Result<SealedToken<V, P, M, F>, PasetoError>

Seal a token and authenticate the claims

Source

pub fn dangerous_seal_with_nonce( self, key: &Key<V, P::SealingKey>, aad: &[u8], nonce: Vec<u8>, ) -> Result<SealedToken<V, P, M, F>, PasetoError>

Use UnsealedToken::seal instead.

This is provided for testing purposes only. Do not use this method directly.

Source§

impl<V, M, F> UnsealedToken<V, Local, M, F>
where V: SealingVersion<Local>, M: Payload, F: Footer,

Source

pub fn encrypt( self, key: &LocalKey<V>, ) -> Result<EncryptedToken<V, M, F>, PasetoError>

Encrypt the token

Source

pub fn encrypt_with_aad( self, key: &LocalKey<V>, aad: &[u8], ) -> Result<EncryptedToken<V, M, F>, PasetoError>

Encrypt the token, additionally authenticating the implicit assertions.

Source§

impl<V, M, F> UnsealedToken<V, Public, M, F>
where V: SealingVersion<Public>, M: Payload, F: Footer,

Source

pub fn sign( self, key: &SecretKey<V>, ) -> Result<SignedToken<V, M, F>, PasetoError>

Sign the token

Source

pub fn sign_with_aad( self, key: &SecretKey<V>, aad: &[u8], ) -> Result<SignedToken<V, M, F>, PasetoError>

Sign the token, additionally authenticating the implicit assertions.

Auto Trait Implementations§

§

impl<V, P, M, F> Freeze for UnsealedToken<V, P, M, F>
where M: Freeze, F: Freeze,

§

impl<V, P, M, F> RefUnwindSafe for UnsealedToken<V, P, M, F>

§

impl<V, P, M, F> Send for UnsealedToken<V, P, M, F>
where M: Send, F: Send, V: Send, P: Send,

§

impl<V, P, M, F> Sync for UnsealedToken<V, P, M, F>
where M: Sync, F: Sync, V: Sync, P: Sync,

§

impl<V, P, M, F> Unpin for UnsealedToken<V, P, M, F>
where M: Unpin, F: Unpin, V: Unpin, P: Unpin,

§

impl<V, P, M, F> UnwindSafe for UnsealedToken<V, P, M, F>

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> 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, 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.