pub struct ProdVaultFacade {
workspace: Weak<Workspace>,
}Expand description
The production facade: a weak workspace, so it can read the current
[vault] session after a reload rather than holding a stale one.
Fields§
§workspace: Weak<Workspace>Implementations§
Source§impl ProdVaultFacade
impl ProdVaultFacade
pub fn from_arc(workspace: &Arc<Workspace>) -> Self
pub fn into_arc(self) -> Arc<dyn VaultFacade> ⓘ
fn workspace(&self) -> Result<Arc<Workspace>, VaultToolError>
fn session(&self) -> Result<Arc<VaultSession>, VaultToolError>
Sourcefn decrypt_failed(
&self,
session: &VaultSession,
caller: &SessionSlot,
item: Option<&str>,
error: VaultToolError,
) -> VaultToolError
fn decrypt_failed( &self, session: &VaultSession, caller: &SessionSlot, item: Option<&str>, error: VaultToolError, ) -> VaultToolError
A decryption failure under a known key means the account rotated its keys: drop them and restamp every other parked card as needing the password again. Other error kinds pass through untouched.
Sourcefn fallback_or_lock<T>(
&self,
session: &VaultSession,
caller: &SessionSlot,
item: Option<&str>,
result: Result<T, VaultToolError>,
fallback: T,
) -> Result<T, VaultToolError>
fn fallback_or_lock<T>( &self, session: &VaultSession, caller: &SessionSlot, item: Option<&str>, result: Result<T, VaultToolError>, fallback: T, ) -> Result<T, VaultToolError>
A card may draw (unreadable) for a field it has no key for, but a
crypto failure means the keys are stale and must lock the session.
Sourceasync fn ensure_keys_current(
&self,
approved: &Approved,
item: Option<&str>,
) -> Result<SyncData, VaultToolError>
async fn ensure_keys_current( &self, approved: &Approved, item: Option<&str>, ) -> Result<SyncData, VaultToolError>
A write re-checks the account key immediately before it runs: a
rotation during the park would store ciphertext the next unlock cannot
read. The sync comes back for the write’s encryptedFor stamp.
Sourcefn guard_reload(
approved: &Approved,
session: &Arc<VaultSession>,
) -> Result<(), VaultToolError>
fn guard_reload( approved: &Approved, session: &Arc<VaultSession>, ) -> Result<(), VaultToolError>
A call that read the account before its gate must not run against a
session a [vault] reload swapped in: settle it as changed instead.
Sourceasync fn gate(
&self,
caller: &SessionSlot,
draft: VaultDraft,
tool: VaultTool,
field: Option<&str>,
) -> Result<Approved, VaultToolError>
async fn gate( &self, caller: &SessionSlot, draft: VaultDraft, tool: VaultTool, field: Option<&str>, ) -> Result<Approved, VaultToolError>
Park the draft, await one answer, settle it, and unlock the shared session when the card asked for the password. Decline and send-back are audited here and returned as the tool’s refusal; an approval returns the session and its keys, and the caller audits the outcome.
Sourceasync fn item_gate<F>(
&self,
caller: &SessionSlot,
tool: VaultTool,
id: &str,
summary: F,
) -> Result<(Approved, Value, VaultDraft), VaultToolError>
async fn item_gate<F>( &self, caller: &SessionSlot, tool: VaultTool, id: &str, summary: F, ) -> Result<(Approved, Value, VaultDraft), VaultToolError>
Gate one item operation. When the session is unlocked the item is fetched first so the card can name it; when it is locked the card is parked with the id alone, because a token call would fail before the reader ever saw the password field. The item is fetched after the unlock either way, so the returned cipher is always current.
Source§impl ProdVaultFacade
impl ProdVaultFacade
Sourcefn search_items(
&self,
session: &VaultSession,
caller: &SessionSlot,
keys: &Unlocked,
sync: &SyncData,
query: &str,
limit: usize,
) -> Result<Vec<Value>, VaultToolError>
fn search_items( &self, session: &VaultSession, caller: &SessionSlot, keys: &Unlocked, sync: &SyncData, query: &str, limit: usize, ) -> Result<Vec<Value>, VaultToolError>
The metadata hits for one query: name, username and URIs are decrypted,
and nothing else is. Trashed items are skipped, as a vault search does.
A field the item’s key cannot decrypt draws (unreadable); a stale
key lock the session instead.
fn decrypt_username( &self, session: &VaultSession, caller: &SessionSlot, item: Option<&str>, keys: &Unlocked, cipher: &Value, ) -> Result<Option<String>, VaultToolError>
fn decrypt_uris( &self, session: &VaultSession, caller: &SessionSlot, item: Option<&str>, keys: &Unlocked, cipher: &Value, ) -> Result<Vec<String>, VaultToolError>
fn folder_name( &self, session: &VaultSession, caller: &SessionSlot, item: Option<&str>, keys: &Unlocked, sync: &SyncData, cipher: &Value, ) -> Result<Option<String>, VaultToolError>
fn item_metadata( &self, approved: &Approved, keys: &Unlocked, cipher: &Value, ) -> Result<Value, VaultToolError>
fn attachment_rows( &self, session: &VaultSession, caller: &SessionSlot, item: Option<&str>, keys: &Unlocked, cipher: &Value, ) -> Result<Value, VaultToolError>
Trait Implementations§
Source§impl VaultFacade for ProdVaultFacade
impl VaultFacade for ProdVaultFacade
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
query: &'life2 str,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
reveal: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
input: &'life2 CreateInput,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
patch: &'life3 PatchInput,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn trash<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn restore<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn totp_code<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn attachment_get<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
item_id: &'life2 str,
attachment_id: &'life3 str,
destination: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn attachment_put<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
item_id: &'life2 str,
path: &'life3 str,
name: Option<&'life4 str>,
replace_attachment_id: Option<&'life5 str>,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn folder_list<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn folder_create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn folder_update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
name: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn folder_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
caller: &'life1 SessionSlot,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, VaultToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for ProdVaultFacade
impl !UnwindSafe for ProdVaultFacade
impl Freeze for ProdVaultFacade
impl Send for ProdVaultFacade
impl Sync for ProdVaultFacade
impl Unpin for ProdVaultFacade
impl UnsafeUnpin for ProdVaultFacade
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more