pub struct Vault<S = AgentClient> { /* private fields */ }Expand description
High-level lockbox helper that integrates open operations with a key cache.
Vault wraps a ContentKeyStore. Creating or opening a lockbox stores
the resulting content key in that store. open_lockbox then reopens the
lockbox from the cached key without requiring the original password or
contact private key.
Implementations§
Source§impl<S> Vault<S>where
S: ContentKeyStore,
impl<S> Vault<S>where
S: ContentKeyStore,
Sourcepub fn create_lockbox_with_password(
&self,
path: impl AsRef<Path>,
password: &SecureString,
) -> Result<Lockbox, Error>
pub fn create_lockbox_with_password( &self, path: impl AsRef<Path>, password: &SecureString, ) -> Result<Lockbox, Error>
Creates a password-protected lockbox and caches its content key.
Sourcepub fn open_lockbox_with_password(
&self,
path: impl AsRef<Path>,
password: &SecureString,
) -> Result<Lockbox, Error>
pub fn open_lockbox_with_password( &self, path: impl AsRef<Path>, password: &SecureString, ) -> Result<Lockbox, Error>
Opens a password-protected lockbox and caches its content key.
Sourcepub fn open_lockbox_with_password_for_duration(
&self,
path: impl AsRef<Path>,
password: &SecureString,
ttl_seconds: u64,
) -> Result<Lockbox, Error>
pub fn open_lockbox_with_password_for_duration( &self, path: impl AsRef<Path>, password: &SecureString, ttl_seconds: u64, ) -> Result<Lockbox, Error>
Opens a password-protected lockbox and caches its content key for the requested number of seconds.
Sourcepub fn cache_lockbox_password_for_duration(
&self,
path: impl AsRef<Path>,
password: &SecureString,
ttl_seconds: u64,
) -> Result<(), Error>
pub fn cache_lockbox_password_for_duration( &self, path: impl AsRef<Path>, password: &SecureString, ttl_seconds: u64, ) -> Result<(), Error>
Refreshes a password-protected lockbox’s cached content key for a requested number of seconds without reopening the lockbox payload.
Sourcepub fn create_lockbox(
&self,
path: impl AsRef<Path>,
protection: LockboxProtection<'_>,
) -> Result<Lockbox, Error>
pub fn create_lockbox( &self, path: impl AsRef<Path>, protection: LockboxProtection<'_>, ) -> Result<Lockbox, Error>
Creates a lockbox with the supplied protection mode.
Content-key and password modes cache the opened content key after the file is created. Contact-public-key mode creates the file but cannot cache a content key because no private material is available.
Sourcepub fn create_lockbox_with_signing_key(
&self,
path: impl AsRef<Path>,
protection: LockboxProtection<'_>,
signing_key: &OwnerSigningKeyPair,
) -> Result<Lockbox, Error>
pub fn create_lockbox_with_signing_key( &self, path: impl AsRef<Path>, protection: LockboxProtection<'_>, signing_key: &OwnerSigningKeyPair, ) -> Result<Lockbox, Error>
Creates a lockbox using an owner signing key loaded by the caller.
This variant lets interactive callers reuse an already-open encrypted
vault instead of requiring its passphrase to also be available through
process environment or platform secret-store state. Private signing
material remains owned by OwnerSigningKeyPair, whose serialized
private key is held in secure, zeroizing memory.
Sourcepub fn open_lockbox(&self, path: impl AsRef<Path>) -> Result<Lockbox, Error>
pub fn open_lockbox(&self, path: impl AsRef<Path>) -> Result<Lockbox, Error>
Opens a lockbox using only a content key already present in the store.
This fails if the key store has no cached key for the lockbox id.
Sourcepub fn open_lockbox_read_only(
&self,
path: impl AsRef<Path>,
) -> Result<Lockbox<ReadOnly>, Error>
pub fn open_lockbox_read_only( &self, path: impl AsRef<Path>, ) -> Result<Lockbox<ReadOnly>, Error>
Opens a cached lockbox for read-only metadata access without loading or requesting an owner-signing key.
Sourcepub fn open_lockbox_with(
&self,
path: impl AsRef<Path>,
open: LockboxOpen<'_>,
) -> Result<Lockbox, Error>
pub fn open_lockbox_with( &self, path: impl AsRef<Path>, open: LockboxOpen<'_>, ) -> Result<Lockbox, Error>
Opens a lockbox with explicit open material and caches its content key.
Password and contact-key-pair opens may fall back to a key-directory
backup stored in the default VaultDirectory when the embedded key
directory cannot be read. That fallback requires LOCKBOX_VAULT_PASSWORD
to be set so the default vault directory can be opened.
Sourcepub fn open_lockbox_with_signing_key(
&self,
path: impl AsRef<Path>,
open: LockboxOpen<'_>,
signing_key: &OwnerSigningKeyPair,
) -> Result<Lockbox, Error>
pub fn open_lockbox_with_signing_key( &self, path: impl AsRef<Path>, open: LockboxOpen<'_>, signing_key: &OwnerSigningKeyPair, ) -> Result<Lockbox, Error>
Opens a lockbox using explicit open material and an owner signing key loaded by the caller, then caches its content key.
Sourcepub fn open_lockbox_with_for_duration(
&self,
path: impl AsRef<Path>,
open: LockboxOpen<'_>,
ttl_seconds: u64,
) -> Result<Lockbox, Error>
pub fn open_lockbox_with_for_duration( &self, path: impl AsRef<Path>, open: LockboxOpen<'_>, ttl_seconds: u64, ) -> Result<Lockbox, Error>
Opens a lockbox with explicit open material and caches its content key for the requested number of seconds.
Sourcepub fn open_lockbox_with_for_duration_and_signing_key(
&self,
path: impl AsRef<Path>,
open: LockboxOpen<'_>,
ttl_seconds: u64,
signing_key: &OwnerSigningKeyPair,
) -> Result<Lockbox, Error>
pub fn open_lockbox_with_for_duration_and_signing_key( &self, path: impl AsRef<Path>, open: LockboxOpen<'_>, ttl_seconds: u64, signing_key: &OwnerSigningKeyPair, ) -> Result<Lockbox, Error>
Opens a lockbox for a requested duration using an owner signing key loaded by the caller.