Skip to main content

HiddenStorage

Struct HiddenStorage 

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

Encrypted storage with optional hidden volume.

Implementations§

Source§

impl HiddenStorage

Source

pub fn create( path: &Path, outer_password: &str, hidden_password: Option<&str>, total_size: u64, hidden_ratio: f32, params: Argon2Params, ) -> Result<Self>

Create a new hidden storage vault.

hidden_ratio is the fraction of space for the hidden volume (0.0-1.0).

Source

pub fn open(path: &Path) -> Result<Self>

Open an existing hidden storage vault.

Source

pub fn unlock_outer(&mut self, password: &str) -> Result<()>

Unlock the outer volume.

Source

pub fn unlock_hidden(&mut self, password: &str) -> Result<()>

Unlock the hidden volume.

Source

pub fn unlock(&mut self, password: &str) -> Result<VolumeType>

Unlock whichever volume the password matches. Returns the type that was unlocked.

Source

pub fn lock(&mut self)

Lock and zeroize all keys.

Source

pub fn is_unlocked(&self) -> bool

Returns true if any volume is unlocked.

Source

pub fn data_key(&self) -> Option<&SecretKey>

The data encryption key for the active volume.

Source

pub fn active_volume(&self) -> Option<VolumeType>

The active volume type, if unlocked.

Source

pub fn is_hidden_unlocked(&self) -> bool

Returns true if the hidden volume is unlocked.

Source

pub fn store_key(&self, record: &KeyRecord) -> Result<()>

Store a key record in the active volume.

Source

pub fn list_keys(&self) -> Result<Vec<KeyRecord>>

List all keys in the active volume.

Source

pub fn delete_key(&self, id: &[u8; 32]) -> Result<()>

Delete a key from the active volume.

Source

pub fn store_relay_config(&self, config: &RelayConfig) -> Result<()>

Persist a relay configuration on the outer volume.

Only the outer volume is currently supported; hidden-volume relay-config storage is a documented follow-up so the headless NIP-46 bunker on the outer side can load pre-grants without leaking the existence of a hidden volume into the relay layer.

Source

pub fn get_relay_config( &self, group_pubkey: &[u8; 32], ) -> Result<Option<RelayConfig>>

Load a relay configuration from the outer volume.

Hidden volume callers get Ok(None) so a hidden-vault headless bunker degrades cleanly to the interactive-approval path until hidden-volume relay-config storage is implemented.

Source

pub fn get_relay_config_or_default( &self, group_pubkey: &[u8; 32], ) -> Result<RelayConfig>

Load a relay configuration or return a fresh default for group_pubkey.

Source

pub fn path(&self) -> &Path

The vault directory path.

Source

pub fn audit_read_all(&self) -> Result<Vec<AuditEntry>>

Read every audit entry stored under the outer data key. Hidden-vault scope is deliberately limited to the outer volume (#520, paralleling the #507 relay-config decision); a hidden-active session has no audit log of its own and returns Ok(vec![]) rather than reading the outer log’s contents.

Source

pub fn audit_export(&self) -> Result<String>

Export the outer-volume audit log as JSON. Hidden-active sessions return an empty array rather than the outer log’s contents, matching the deniability boundary audit_read_all enforces.

Source

pub fn audit_verify_chain(&self) -> Result<bool>

Verify the outer-volume audit log’s hash chain. Hidden-active sessions have no log of their own and return Ok(true) (vacuously valid).

Source

pub fn audit_set_retention(&mut self, policy: RetentionPolicy)

Set the retention policy on the outer-volume audit log. No-op when the active volume is hidden.

Source

pub fn audit_apply_retention(&mut self) -> Result<usize>

Apply the retention policy on the outer-volume audit log. Errors on hidden-active sessions since no audit log exists there.

Trait Implementations§

Source§

impl Drop for HiddenStorage

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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