Vault

Trait Vault 

Source
pub trait Vault:
    Debug
    + Send
    + Sync
    + 'static {
    type Error: SendSyncError;

    // Required methods
    fn encrypt(&self, payload: &[u8]) -> Result<Vec<u8>, Self::Error>;
    fn decrypt(&self, payload: &[u8]) -> Result<Vec<u8>, Self::Error>;
}
Expand description

A provider of encryption for blocks of data.

Required Associated Types§

Source

type Error: SendSyncError

The error type that the vault can produce.

Required Methods§

Source

fn encrypt(&self, payload: &[u8]) -> Result<Vec<u8>, Self::Error>

Encrypts payload, returning a new buffer that contains all information necessary to decrypt it in the future.

Source

fn decrypt(&self, payload: &[u8]) -> Result<Vec<u8>, Self::Error>

Decrypts a previously encrypted payload, returning the decrypted information.

Implementors§