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§
Sourcefn precheck(&self) -> Result<()>
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.
Sourcefn fetch(&self, item: &str) -> Result<Vec<u8>>
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.)
Sourcefn store(&self, item: &str, content: &[u8], force: bool) -> Result<()>
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.
Sourcefn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
Human-readable provider name for log output.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".