struct FileBackend {
path: PathBuf,
key_bytes: [u8; 32],
map: BTreeMap<String, StoredSecret>,
loaded: bool,
}Expand description
Passphrase-encrypted file-based fallback for environments where the OS keychain is unavailable.
Secrets are stored in ${path}/secrets.enc as an AES-256-GCM blob whose
key is derived from passphrase via Argon2id. The entire map is
re-encrypted on every set / delete.
This backend is not exposed directly; callers use
FileBackendWithPassphrase which stores the passphrase securely and
implements the full KeychainBackend trait.
Fields§
§path: PathBufDirectory where secrets.enc lives.
key_bytes: [u8; 32]Argon2id-derived 32-byte AES-256-GCM key (zero-salt placeholder, overridden on load from the real per-file salt).
map: BTreeMap<String, StoredSecret>In-memory mirror of the decrypted map; populated lazily.
loaded: boolTrue after the file has been loaded (or determined to not exist).
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileBackend
impl RefUnwindSafe for FileBackend
impl Send for FileBackend
impl Sync for FileBackend
impl Unpin for FileBackend
impl UnsafeUnpin for FileBackend
impl UnwindSafe for FileBackend
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.