HasKey

Trait HasKey 

Source
pub trait HasKey<K>: Version {
    type Key;

    // Required methods
    fn encode(key: &Self::Key) -> Box<[u8]>;
    fn decode(bytes: &[u8]) -> Result<Self::Key, PasetoError>;
}
Expand description

Declares that this PASETO implementation supports the given key type, as well as how to encode/decode the key.

Required Associated Types§

Required Methods§

Source

fn encode(key: &Self::Key) -> Box<[u8]>

Encode the key into bytes.

Source

fn decode(bytes: &[u8]) -> Result<Self::Key, PasetoError>

Decode the key from bytes.

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§