pub struct ApprovalGatedResolver<R, F>{ /* private fields */ }Expand description
Type-safe wrapper that enforces the approve-on-use policy
before dispatching to an inner SecretResolver. This is
what closes the loop on the P25 protocol — a resolver that
is not gated through this wrapper makes the
approve_on_use field a metadata-only theatrical control.
Construction takes three values:
- An inner
SecretResolver(keychain, local-vault, 1Password, …). - An
Arc<SessionApprovalCache>— shared across every gated resolver in the process so the user only sees one prompt per session per path. - A
policy_for_pathclosure — typically reads the path’sapprove_on_usefield from the merged manifest. The closure shape avoids a hard dependency ondevboy-storagein this crate.
On every resolve() call:
ApproveOnUsePolicy::Never→ straight to the inner resolver.ApproveOnUsePolicy::Sessionwith a cache hit → straight to the inner resolver.ApproveOnUsePolicy::Sessionwithout a cache hit, orApproveOnUsePolicy::PerCall→ returnAliasResolverError::Backendwith a message that names the path and the policy, so the caller can surface the approval dialog and retry.
Implementations§
Source§impl<R, F> ApprovalGatedResolver<R, F>
impl<R, F> ApprovalGatedResolver<R, F>
pub fn new( inner: R, cache: Arc<SessionApprovalCache>, policy_for_path: F, ) -> Self
Sourcepub fn cache(&self) -> &Arc<SessionApprovalCache>
pub fn cache(&self) -> &Arc<SessionApprovalCache>
Underlying cache handle — exposed so the orchestration
layer (which drives the approval dialog) can call
record_session after the user clicks “Allow always
(this session)”.
Trait Implementations§
Source§impl<R, F> SecretResolver for ApprovalGatedResolver<R, F>
impl<R, F> SecretResolver for ApprovalGatedResolver<R, F>
Source§fn resolve(&self, path: &str) -> Result<SecretString, AliasResolverError>
fn resolve(&self, path: &str) -> Result<SecretString, AliasResolverError>
Resolve
path (the portion after @secret:) to its
current value. Implementations consume the path verbatim;
path validation belongs in the credential layer per
ADR-020.Auto Trait Implementations§
impl<R, F> Freeze for ApprovalGatedResolver<R, F>
impl<R, F> RefUnwindSafe for ApprovalGatedResolver<R, F>where
R: RefUnwindSafe,
F: RefUnwindSafe,
impl<R, F> Send for ApprovalGatedResolver<R, F>
impl<R, F> Sync for ApprovalGatedResolver<R, F>
impl<R, F> Unpin for ApprovalGatedResolver<R, F>
impl<R, F> UnsafeUnpin for ApprovalGatedResolver<R, F>where
R: UnsafeUnpin,
F: UnsafeUnpin,
impl<R, F> UnwindSafe for ApprovalGatedResolver<R, F>where
R: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more