pub struct AgeVaultProvider { /* private fields */ }Implementations§
Source§impl AgeVaultProvider
impl AgeVaultProvider
Sourcepub fn new(
key_path: &Path,
vault_path: &Path,
) -> Result<AgeVaultProvider, AgeVaultError>
pub fn new( key_path: &Path, vault_path: &Path, ) -> Result<AgeVaultProvider, AgeVaultError>
Decrypt an age-encrypted JSON secrets file.
key_path — path to the age identity (private key) file.
vault_path — path to the age-encrypted JSON file.
§Errors
Returns AgeVaultError on key/vault read failure, parse error, or decryption failure.
Sourcepub fn load(
key_path: &Path,
vault_path: &Path,
) -> Result<AgeVaultProvider, AgeVaultError>
pub fn load( key_path: &Path, vault_path: &Path, ) -> Result<AgeVaultProvider, AgeVaultError>
Load vault from disk, storing paths for subsequent write operations.
§Errors
Returns AgeVaultError on key/vault read failure, parse error, or decryption failure.
Sourcepub fn save(&self) -> Result<(), AgeVaultError>
pub fn save(&self) -> Result<(), AgeVaultError>
Serialize and re-encrypt secrets to vault file using atomic write (temp + rename).
§Errors
Returns AgeVaultError on encryption or write failure.
Note: re-reads and re-parses the key file on each call. For CLI one-shot use this is acceptable; if used in a long-lived context consider caching the parsed identity.
Sourcepub fn set_secret_mut(&mut self, key: String, value: String)
pub fn set_secret_mut(&mut self, key: String, value: String)
Insert or update a secret in the in-memory map.
Sourcepub fn remove_secret_mut(&mut self, key: &str) -> bool
pub fn remove_secret_mut(&mut self, key: &str) -> bool
Remove a secret from the in-memory map. Returns true if the key existed.
Sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Look up a secret value by key, returning None if not present.
Sourcepub fn init_vault(dir: &Path) -> Result<(), AgeVaultError>
pub fn init_vault(dir: &Path) -> Result<(), AgeVaultError>
Generate a new x25519 keypair, write key file (mode 0600), and create an empty encrypted vault.
Outputs:
<dir>/vault-key.txt— age identity (private + public key comment)<dir>/secrets.age— age-encrypted empty JSON object
§Errors
Returns AgeVaultError on key/vault write failure or encryption failure.
Trait Implementations§
Source§impl Debug for AgeVaultProvider
impl Debug for AgeVaultProvider
Source§impl VaultProvider for AgeVaultProvider
impl VaultProvider for AgeVaultProvider
Auto Trait Implementations§
impl Freeze for AgeVaultProvider
impl RefUnwindSafe for AgeVaultProvider
impl Send for AgeVaultProvider
impl Sync for AgeVaultProvider
impl Unpin for AgeVaultProvider
impl UnsafeUnpin for AgeVaultProvider
impl UnwindSafe for AgeVaultProvider
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request