verifyBytes method

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

Like verify, for a body given as the raw bytes of the request.

Implementation

WebhookEvent verifyBytes({
  required List<int> body,
  required Map<String, String> headers,
}) {
  verifySignatureBytes(body: body, headers: headers);
  final String text;
  try {
    text = utf8.decode(body);
  } on FormatException catch (e) {
    throw InvalidPayloadException('The body is not valid UTF-8.', cause: e);
  }
  return WebhookEvent.parse(text);
}