pub struct Secrets {
pub store: Arc<dyn KeyringStore>,
/* private fields */
}Expand description
High-level façade combining a KeyringStore with environment
variable fallbacks.
Lookup precedence: keyring → env → none. Callers that also have a TOML config layer must wire that themselves at the very end of the chain.
Fields§
§store: Arc<dyn KeyringStore>Underlying secret store.
Implementations§
Source§impl Secrets
impl Secrets
Sourcepub fn new(store: Arc<dyn KeyringStore>) -> Self
pub fn new(store: Arc<dyn KeyringStore>) -> Self
Build a new façade around a store.
Sourcepub fn auto_detect() -> Self
pub fn auto_detect() -> Self
Construct the platform-appropriate default backend. On platforms
where an OS keyring backend is reachable this returns
DefaultKeyringStore; otherwise it falls back to
FileKeyringStore under ~/.deepseek/secrets/.
Sourcepub fn backend_name(&self) -> &'static str
pub fn backend_name(&self) -> &'static str
Backend label, suitable for doctor output.
Sourcepub fn resolve(&self, name: &str) -> Option<String>
pub fn resolve(&self, name: &str) -> Option<String>
Resolve a secret with keyring → env → none precedence.
name is the canonical provider name ("deepseek",
"openrouter", "novita", "nvidia"/"nvidia-nim", "openai").
Empty strings on either layer are treated as “not set”.
Sourcepub fn set(&self, name: &str, value: &str) -> Result<(), SecretsError>
pub fn set(&self, name: &str, value: &str) -> Result<(), SecretsError>
Convenience: write a secret through the underlying store.