Skip to main content

submilli_engine/runtime/
secrets.rs

1//! Runtime-side provider for `submilli:secrets`.
2
3use std::future::Future;
4use std::pin::Pin;
5
6/// Host-provided resolver for blueprint-declared secrets.
7///
8/// `Ok(None)` means the secret is not available to the script: undeclared,
9/// declared but missing, or otherwise absent. Infrastructure/configuration
10/// failures should be returned as `Err` so scripts cannot confuse them with
11/// ordinary absence.
12pub trait SecretProvider: Send + Sync {
13    fn get<'a>(
14        &'a self,
15        name: &'a str,
16    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'a>>;
17}
18
19#[derive(Default)]
20pub struct NoopSecretProvider;
21
22impl SecretProvider for NoopSecretProvider {
23    fn get<'a>(
24        &'a self,
25        _name: &'a str,
26    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'a>> {
27        Box::pin(async { Ok(None) })
28    }
29}