pub trait CredentialResolver:
Debug
+ Send
+ Sync {
// Required methods
fn id(&self) -> &str;
fn display_name(&self) -> &str;
fn priority(&self) -> u16;
fn resolve(&self) -> Result<Option<ResolvedCredential>, CredentialError>;
// Provided methods
fn supports_login(&self) -> bool { ... }
fn login(&self) -> Result<(), Box<dyn Error>> { ... }
fn logout(&self) -> Result<(), Box<dyn Error>> { ... }
}Expand description
Trait for pluggable credential sources.
Each implementation represents one way to obtain API credentials (e.g. environment variables, saved OAuth tokens, external tool discovery).
Required Methods§
Sourcefn id(&self) -> &str
fn id(&self) -> &str
Unique identifier for this resolver (e.g. "env", "codineer-oauth", "claude-code").
Sourcefn display_name(&self) -> &str
fn display_name(&self) -> &str
Human-readable name shown in UI (e.g. "Environment Variables").
Sourcefn priority(&self) -> u16
fn priority(&self) -> u16
Lower priority values are tried first. Convention:
- 100: environment variables
- 200: Codineer OAuth
- 300: external tool discovery (Claude Code, etc.)
Sourcefn resolve(&self) -> Result<Option<ResolvedCredential>, CredentialError>
fn resolve(&self) -> Result<Option<ResolvedCredential>, CredentialError>
Attempt to resolve credentials. Returns Ok(None) if this source
has no credentials (and the chain should try the next resolver).
Provided Methods§
Sourcefn supports_login(&self) -> bool
fn supports_login(&self) -> bool
Whether this resolver supports interactive login().