use crate::*;
use async_trait::*;
use secret_vault_value::SecretValue;
#[async_trait]
pub trait AeadEncryption<Aad> {
async fn encrypt_value(
&self,
aad: &Aad,
plain_text: &SecretValue,
encryption_key: &DataEncryptionKey,
) -> KmsAeadResult<CipherText>;
async fn decrypt_value(
&self,
aad: &Aad,
cipher_text: &CipherText,
encryption_key: &DataEncryptionKey,
) -> KmsAeadResult<SecretValue>;
}
#[async_trait]
pub trait KmsAeadEnvelopeEncryption<Aad> {
async fn encrypt_value(
&self,
aad: &Aad,
plain_text: &SecretValue,
) -> KmsAeadResult<CipherTextWithEncryptedKey>;
async fn decrypt_value(
&self,
aad: &Aad,
cipher_text: &CipherTextWithEncryptedKey,
) -> KmsAeadResult<SecretValue>;
async fn encrypt_value_with_dek(
&self,
aad: &Aad,
plain_text: &SecretValue,
dek: &DataEncryptionKey,
) -> KmsAeadResult<CipherText>;
async fn encrypt_value_with_encrypted_dek(
&self,
aad: &Aad,
plain_text: &SecretValue,
dek: &EncryptedDataEncryptionKey,
) -> KmsAeadResult<CipherText>;
async fn decrypt_value_with_dek(
&self,
aad: &Aad,
cipher_text: &CipherText,
data_encryption_key: &DataEncryptionKey,
) -> KmsAeadResult<SecretValue>;
async fn decrypt_value_with_encrypted_dek(
&self,
aad: &Aad,
cipher_text: &CipherText,
encrypted_data_encryption_key: &EncryptedDataEncryptionKey,
) -> KmsAeadResult<SecretValue>;
async fn generate_new_dek(
&self,
) -> KmsAeadResult<(DataEncryptionKey, EncryptedDataEncryptionKey)>;
}