pub struct CredentialStore { /* private fields */ }Expand description
Credential storage with encryption at rest.
Uses AES-256-GCM for authenticated encryption.
Implementations§
Source§impl CredentialStore
impl CredentialStore
Sourcepub fn new(encryption_key: [u8; 32], store_path: PathBuf) -> Self
pub fn new(encryption_key: [u8; 32], store_path: PathBuf) -> Self
Create a new credential store.
§Arguments
encryption_key- 32-byte encryption key (derive from master password with Argon2)store_path- Directory to store encrypted credentials
Sourcepub fn store(
&self,
name: &str,
credential: &ApiKey,
) -> Result<(), CredentialError>
pub fn store( &self, name: &str, credential: &ApiKey, ) -> Result<(), CredentialError>
Store an encrypted credential.
The credential is encrypted with AES-256-GCM and written to disk with restrictive permissions (0600 on Unix).
§Errors
Returns error if encryption or file write fails.
Sourcepub fn load(&self, name: &str) -> Result<ApiKey, CredentialError>
pub fn load(&self, name: &str) -> Result<ApiKey, CredentialError>
Load and decrypt a credential.
§Errors
Returns error if file not found, decryption fails, or invalid UTF-8.
Auto Trait Implementations§
impl Freeze for CredentialStore
impl RefUnwindSafe for CredentialStore
impl Send for CredentialStore
impl Sync for CredentialStore
impl Unpin 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