pub struct WebhookVerifier { /* private fields */ }Expand description
A webhook verifier with one or more secrets and a configurable tolerance.
Implementations§
Source§impl WebhookVerifier
impl WebhookVerifier
Sourcepub fn new<I, S>(secrets: I) -> Self
pub fn new<I, S>(secrets: I) -> Self
A verifier accepting a signature made with any of secrets.
Sourcepub fn ed25519<I, S>(public_keys: I) -> Self
Available on crate feature ed25519 only.
pub fn ed25519<I, S>(public_keys: I) -> Self
ed25519 only.A verifier for an endpoint created with the ED25519 signature scheme: public_keys are
the endpoint’s public keys (standard base64 of the raw 32-byte key). Signatures arrive as
v1a,<base64 Ed25519 signature> over the same signed content.
Sourcepub fn tolerance(self, tolerance: Duration) -> Self
pub fn tolerance(self, tolerance: Duration) -> Self
How far the timestamp may be from now (default 5 minutes).
Sourcepub fn at(self, now: SystemTime) -> Self
pub fn at(self, now: SystemTime) -> Self
Verifies as if the current time were now (for tests and replays).
Sourcepub fn verify(
&self,
payload: &[u8],
headers: impl WebhookHeaders,
) -> Result<WebhookEvent>
pub fn verify( &self, payload: &[u8], headers: impl WebhookHeaders, ) -> Result<WebhookEvent>
Verifies a delivery and returns the typed event.
Trait Implementations§
Source§impl Clone for WebhookVerifier
impl Clone for WebhookVerifier
Auto Trait Implementations§
impl Forget for WebhookVerifier
impl Freeze for WebhookVerifier
impl Move for WebhookVerifier
impl RefUnwindSafe for WebhookVerifier
impl Send for WebhookVerifier
impl Sync for WebhookVerifier
impl Unpin for WebhookVerifier
impl UnsafeUnpin for WebhookVerifier
impl UnwindSafe for WebhookVerifier
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