pub struct WebhookVerifier;Expand description
Verifies and parses webhook deliveries.
Implementations§
Source§impl WebhookVerifier
impl WebhookVerifier
Sourcepub fn construct_event(
&self,
payload: &[u8],
signature: Option<&str>,
secret: &str,
) -> Result<WebhookEvent>
pub fn construct_event( &self, payload: &[u8], signature: Option<&str>, secret: &str, ) -> Result<WebhookEvent>
Verify the X-Oc-Signature (HMAC-SHA256 over the raw body,
hex-encoded, compared in constant time) and then parse the payload. An
empty secret skips verification (for accounts not yet on signed
webhooks). A missing/wrong signature — or an unparseable payload —
yields Api2ConvertError::SignatureVerification.
Sourcepub fn parse(&self, payload: &[u8]) -> Result<WebhookEvent>
pub fn parse(&self, payload: &[u8]) -> Result<WebhookEvent>
Parse a webhook payload without verifying its signature (for the pre-signed-webhooks period).
Auto Trait Implementations§
impl Freeze 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