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
UnsignedToken- ApublicPASETO which has had signature validated.UnencryptedToken- AlocalPASETO which has successfully been decrypted.
This type is un-serializable as it isn’t sealed. For that you will want SealedToken.
Fields§
§claims: MThe message that was contained in the token
The footer that was sent with the token
Implementations§
Source§impl<V: Version, T: Purpose, M> UnsealedToken<V, T, M>
impl<V: Version, T: Purpose, M> UnsealedToken<V, T, M>
Sourcepub fn new(claims: M) -> Self
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, ()>
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>
impl<V, P, M, F> UnsealedToken<V, P, M, F>
Sourcepub fn seal(
self,
key: &Key<V, P::SealingKey>,
aad: &[u8],
) -> Result<SealedToken<V, P, M, F>, PasetoError>
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
Sourcepub fn dangerous_seal_with_nonce(
self,
key: &Key<V, P::SealingKey>,
aad: &[u8],
nonce: Vec<u8>,
) -> Result<SealedToken<V, P, M, F>, PasetoError>
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>
impl<V, M, F> UnsealedToken<V, Local, M, F>
Sourcepub fn encrypt(
self,
key: &LocalKey<V>,
) -> Result<EncryptedToken<V, M, F>, PasetoError>
pub fn encrypt( self, key: &LocalKey<V>, ) -> Result<EncryptedToken<V, M, F>, PasetoError>
Encrypt the token
Sourcepub fn encrypt_with_aad(
self,
key: &LocalKey<V>,
aad: &[u8],
) -> Result<EncryptedToken<V, M, F>, PasetoError>
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>
impl<V, M, F> UnsealedToken<V, Public, M, F>
Sourcepub fn sign(
self,
key: &SecretKey<V>,
) -> Result<SignedToken<V, M, F>, PasetoError>
pub fn sign( self, key: &SecretKey<V>, ) -> Result<SignedToken<V, M, F>, PasetoError>
Sign the token
Sourcepub fn sign_with_aad(
self,
key: &SecretKey<V>,
aad: &[u8],
) -> Result<SignedToken<V, M, F>, PasetoError>
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.