Crate paranoid_vault

crate paranoid_vault

Functions

fn default_vault_path() -> PathBuf
fn read_master_password(env_name: &str) -> Result<String, VaultError>
fn set_clipboard_text_excluded(clipboard: &mut Clipboard, text: &str) -> Result<(), arboard::Error>

Sets text on the system clipboard with the platform’s clipboard-history exclusion hint applied, in addition to (not instead of) the plain text content itself — a history manager that does not recognize the hint still sees ordinary text, it simply has no opt-out signal to honor.

This is the hardened replacement for Clipboard::set_text; every copy-to-clipboard call site that places a secret (password, mnemonic phrase, card number, etc.) should call this instead. Clearing the clipboard back to empty does not need the exclusion hint (there is no secret left to exclude), so clear_clipboard_if_matches call sites are unaffected.

fn unlock_vault_for_options(options: &VaultOpenOptions) -> Result<UnlockedVault, VaultError>

Enums

enum VaultAuth
PasswordEnv(String)
Password(SecretString)
Certificate
cert_path: PathBuf
key_path: PathBuf
key_passphrase_env: Option<String>
key_passphrase: Option<SecretString>
enum VaultError
InvalidArguments(String)
VaultExists(String)
VaultNotFound(String)
UnlockFailed
LockedOut
retry_after_secs: i64
ItemNotFound(String)
ExportPathCollision(String)
RandomFailure(String)
CryptoFailure(String)
CertificateFailure(String)
DeviceStoreFailure(String)
Sqlite(rusqlite::Error)
Io(std::io::Error)
Json(serde_json::Error)
Argon2(String)
Generator(String)
enum VaultItemKind
Login
SecureNote
Card
Identity

Implementations

impl VaultItemKind

Functions

fn as_str(&self) -> &'static str
fn parse(value: &str) -> Result<Self, VaultError>
enum VaultItemPayload
Login(LoginRecord)
SecureNote(SecureNoteRecord)
Card(CardRecord)
Identity(IdentityRecord)

Structs and Unions

struct CardRecord
title: String
cardholder_name: String
number: SecretBytes
expiry_month: String
expiry_year: String
security_code: SecretBytes
billing_zip: Option<String>
notes: Option<String>
folder: Option<String>
tags: Vec<String>
struct GenerateStoreLoginRecord
target_login_id: Option<String>
title: Option<String>
username: Option<String>
url: Option<String>
notes: Option<String>
folder: Option<String>
tags: Option<Vec<String>>
struct IdentityRecord
title: String
full_name: String
email: Option<String>
phone: Option<String>
address: Option<String>
notes: Option<String>
folder: Option<String>
tags: Vec<String>
struct LoginRecord
title: String
username: String
password: SecretBytes
url: Option<String>
notes: Option<String>
folder: Option<String>
tags: Vec<String>
password_history: Vec<PasswordHistoryEntry>
struct NativeSessionHardening

Implementations

impl NativeSessionHardening

Functions

fn arm_clipboard_clear(&mut self, contents: String)
fn clear_clipboard_tracking(&mut self)
fn clipboard_clear_after(&self) -> Duration
fn expire_activity_for_test(&mut self)
fn expire_clipboard_for_test(&mut self)
fn idle_lock_after(&self) -> Duration
fn note_activity(&mut self)
fn should_auto_lock(&self) -> bool
fn take_due_clipboard_contents(&mut self) -> Option<SecretString>
fn take_pending_clipboard_contents(&mut self) -> Option<SecretString>
fn with_timeouts(clipboard_clear_after: Duration, idle_lock_after: Duration) -> Self

Traits implemented

impl Default for NativeSessionHardening
struct NewCardRecord
title: String
cardholder_name: String
number: SecretBytes
expiry_month: String
expiry_year: String
security_code: SecretBytes
billing_zip: Option<String>
notes: Option<String>
folder: Option<String>
tags: Vec<String>
struct NewIdentityRecord
title: String
full_name: String
email: Option<String>
phone: Option<String>
address: Option<String>
notes: Option<String>
folder: Option<String>
tags: Vec<String>
struct NewLoginRecord
title: String
username: String
password: SecretBytes
url: Option<String>
notes: Option<String>
folder: Option<String>
tags: Vec<String>
struct NewSecureNoteRecord
title: String
content: SecretBytes
folder: Option<String>
tags: Vec<String>
struct PasswordHistoryEntry
password: SecretBytes
changed_at_epoch: i64
struct SecretBytes(Zeroizing<String>)

A zeroize-on-drop wrapper for decrypted vault-item payload secrets (login passwords, password-history entries, card numbers, and card security codes).

This exists separately from SecretString because payload secrets are stored in #[derive(Clone, Serialize, Deserialize)] record structs (LoginRecord, CardRecord, PasswordHistoryEntry, and their New*/Update* mirrors) that round-trip through serde_json as part of the encrypted vault item blob. SecretString intentionally has no serde impl (it only ever lives in ephemeral, never-persisted TUI form state), so SecretBytes adds a transparent Serialize/Deserialize — it serializes to exactly the JSON a plain String would produce, and deserializes from exactly that shape, so the on-disk/wire format of a vault item is byte-for-byte unchanged by this wrapper.

