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: secret store → 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 default backend. The prompt-free default is
FileKeyringStore under ~/.deepseek/secrets/. Set
SECRET_BACKEND_ENV to system or keyring to opt into the OS
credential store.
Sourcepub fn file_backed() -> Self
pub fn file_backed() -> Self
Construct the file-backed default backend directly.
Sourcepub fn system_keyring() -> Self
pub fn system_keyring() -> Self
Construct the opt-in OS credential backend, falling back to the file-backed store when the platform backend is unavailable.
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 secret store → env → none precedence.
name is the canonical provider name ("deepseek",
"openrouter", "novita", "nvidia"/"nvidia-nim", "openai",
or "atlascloud").
Empty strings on either layer are treated as “not set”.
Sourcepub fn resolve_with_source(&self, name: &str) -> Option<(String, SecretSource)>
pub fn resolve_with_source(&self, name: &str) -> Option<(String, SecretSource)>
Resolve a secret and report which layer supplied it.
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.