Skip to main content

Vault

Trait Vault 

Source
pub trait Vault {
    // Required methods
    fn precheck(&self) -> Result<()>;
    fn fetch(&self, item: &str) -> Result<Vec<u8>>;
    fn store(&self, item: &str, content: &[u8], force: bool) -> Result<()>;
    fn provider_name(&self) -> &'static str;
}
Expand description

Common interface for “fetch a Secure Note’s content” and “store a Secure Note’s content” — the only two operations secret store / secret unlock need.

Required Methods§

Source

fn precheck(&self) -> Result<()>

Verify that the vault CLI is installed and authenticated before we try to read or write. yui doesn’t drive bw login / op signin / bw unlock itself (the master password / passkey / SSO factor should go to the provider’s CLI directly, not through yui’s stdin), but it can at least detect the unauthenticated / locked state up front and emit an actionable hint instead of letting the raw provider error propagate.

Source

fn fetch(&self, item: &str) -> Result<Vec<u8>>

Read the notes field of item. Errors if the item is missing or the CLI isn’t installed. (Auth state is checked separately via precheck.)

Source

fn store(&self, item: &str, content: &[u8], force: bool) -> Result<()>

Create or overwrite the Secure Note at item with content in the notes field. force = false refuses to clobber an existing item; force = true overwrites.

Source

fn provider_name(&self) -> &'static str

Human-readable provider name for log output.

Implementors§