Every clone is an independent Zeroizing<String>: dropping any one of them scrubs that copy’s bytes, so .clone() no longer forks an un-scrubbed heap copy of the secret the way a plain String did.

Drop is handled entirely by the inner Zeroizing<String> (its own Drop impl zeroizes the buffer in place before deallocating), so SecretBytes needs no Drop/ZeroizeOnDrop impl of its own — the workspace zeroize dependency does not enable the derive feature, so this deliberately leans on Zeroizing’s built-in guarantee rather than adding a new derive macro dependency.

Implementations

impl SecretBytes

Functions

fn as_str(&self) -> &str
fn into_inner(self) -> String
fn is_empty(&self) -> bool
fn new(value: impl Into<String>) -> Self

Traits implemented

impl From<String> for SecretBytes
impl From<&str> for SecretBytes
impl PartialEq for SecretBytes
impl Eq for SecretBytes
impl PartialEq<str> for SecretBytes
impl PartialEq<&str> for SecretBytes
impl PartialEq<String> for SecretBytes
impl fmt::Debug for SecretBytes
impl Serialize for SecretBytes
impl<'de> Deserialize<'de> for SecretBytes
struct SecretString(Zeroizing<String>)

Implementations

impl SecretString

Functions

fn as_str(&self) -> &str
fn clear(&mut self)
fn is_empty(&self) -> bool
fn new(value: String) -> Self
fn pop(&mut self) -> Option<char>
fn push(&mut self, ch: char)

Traits implemented

impl PartialEq for SecretString
impl Eq for SecretString
impl fmt::Debug for SecretString
struct SecureNoteRecord
title: String
content: SecretBytes
folder: Option<String>
tags: Vec<String>
struct UpdateCardRecord
title: Option<String>
cardholder_name: Option<String>
number: Option<SecretBytes>
expiry_month: Option<String>
expiry_year: Option<String>
security_code: Option<SecretBytes>
billing_zip: Option<Option<String>>
notes: Option<Option<String>>
folder: Option<Option<String>>
tags: Option<Vec<String>>
struct UpdateIdentityRecord
title: Option<String>
full_name: Option<String>
email: Option<Option<String>>
phone: Option<Option<String>>
address: Option<Option<String>>
notes: Option<Option<String>>
folder: Option<Option<String>>
tags: Option<Vec<String>>
struct UpdateLoginRecord
title: Option<String>
username: Option<String>
password: Option<SecretBytes>
url: Option<Option<String>>
notes: Option<Option<String>>
folder: Option<Option<String>>
tags: Option<Vec<String>>
struct UpdateSecureNoteRecord
title: Option<String>
content: Option<SecretBytes>
folder: Option<Option<String>>
tags: Option<Vec<String>>
struct VaultHeader
format_version: u32
created_at_epoch: i64
migration_state: String
kdf: VaultKdfParams
keyslots: Vec<VaultKeyslot>

Implementations

impl VaultHeader

Functions

fn assess_keyslot_health(&self, id: &str) -> Result<VaultKeyslotHealth, VaultError>
fn assess_keyslot_health_with_provider_probe(&self, id: &str, provider_probe: VaultKeyslotProviderProbe) -> Result<VaultKeyslotHealth, VaultError>
fn assess_keyslot_removal(&self, id: &str) -> Result<VaultKeyslotRemovalImpact, VaultError>
fn keyslot_health_summaries(&self) -> Vec<VaultKeyslotHealth>
fn keyslot_health_summaries_with_provider_probe(&self, provider_probe: VaultKeyslotProviderProbe) -> Vec<VaultKeyslotHealth>
fn recovery_posture(&self) -> VaultRecoveryPosture
fn recovery_recommendations(&self) -> Vec<String>
fn seal_posture(&self, provider_probe: VaultKeyslotProviderProbe) -> VaultSealPosture

Derives the vault’s seal posture (paranoid-seal state plus per-keyslot provider evidence) directly from header/keyslot data, usable without unlocking the vault. This is the single production posture-derivation site; all callers (CLI, TUI, capability detection) go through this or through seal_posture_for_path.

struct VaultItem
id: String
kind: VaultItemKind
created_at_epoch: i64
updated_at_epoch: i64
payload: VaultItemPayload
struct VaultItemFilter
query: Option<String>
kind: Option<VaultItemKind>
folder: Option<String>
tag: Option<String>

Implementations

impl VaultItemFilter
struct VaultItemSummary
id: String
kind: VaultItemKind
title: String
subtitle: String
location: Option<String>
folder: Option<String>
updated_at_epoch: i64
duplicate_password_count: usize
struct VaultOpenOptions
path: PathBuf
auth: VaultAuth
mnemonic_phrase_env: Option<String>
mnemonic_phrase: Option<SecretString>
mnemonic_slot: Option<String>
device_slot: Option<String>
use_device_auto: bool

Implementations

impl VaultOpenOptions

Functions

fn password_env(&self) -> &str
fn unlock_description(&self) -> String