Skip to main content

VaultDirectory

Struct VaultDirectory 

Source
pub struct VaultDirectory { /* private fields */ }
Expand description

Password-protected local vault file for native reVault metadata.

A VaultDirectory stores its data in local-vault.lbox under a private directory. It can hold contact private keys, contact public keys, and key-directory backups used by Vault recovery fallback paths.

Implementations§

Source§

impl VaultDirectory

Source

pub const DEFAULT_KEY_NAME: &'static str = "default"

Default name used for the primary local contact key.

Source

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

Reads the stable vault structure discriminator without interpreting version-specific records. Migration orchestration uses this to choose a historical exporter before opening the source through VaultDirectory.

Source

pub fn open_or_create_default( password: &SecureString, ) -> Result<VaultDirectory, Error>

Opens or creates the default vault directory using password.

The directory is chosen by default_vault_dir.

Source

pub fn replace_default(password: &SecureString) -> Result<VaultDirectory, Error>

Replaces the default vault directory using password.

The replacement is coordinated with the same interprocess lock used for vault backups and record writes.

Source

pub fn change_default_password( old_password: &SecureString, new_password: &SecureString, ) -> Result<(), Error>

Changes the pass phrase for the default vault directory.

Source

pub fn change_password( root: impl AsRef<Path>, old_password: &SecureString, new_password: &SecureString, ) -> Result<(), Error>

Changes the pass phrase for a vault directory.

Source

pub fn replace( root: impl AsRef<Path>, password: &SecureString, ) -> Result<VaultDirectory, Error>

Replaces the vault directory at root using password.

Source

pub fn open_or_create( root: impl AsRef<Path>, password: &SecureString, ) -> Result<VaultDirectory, Error>

Opens or creates a vault directory at root.

The vault file is protected with password. When a new vault file is created, private file permissions are applied on supported platforms.

Source

pub fn root(&self) -> &Path

Returns the root directory that contains the local vault file.

Source

pub fn path(&self) -> &Path

Returns the path to the local-vault.lbox file.

Source

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

Returns the structure version recorded inside this vault.

Source

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

Stores a contact private key under name.

Names must contain only ASCII letters, digits, -, or _.

Source

pub fn restore_private_key( &self, name: &str, keypair: &ContactKeyPair, signing_key: Option<&OwnerSigningKeyPair>, overwrite: bool, ) -> Result<(), Error>

Restores a profile private key and optional owner signing key.

When overwrite is true, any existing profile with the same name is removed first so current keys, signing keys, and generation history stay consistent with the restored material.

Source

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

Loads a contact private key previously stored under name.

Source

pub fn load_owner_signing_key( &self, name: &str, ) -> Result<OwnerSigningKeyPair, Error>

Loads the owner signing key associated with a vault profile.

Older vault profiles did not have a separate signing key. The first load lazily creates one so future lockbox commits can be signed without deriving signing material from the lockbox content key.

Source

pub fn load_owner_signing_key_cached( &self, name: &str, ) -> Result<OwnerSigningKeyPair, Error>

Loads one owner-signing key using the enabled session-agent cache when available, then refreshes that cache after the normal vault load.

Source

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

Returns whether a private key exists under name.

Source

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

Lists private-key names stored in this vault.

Source

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

Deletes the private key stored under name, if present.

Source

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

Stores the public email address associated with a vault profile.

Source

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

Loads the public email address associated with a vault profile.

Source

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

Lists profile generations for a private key, creating generation one for existing pre-history profiles.

Source

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

Rotates a vault profile to a new active key generation.

Source

pub fn load_private_key_generation( &self, name: &str, index: u16, ) -> Result<ContactKeyPair, Error>

Loads one profile generation by index.

Source

pub fn load_owner_signing_key_generation( &self, name: &str, index: u16, ) -> Result<OwnerSigningKeyPair, Error>

Loads one owner signing-key generation by index.

Source

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

Stores a contact public key under name.

Names must contain only ASCII letters, digits, -, or _.

Source

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

Stores the contact signing public key associated with a contact.

Source

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

Loads a contact public key by name.

Source

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

Loads the contact signing public key associated with a contact.

Source

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

Returns whether a contact exists under name.

Source

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

Deletes the contact stored under name, if present.

Source

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

Lists contacts stored in this vault.

Source

