pub struct PerCallerAuthorizer { /* private fields */ }Expand description
Per-caller signing approval — the policy for #354. The first time a given peer
process asks to sign, the injected approve function is consulted (e.g. a
biometric / user prompt). Approved peers are pinned for the life of this authorizer
(the unlock window), so the legitimate caller is not re-prompted on every signature,
while a different process triggers a fresh approval.
Peers are keyed by (uid, pid). On platforms without a peer pid (macOS), pid is
None, so callers collapse to per-uid; there the host’s approve function should
apply a time-bucketed re-auth rather than pinning forever.
Usage:
ⓘ
let auth = PerCallerAuthorizer::new(|peer| prompt_biometric_for(peer));Implementations§
Source§impl PerCallerAuthorizer
impl PerCallerAuthorizer
Sourcepub fn new(
approve: impl Fn(&PeerIdentity) -> bool + Send + Sync + 'static,
) -> PerCallerAuthorizer
pub fn new( approve: impl Fn(&PeerIdentity) -> bool + Send + Sync + 'static, ) -> PerCallerAuthorizer
Builds a per-caller authorizer that consults approve once per new peer and
pins peers it approves.
Args:
approve: called for a not-yet-approved peer; returning true pins it.
Trait Implementations§
Source§impl SignAuthorizer for PerCallerAuthorizer
impl SignAuthorizer for PerCallerAuthorizer
Returns true iff
peer is allowed to obtain a signature now. Read moreAuto Trait Implementations§
impl !Freeze for PerCallerAuthorizer
impl !RefUnwindSafe for PerCallerAuthorizer
impl !UnwindSafe for PerCallerAuthorizer
impl Send for PerCallerAuthorizer
impl Sync for PerCallerAuthorizer
impl Unpin for PerCallerAuthorizer
impl UnsafeUnpin for PerCallerAuthorizer
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