pub struct HookVerifier { /* private fields */ }Expand description
Verifies signed hook requests for one hook service.
Implementations§
Source§impl HookVerifier
impl HookVerifier
Sourcepub fn new(
audience: impl Into<String>,
keys: Vec<VerifierKey>,
clock: impl Fn() -> i64 + Send + Sync + 'static,
) -> HookVerifier
pub fn new( audience: impl Into<String>, keys: Vec<VerifierKey>, clock: impl Fn() -> i64 + Send + Sync + 'static, ) -> HookVerifier
A verifier for the hook service whose canonical origin is audience,
trusting keys, reading time from clock (epoch milliseconds).
Sourcepub fn with_replay_protection(self) -> HookVerifier
pub fn with_replay_protection(self) -> HookVerifier
Also reject a nonce seen before, until its request’s window closes (SPEC-SERVER §7.1 step 5). The set is in memory: a hook that restarts forgets it, and one that runs several instances must share one.
Sourcepub fn verify(
&self,
procedure: &str,
headers: &[(&str, &str)],
body: &[u8],
) -> Result<Verified, VerifyError>
pub fn verify( &self, procedure: &str, headers: &[(&str, &str)], body: &[u8], ) -> Result<Verified, VerifyError>
Verify one request: procedure is the Connect path it arrived on,
headers every header it carried (names compare case-insensitively),
and body the exact bytes received.
§Errors
The first VerifyError found. A request that fails is never
remembered for replay.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for HookVerifier
impl !RefUnwindSafe for HookVerifier
impl !UnwindSafe for HookVerifier
impl Send for HookVerifier
impl Sync for HookVerifier
impl Unpin for HookVerifier
impl UnsafeUnpin for HookVerifier
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