1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! # KMS/AEAD envelope encryption for GCP/AWS KMS and Ring AEAD encryption
//!
//! Available providers:
//! - Google Cloud Platform KMS
//! - Amazon Web Services KMS
//!
//! ## Examples:
//! Available at github: https://github.com/abdolence/kms-aead-rs
//!

#![allow(unused_parens, clippy::new_without_default)]

use rvstruct::*;
use secret_vault_value::SecretValue;
pub type KmsAeadResult<T> = std::result::Result<T, errors::KmsAeadError>;

mod api;
pub use api::*;

pub mod errors;

#[cfg(feature = "encrypted-ring")]
pub mod ring_encryption;

#[cfg(feature = "encrypted-ring")]
mod ring_encryption_support;

#[cfg(feature = "encrypted-ring")]
pub mod ring_envelope_encryption;

#[cfg(feature = "encrypted-ring")]
pub use ring_envelope_encryption::*;

#[derive(Debug, Clone, PartialEq, ValueStruct)]
pub struct EncryptedSecretValue(pub SecretValue);

#[derive(Debug, Clone, PartialEq, ValueStruct)]
pub struct EncryptedSessionKey(pub SecretValue);

impl EncryptedSessionKey {
    pub fn to_hex_string(&self) -> String {
        hex::encode(self.value().ref_sensitive_value())
    }
}

pub mod providers;