pub fn store_key_directory_backup( &self, lockbox_id: LockboxId, key_directory: &[u8], ) -> Result<(), Error>

Stores an exported key-directory backup for lockbox_id.

Backups can be used by Vault to recover openability when the embedded key directory in a lockbox file is damaged.

Source

pub fn load_key_directory_backup( &self, lockbox_id: LockboxId, ) -> Result<Vec<u8>, Error>

Loads the key-directory backup for lockbox_id.

Source

pub fn key_directory_backup_count(&self) -> Result<usize, Error>

Counts key-directory backups stored in this vault.

Source

pub fn remember_known_lockbox( &self, lockbox_id: LockboxId, path: impl AsRef<Path>, ) -> Result<(), Error>

Remembers a lockbox path for diagnostics and future bulk access refresh.

Source

pub fn list_known_lockboxes(&self) -> Result<Vec<KnownLockbox>, Error>

Lists lockboxes remembered by the local vault.

Source

pub fn forget_known_lockbox(&self, path: impl AsRef<Path>) -> Result<(), Error>

Removes one remembered lockbox path. The lockbox file itself is not deleted or modified.

Source

pub fn remember_access_slot_label( &self, lockbox_id: LockboxId, slot_id: u64, name: impl Into<String>, ) -> Result<(), Error>

Remember a local name for one lockbox access slot.

This mapping is stored only inside the encrypted local vault. It is not written to the shared lockbox, so it does not disclose contacts to third parties who inspect the lockbox file.

Source

pub fn list_access_slot_labels( &self, lockbox_id: LockboxId, ) -> Result<Vec<AccessSlotLabel>, Error>

Lists local access-slot labels remembered for one lockbox.

Source

pub fn find_access_slot_labels( &self, lockbox_id: LockboxId, name: &str, ) -> Result<Vec<AccessSlotLabel>, Error>

Finds local slot labels for name in one lockbox.

Source

pub fn forget_access_slot_label( &self, lockbox_id: LockboxId, slot_id: u64, ) -> Result<(), Error>

Forget one local access-slot label.

Source

pub fn define_form( &self, alias: &str, name: &str, fields: Vec<FormFieldDefinition>, ) -> Result<FormDefinition, Error>

Creates or revises a reusable form definition stored in the vault.

Source

pub fn define_form_with_description( &self, alias: &str, name: &str, description: &str, fields: Vec<FormFieldDefinition>, ) -> Result<FormDefinition, Error>

Creates or revises a reusable form definition stored in the vault.

Source

pub fn define_form_with_type_id( &self, type_id: FormTypeId, alias: &str, name: &str, fields: Vec<FormFieldDefinition>, ) -> Result<FormDefinition, Error>

Creates or revises a reusable form definition with a stable definition id.

Source

pub fn define_form_with_type_id_and_description( &self, type_id: FormTypeId, alias: &str, name: &str, description: &str, fields: Vec<FormFieldDefinition>, ) -> Result<FormDefinition, Error>

Creates or revises a reusable form definition with a stable definition id.

Source

pub fn import_form_definition( &self, definition: FormDefinition, ) -> Result<FormDefinition, Error>

Imports an exact reusable form definition into the vault.

Source

pub fn resolve_form_definition( &self, reference: &str, ) -> Result<FormDefinition, Error>

Resolves a reusable vault form definition by alias or definition id.

Source

pub fn list_form_definitions(&self) -> Result<Vec<FormDefinition>, Error>

Lists reusable form definitions stored in the vault.

Source

pub fn list_form_definition_revisions( &self, type_id: &FormTypeId, ) -> Result<Vec<FormDefinition>, Error>

Lists every stored revision of one reusable form definition.

Source

pub fn seed_default_form_definitions(&self) -> Result<usize, Error>

Adds built-in form definitions that are not already present.

Source

pub fn remember_lockbox_password( &self, lockbox_id: LockboxId, password: &SecureString, ) -> Result<(), Error>

Stores a lockbox pass phrase in the vault, keyed by lockbox id.

Source

pub fn remembered_lockbox_password( &self, lockbox_id: LockboxId, ) -> Result<Option<SecureString>, Error>

Loads a remembered lockbox pass phrase, if one exists for this lockbox id.

Trait Implementations§

Source§

impl Debug for VaultDirectory

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = Infallible

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