pub struct WebhookPayload {
pub event: Event,
pub raw: Bytes,
}Expand description
A verified, parsed webhook request.
Fields§
§event: Event§raw: BytesImplementations§
Source§impl WebhookPayload
impl WebhookPayload
Sourcepub fn from_parts(
body: Bytes,
signature: &str,
secret: &[u8],
) -> Option<Result<Self, WiError>>
pub fn from_parts( body: Bytes, signature: &str, secret: &[u8], ) -> Option<Result<Self, WiError>>
Verify the signature and parse the event from raw bytes and a header value.
Returns None when the signature is invalid (caller should respond 401).
Sourcepub fn from_headers<K: AsRef<str>, V: AsRef<str>>(
body: Bytes,
headers: &[(K, V)],
secret: &[u8],
options: VerifyOptions,
) -> Option<Result<Self, WiError>>
pub fn from_headers<K: AsRef<str>, V: AsRef<str>>( body: Bytes, headers: &[(K, V)], secret: &[u8], options: VerifyOptions, ) -> Option<Result<Self, WiError>>
Verify with replay protection (verify_webhook) and parse the event.
Returns None when verification fails (caller should respond 401).
Auto Trait Implementations§
impl !Freeze for WebhookPayload
impl Forget for WebhookPayload
impl Move for WebhookPayload
impl RefUnwindSafe for WebhookPayload
impl Send for WebhookPayload
impl Sync for WebhookPayload
impl Unpin for WebhookPayload
impl UnsafeUnpin for WebhookPayload
impl UnwindSafe for WebhookPayload
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