pub struct FileStore<L = TenantLayout> { /* private fields */ }Expand description
A SecretStore kept in one file.
See the module documentation for what protects the values in it and what does not — the short answer is the current OS identity plus native owner-only filesystem controls, and nothing cryptographic.
Implementations§
Source§impl FileStore
impl FileStore
Sourcepub fn open(path: impl Into<PathBuf>) -> Result<FileStore, StoreError>
pub fn open(path: impl Into<PathBuf>) -> Result<FileStore, StoreError>
Open — or create — the store at path, using the blessed TenantLayout.
On Unix the containing directory is created at 0700 and the file at 0600. On Windows
both are created for the process TokenUser SID with a protected DACL allowing only that
SID. Existing state with a foreign owner, wider access, a link/reparse point, the wrong kind
or uninspectable metadata is refused, never tightened or repaired: it may already have
exposed values, and changing it silently would hide that evidence.
§Errors
StoreError::Unreachable for an IO or security-inspection failure,
StoreError::Denied for native protection this store will not use, and
StoreError::Backend for a file it cannot parse. Every one names the filesystem path and
none carries a value.
Source§impl<L> FileStore<L>where
L: Layout,
impl<L> FileStore<L>where
L: Layout,
Sourcepub fn open_with_layout(
path: impl Into<PathBuf>,
layout: L,
) -> Result<FileStore<L>, StoreError>
pub fn open_with_layout( path: impl Into<PathBuf>, layout: L, ) -> Result<FileStore<L>, StoreError>
Open — or create — the store at path, rendering addresses through layout.
§Errors
As FileStore::open.
Sourcepub fn stale_temporaries(&self) -> Vec<PathBuf>
pub fn stale_temporaries(&self) -> Vec<PathBuf>
Every unfinished temporary sitting beside this store, in no particular order.
Public so the reaping above is observable rather than merely asserted — a test can plant one, see it listed, open the store and see the list empty.
Sourcepub fn address(&self, reference: &CredentialRef) -> String
pub fn address(&self, reference: &CredentialRef) -> String
The path reference resolves to under this store’s layout.
The address, not the file — the same question MemoryStore::path
answers.
Sourcepub fn reference(&self, path: &str) -> Result<CredentialRef, StoreError>
pub fn reference(&self, path: &str) -> Result<CredentialRef, StoreError>
The address a rendered path resolves back to — the inverse of address.
§Errors
StoreError::Layout, carrying the layout’s own explanation, when the path is not one this
layout writes.
Trait Implementations§
Source§impl<L> Debug for FileStore<L>
Path and entry count. Never a value, and never an address — a derived Debug would print
every key, and C-159 is this repository’s precedent for a derived rendering becoming the leak.
impl<L> Debug for FileStore<L>
Path and entry count. Never a value, and never an address — a derived Debug would print
every key, and C-159 is this repository’s precedent for a derived rendering becoming the leak.
Source§impl<L> PreparedSecretStore for FileStore<L>
impl<L> PreparedSecretStore for FileStore<L>
fn prepare<'life0, 'life1, 'async_trait>(
&'life0 self,
id: SecretTransactionId,
digest: SecretProposalDigest,
mutations: &'life1 SecretBatch,
) -> Pin<Box<dyn Future<Output = Result<SecretTransactionState, PreparedSecretError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
fn state<'life0, 'async_trait>(
&'life0 self,
id: SecretTransactionId,
) -> Pin<Box<dyn Future<Output = Result<SecretTransactionState, PreparedSecretError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileStore<L>: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 self,
id: SecretTransactionId,
) -> Pin<Box<dyn Future<Output = Result<SecretTransactionState, PreparedSecretError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileStore<L>: 'async_trait,
fn abort<'life0, 'async_trait>(
&'life0 self,
id: SecretTransactionId,
) -> Pin<Box<dyn Future<Output = Result<SecretTransactionState, PreparedSecretError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileStore<L>: 'async_trait,
fn reclaim<'life0, 'async_trait>(
&'life0 self,
through: SecretTransactionGeneration,
) -> Pin<Box<dyn Future<Output = Result<(), PreparedSecretError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileStore<L>: 'async_trait,
Source§impl<L> SecretStore for FileStore<L>
impl<L> SecretStore for FileStore<L>
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
reference: &'life1 CredentialRef,
) -> Pin<Box<dyn Future<Output = Result<Secret, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
reference: &'life1 CredentialRef,
) -> Pin<Box<dyn Future<Output = Result<Secret, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
reference. Read moreSource§fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
reference: &'life1 CredentialRef,
secret: &'life2 Secret,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
FileStore<L>: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
reference: &'life1 CredentialRef,
secret: &'life2 Secret,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
FileStore<L>: 'async_trait,
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
reference: &'life1 CredentialRef,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
reference: &'life1 CredentialRef,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
reference. Read moreSource§fn references<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 CredentialScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<CredentialRef>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
fn references<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 CredentialScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<CredentialRef>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
scope, never their values. Read moreSource§fn apply<'life0, 'life1, 'async_trait>(
&'life0 self,
mutations: &'life1 SecretBatch,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
fn apply<'life0, 'life1, 'async_trait>(
&'life0 self,
mutations: &'life1 SecretBatch,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
FileStore<L>: 'async_trait,
batch atomically, or expose none of them.