1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::{Buffer, Secret};
use ockam_core::Result;
use ockam_core::{async_trait, compat::boxed::Box};

/// Trait with symmetric encryption
#[async_trait]
pub trait SymmetricVault {
    /// Encrypt a payload using AES-GCM
    async fn aead_aes_gcm_encrypt(
        &mut self,
        context: &Secret,
        plaintext: &[u8],
        nonce: &[u8],
        aad: &[u8],
    ) -> Result<Buffer<u8>>;
    /// Decrypt a payload using AES-GCM
    async fn aead_aes_gcm_decrypt(
        &mut self,
        context: &Secret,
        cipher_text: &[u8],
        nonce: &[u8],
        aad: &[u8],
    ) -> Result<Buffer<u8>>;
}