pub struct HiddenStorage { /* private fields */ }Expand description
Encrypted storage with optional hidden volume.
Implementations§
Source§impl HiddenStorage
impl HiddenStorage
Sourcepub fn create(
path: &Path,
outer_password: &str,
hidden_password: Option<&str>,
total_size: u64,
hidden_ratio: f32,
params: Argon2Params,
) -> Result<Self>
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).
Sourcepub fn unlock_outer(&mut self, password: &str) -> Result<()>
pub fn unlock_outer(&mut self, password: &str) -> Result<()>
Unlock the outer volume.
Unlock the hidden volume.
Sourcepub fn unlock(&mut self, password: &str) -> Result<VolumeType>
pub fn unlock(&mut self, password: &str) -> Result<VolumeType>
Unlock whichever volume the password matches. Returns the type that was unlocked.
Sourcepub fn is_unlocked(&self) -> bool
pub fn is_unlocked(&self) -> bool
Returns true if any volume is unlocked.
Sourcepub fn active_volume(&self) -> Option<VolumeType>
pub fn active_volume(&self) -> Option<VolumeType>
The active volume type, if unlocked.
Returns true if the hidden volume is unlocked.
Sourcepub fn store_key(&self, record: &KeyRecord) -> Result<()>
pub fn store_key(&self, record: &KeyRecord) -> Result<()>
Store a key record in the active volume.
Sourcepub fn store_relay_config(&self, config: &RelayConfig) -> Result<()>
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.
Sourcepub fn get_relay_config(
&self,
group_pubkey: &[u8; 32],
) -> Result<Option<RelayConfig>>
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.
Sourcepub fn get_relay_config_or_default(
&self,
group_pubkey: &[u8; 32],
) -> Result<RelayConfig>
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.
Sourcepub fn audit_read_all(&self) -> Result<Vec<AuditEntry>>
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.
Sourcepub fn audit_export(&self) -> Result<String>
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.
Sourcepub fn audit_verify_chain(&self) -> Result<bool>
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).
Sourcepub fn audit_set_retention(&mut self, policy: RetentionPolicy)
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.
Sourcepub fn audit_apply_retention(&mut self) -> Result<usize>
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.