verify method

WebhookEvent verify({
  1. required String body,
  2. required Map<String, String> headers,
})

Verifies a delivery and parses its body into a WebhookEvent.

body is the raw request body. headers are the request headers; names are matched case-insensitively. When the framework hands you the body as bytes, use verifyBytes.

Throws a WebhookVerificationException (MissingHeaderException, InvalidSignatureException or TimestampOutOfToleranceException) when verification fails, and an InvalidPayloadException when the delivery is authentic but its body is not a payload this version of the package can decode.

Implementation

WebhookEvent verify({
  required String body,
  required Map<String, String> headers,
}) {
  verifySignature(body: body, headers: headers);
  return WebhookEvent.parse(body);
}