pub struct Vault(/* private fields */);Expand description
Persistent encrypted local store for profiles, keys, contacts, and remembered lockbox metadata.
The implementation handle is private: callers see the reviewed
Vault name and cannot depend on the core storage type.
Implementations§
Source§impl Vault
impl Vault
Sourcepub fn open_default(password: &SecretString) -> Result<Self>
pub fn open_default(password: &SecretString) -> Result<Self>
Opens the default persistent store.
Sourcepub fn open_or_create_default(password: &SecretString) -> Result<Self>
pub fn open_or_create_default(password: &SecretString) -> Result<Self>
Opens or creates the default persistent store.
Sourcepub fn create_file(
path: impl AsRef<Path>,
password: &SecretString,
) -> Result<Self>
pub fn create_file( path: impl AsRef<Path>, password: &SecretString, ) -> Result<Self>
Creates a new store at an explicit file path.
Sourcepub fn open_file(
path: impl AsRef<Path>,
password: &SecretString,
) -> Result<Self>
pub fn open_file( path: impl AsRef<Path>, password: &SecretString, ) -> Result<Self>
Opens an existing store at an explicit file path.
Sourcepub fn open_or_create(
root: impl AsRef<Path>,
password: &SecretString,
) -> Result<Self>
pub fn open_or_create( root: impl AsRef<Path>, password: &SecretString, ) -> Result<Self>
Opens or creates a store below root.
Sourcepub fn replace(root: impl AsRef<Path>, password: &SecretString) -> Result<Self>
pub fn replace(root: impl AsRef<Path>, password: &SecretString) -> Result<Self>
Replaces the store below root.
Sourcepub fn probe_structure_version(
root: impl AsRef<Path>,
password: &SecretString,
) -> Result<u32>
pub fn probe_structure_version( root: impl AsRef<Path>, password: &SecretString, ) -> Result<u32>
Returns the structure version without opening the store for writes.
Sourcepub fn structure_version(&self) -> Result<u32>
pub fn structure_version(&self) -> Result<u32>
Returns the on-disk structure version.
Sourcepub fn store_private_key(&self, name: &str, key: &ContactKeyPair) -> Result<()>
pub fn store_private_key(&self, name: &str, key: &ContactKeyPair) -> Result<()>
Stores a contact private key under a profile name.
Sourcepub fn load_private_key(&self, name: &str) -> Result<ContactKeyPair>
pub fn load_private_key(&self, name: &str) -> Result<ContactKeyPair>
Loads a contact private key for a profile.
Sourcepub fn private_key_exists(&self, name: &str) -> Result<bool>
pub fn private_key_exists(&self, name: &str) -> Result<bool>
Reports whether a profile private key exists.
Sourcepub fn list_private_keys(&self) -> Result<Vec<String>>
pub fn list_private_keys(&self) -> Result<Vec<String>>
Lists profile names with private keys.
Sourcepub fn delete_private_key(&self, name: &str) -> Result<()>
pub fn delete_private_key(&self, name: &str) -> Result<()>
Deletes a profile private key and its metadata.
Sourcepub fn store_profile_email(&self, name: &str, email: &str) -> Result<()>
pub fn store_profile_email(&self, name: &str, email: &str) -> Result<()>
Stores a profile’s non-secret email metadata.
Sourcepub fn profile_email(&self, name: &str) -> Result<Option<String>>
pub fn profile_email(&self, name: &str) -> Result<Option<String>>
Reads a profile’s email metadata.
Sourcepub fn list_profile_generations(&self, name: &str) -> Result<ProfileHistory>
pub fn list_profile_generations(&self, name: &str) -> Result<ProfileHistory>
Lists profile key generations.
Sourcepub fn rotate_private_key(&self, name: &str) -> Result<ProfileHistory>
pub fn rotate_private_key(&self, name: &str) -> Result<ProfileHistory>
Rotates a profile’s private key.
Sourcepub fn load_profile_signing_key(
&self,
name: &str,
) -> Result<ProfileSigningKeyPair>
pub fn load_profile_signing_key( &self, name: &str, ) -> Result<ProfileSigningKeyPair>
Loads the current profile signing identity.
Sourcepub fn load_profile_signing_key_generation(
&self,
name: &str,
index: u16,
) -> Result<ProfileSigningKeyPair>
pub fn load_profile_signing_key_generation( &self, name: &str, index: u16, ) -> Result<ProfileSigningKeyPair>
Loads a historical profile signing identity.
Sourcepub fn store_contact(&self, name: &str, key: &ContactPublicKey) -> Result<()>
pub fn store_contact(&self, name: &str, key: &ContactPublicKey) -> Result<()>
Stores a contact’s public key.
Sourcepub fn load_contact(&self, name: &str) -> Result<ContactPublicKey>
pub fn load_contact(&self, name: &str) -> Result<ContactPublicKey>
Loads a contact’s public key.
Sourcepub fn contact_exists(&self, name: &str) -> Result<bool>
pub fn contact_exists(&self, name: &str) -> Result<bool>
Reports whether a contact exists.
Sourcepub fn delete_contact(&self, name: &str) -> Result<()>
pub fn delete_contact(&self, name: &str) -> Result<()>
Deletes a contact’s public key.
Sourcepub fn list_contacts(&self) -> Result<Vec<StoredContact>>
pub fn list_contacts(&self) -> Result<Vec<StoredContact>>
Lists stored contacts.
Sourcepub fn store_contact_signing_key(
&self,
name: &str,
key: &ProfileSigningPublicKey,
) -> Result<()>
pub fn store_contact_signing_key( &self, name: &str, key: &ProfileSigningPublicKey, ) -> Result<()>
Stores a contact signing public key.
Sourcepub fn load_contact_signing_key(
&self,
name: &str,
) -> Result<ProfileSigningPublicKey>
pub fn load_contact_signing_key( &self, name: &str, ) -> Result<ProfileSigningPublicKey>
Loads a contact signing public key.