Skip to main content

Vault

Struct Vault 

Source
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

Source

pub fn open_default(password: &SecretString) -> Result<Self>

Opens the default persistent store.

Source

pub fn open_or_create_default(password: &SecretString) -> Result<Self>

Opens or creates the default persistent store.

Source

pub fn create_file( path: impl AsRef<Path>, password: &SecretString, ) -> Result<Self>

Creates a new store at an explicit file path.

Source

pub fn open_file( path: impl AsRef<Path>, password: &SecretString, ) -> Result<Self>

Opens an existing store at an explicit file path.

Source

pub fn open_or_create( root: impl AsRef<Path>, password: &SecretString, ) -> Result<Self>

Opens or creates a store below root.

Source

pub fn replace(root: impl AsRef<Path>, password: &SecretString) -> Result<Self>

Replaces the store below root.

Source

pub fn probe_structure_version( root: impl AsRef<Path>, password: &SecretString, ) -> Result<u32>

Returns the structure version without opening the store for writes.

Source

pub fn root(&self) -> &Path

Returns the store’s containing directory.

Source

pub fn path(&self) -> &Path

Returns the encrypted store file path.

Source

pub fn structure_version(&self) -> Result<u32>

Returns the on-disk structure version.

Source

pub fn store_private_key(&self, name: &str, key: &ContactKeyPair) -> Result<()>

Stores a contact private key under a profile name.

Source

pub fn load_private_key(&self, name: &str) -> Result<ContactKeyPair>

Loads a contact private key for a profile.

Source

pub fn private_key_exists(&self, name: &str) -> Result<bool>

Reports whether a profile private key exists.

Source

pub fn list_private_keys(&self) -> Result<Vec<String>>

Lists profile names with private keys.

Source

pub fn delete_private_key(&self, name: &str) -> Result<()>

Deletes a profile private key and its metadata.

Source

pub fn store_profile_email(&self, name: &str, email: &str) -> Result<()>

Stores a profile’s non-secret email metadata.

Source

pub fn profile_email(&self, name: &str) -> Result<Option<String>>

Reads a profile’s email metadata.

Source

pub fn list_profile_generations(&self, name: &str) -> Result<ProfileHistory>

Lists profile key generations.

Source

pub fn rotate_private_key(&self, name: &str) -> Result<ProfileHistory>

Rotates a profile’s private key.

Source

pub fn load_profile_signing_key( &self, name: &str, ) -> Result<ProfileSigningKeyPair>

Loads the current profile signing identity.

Source

pub fn load_profile_signing_key_generation( &self, name: &str, index: u16, ) -> Result<ProfileSigningKeyPair>

Loads a historical profile signing identity.

Source

pub fn store_contact(&self, name: &str, key: &ContactPublicKey) -> Result<()>

Stores a contact’s public key.

Source

pub fn load_contact(&self, name: &str) -> Result<ContactPublicKey>

Loads a contact’s public key.

Source

pub fn contact_exists(&self, name: &str) -> Result<bool>

Reports whether a contact exists.

Source

pub fn delete_contact(&self, name: &str) -> Result<()>

Deletes a contact’s public key.

Source

pub fn list_contacts(&self) -> Result<Vec<StoredContact>>

Lists stored contacts.

Source

pub fn store_contact_signing_key( &self, name: &str, key: &ProfileSigningPublicKey, ) -> Result<()>

Stores a contact signing public key.

Source

pub fn load_contact_signing_key( &self, name: &str, ) -> Result<ProfileSigningPublicKey>

Loads a contact signing public key.

Trait Implementations§

Source§

impl Debug for Vault

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Vault

§

impl !RefUnwindSafe for Vault

§

impl !Sync for Vault

§

impl Send for Vault

§

impl Unpin for Vault

§

impl UnsafeUnpin for Vault

§

impl UnwindSafe for Vault

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more