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
47
48
use crate::error::Result;
use async_trait::async_trait;
pub fn env_dependencies() -> &'static [&'static str] {
&[]
}
/// Plain provider that stores and returns values as-is without encryption.
///
/// This provider is useful for:
/// - Development and testing
/// - Non-sensitive configuration values
/// - Simple string storage
///
/// WARNING: Values are stored in plain text in the configuration file.
/// Do not use this provider for sensitive secrets in production.
#[derive(Default)]
pub struct PlainProvider;
impl PlainProvider {
pub fn new() -> Result<Self> {
Ok(Self)
}
}
#[async_trait]
impl crate::providers::Provider for PlainProvider {
fn capabilities(&self) -> Vec<crate::providers::ProviderCapability> {
// Plain provider stores values as-is (no actual encryption)
// We return Encryption to indicate it handles the value directly
vec![crate::providers::ProviderCapability::Encryption]
}
async fn get_secret(&self, value: &str) -> Result<String> {
// Simply return the value as-is
Ok(value.to_string())
}
async fn encrypt(&self, value: &str) -> Result<String> {
// Plain provider stores values as-is without encryption
Ok(value.to_string())
}
async fn test_connection(&self) -> Result<()> {
// Plain provider is always available
Ok(())
}
}