SealingVersion

Trait SealingVersion 

Source
pub trait SealingVersion<P: Purpose>: UnsealingVersion<P> + HasKey<P::SealingKey> {
    // Required methods
    fn unsealing_key(
        key: &<Self as HasKey<<P as Purpose>::SealingKey>>::Key,
    ) -> <Self as HasKey<P>>::Key;
    fn random(    ) -> Result<<Self as HasKey<<P as Purpose>::SealingKey>>::Key, PasetoError>;
    fn nonce() -> Result<Vec<u8>, PasetoError>;
    fn dangerous_seal_with_nonce(
        key: &<Self as HasKey<<P as Purpose>::SealingKey>>::Key,
        encoding: &'static str,
        payload: Vec<u8>,
        footer: &[u8],
        aad: &[u8],
    ) -> Result<Vec<u8>, PasetoError>;
}
Expand description

This PASETO implementation can sign/encrypt tokens.

Required Methods§

Source

fn unsealing_key( key: &<Self as HasKey<<P as Purpose>::SealingKey>>::Key, ) -> <Self as HasKey<P>>::Key

Generate the key that can unseal the tokens this key will seal.

Source

fn random() -> Result<<Self as HasKey<<P as Purpose>::SealingKey>>::Key, PasetoError>

Generate a random key

Source

fn nonce() -> Result<Vec<u8>, PasetoError>

Do not call this method directly.

Source

fn dangerous_seal_with_nonce( key: &<Self as HasKey<<P as Purpose>::SealingKey>>::Key, encoding: &'static str, payload: Vec<u8>, footer: &[u8], aad: &[u8], ) -> Result<Vec<u8>, PasetoError>

Do not call this method directly. Use UnsealedToken::seal instead.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§