#[non_exhaustive]pub struct CredentialStore { /* private fields */ }Expand description
Encrypted file-based credential storage.
Implementations§
Source§impl CredentialStore
impl CredentialStore
Sourcepub fn load(path: impl AsRef<Path>, key: [u8; 32]) -> Result<Self, StoreError>
pub fn load(path: impl AsRef<Path>, key: [u8; 32]) -> Result<Self, StoreError>
Load from an encrypted file. If the file doesn’t exist, returns an empty store.
Sourcepub fn save(&self) -> Result<(), StoreError>
pub fn save(&self) -> Result<(), StoreError>
Save the store to its encrypted file.
Sourcepub fn add(
&mut self,
name: impl Into<String>,
value: impl Into<String>,
domain: impl Into<String>,
header_name: impl Into<String>,
header_prefix: impl Into<String>,
)
pub fn add( &mut self, name: impl Into<String>, value: impl Into<String>, domain: impl Into<String>, header_name: impl Into<String>, header_prefix: impl Into<String>, )
Add a credential. Overwrites if name already exists.
Sourcepub fn list_names(&self) -> Vec<String>
pub fn list_names(&self) -> Vec<String>
List credential names (never exposes values).
Sourcepub fn build_injector(&self, cred_names: &[String]) -> CredentialInjector
pub fn build_injector(&self, cred_names: &[String]) -> CredentialInjector
Build a CredentialInjector with only the requested credentials.
Sourcepub fn secret_values(&self) -> Vec<Zeroizing<String>>
pub fn secret_values(&self) -> Vec<Zeroizing<String>>
Get all known secret values (for leak detection).
Returns Zeroizing<String> wrappers that automatically zero memory on drop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CredentialStore
impl RefUnwindSafe for CredentialStore
impl Send for CredentialStore
impl Sync for CredentialStore
impl Unpin for CredentialStore
impl UnsafeUnpin for CredentialStore
impl UnwindSafe for CredentialStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more