pub struct HookClient<C> { /* private fields */ }Expand description
The shared client the per-role types (RemoteAuthorizer,
RemoteAdmission, RemoteOutcomes) hold behind an Arc.
Implementations§
Source§impl<C: HookChannel> HookClient<C>
impl<C: HookChannel> HookClient<C>
Sourcepub fn new(
channel: C,
server_audience: impl Into<String>,
signer: Option<HookSigner>,
clock: Arc<dyn Clock>,
sleep: Arc<dyn Sleep>,
) -> Result<Self, HookConfigError>
pub fn new( channel: C, server_audience: impl Into<String>, signer: Option<HookSigner>, clock: Arc<dyn Clock>, sleep: Arc<dyn Sleep>, ) -> Result<Self, HookConfigError>
A client over channel. server_audience is this server’s own
canonical origin (the audience hook bodies carry, not the hook
endpoint’s). clock stamps signatures and sleep enforces call
timeouts.
§Errors
HookConfigError when the channel is neither signed nor isolated,
or an origin is malformed.
Sourcepub fn with_nonce_source(self, nonces: Arc<dyn NonceSource>) -> Self
pub fn with_nonce_source(self, nonces: Arc<dyn NonceSource>) -> Self
Replace the nonce source. A constant source makes the hook reject every request after the first as a replay, so this fails closed; it exists for tests that pin a signature.
Trait Implementations§
Auto Trait Implementations§
impl<C> !RefUnwindSafe for HookClient<C>
impl<C> !UnwindSafe for HookClient<C>
impl<C> Freeze for HookClient<C>where
C: Freeze,
impl<C> Send for HookClient<C>where
C: Send,
impl<C> Sync for HookClient<C>where
C: Sync,
impl<C> Unpin for HookClient<C>where
C: Unpin,
impl<C> UnsafeUnpin for HookClient<C>where
C: UnsafeUnpin,
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