pub trait KeychainBackend: Send + Sync {
// Required methods
fn set(&mut self, profile_id: &str, secret: &Secret) -> Result<(), AppError>;
fn get(&self, profile_id: &str) -> Result<Option<Secret>, AppError>;
fn delete(&mut self, profile_id: &str) -> Result<(), AppError>;
// Provided method
fn unlock(&mut self, _passphrase: &str) -> Result<(), AppError> { ... }
}Expand description
Backend-agnostic interface for persisting and retrieving credential secrets keyed by profile ID.
Required Methods§
Sourcefn set(&mut self, profile_id: &str, secret: &Secret) -> Result<(), AppError>
fn set(&mut self, profile_id: &str, secret: &Secret) -> Result<(), AppError>
Persist secret under profile_id, replacing any existing entry.
Provided Methods§
Sourcefn unlock(&mut self, _passphrase: &str) -> Result<(), AppError>
fn unlock(&mut self, _passphrase: &str) -> Result<(), AppError>
Supply a passphrase to unlock a passphrase-protected backend.
For backends that do not require a passphrase (e.g. KeyringBackend,
StubBackend) this is a no-op that always returns Ok(()).
FileBackend overrides this to re-derive the encryption key from the
supplied passphrase and attempt to decrypt the secrets file.
Called by keychain_fallback_unlock in response to the user submitting
the KeychainFallbackPrompt in the Credential Manager UI.