pub struct Webhook { /* private fields */ }
Available on crate features
events
and webhook-events
only.Implementations§
Source§impl Webhook
impl Webhook
Sourcepub fn construct_event(
payload: &str,
sig: &str,
secret: &str,
) -> Result<Event, WebhookError>
pub fn construct_event( payload: &str, sig: &str, secret: &str, ) -> Result<Event, WebhookError>
Construct an event from a webhook payload and signature.
§Errors
This function will return a WebhookError if:
- the provided signature is invalid
- the provided secret is invalid
- the signature timestamp is older than 5 minutes
Sourcepub fn construct_event_with_timestamp(
payload: &str,
sig: &str,
secret: &str,
timestamp: i64,
) -> Result<Event, WebhookError>
pub fn construct_event_with_timestamp( payload: &str, sig: &str, secret: &str, timestamp: i64, ) -> Result<Event, WebhookError>
Construct an event from a webhook payload and signature, verifying its signature using the provided timestamp.
This is helpful for replaying requests in tests and should be avoided otherwise in production use.
§Errors
This function will return a WebhookError if:
- the provided signature is invalid
- the provided secret is invalid
- the signature timestamp is older than 5 minutes from the provided timestamp
Auto Trait Implementations§
impl Freeze for Webhook
impl RefUnwindSafe for Webhook
impl Send for Webhook
impl Sync for Webhook
impl Unpin for Webhook
impl UnwindSafe for Webhook
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