validate
Decide whether an inbound webhook is authentic from plain request primitives,
with no framework request or response objects. Returns null to let the
request through, or a [status, headers, body] triple to write back verbatim.
webhookValidationMiddleware() is a thin Hono
wrapper over this function; use validate() directly from any other server.
Parameters
method
The HTTP method. Informational; the signature does not cover it.
url
The full public URL SignalWire POSTed to, including scheme, host, path, and query. Reconstruct it behind a proxy or tunnel before calling.
headers
Request headers. The signature header is looked up case-insensitively under
X-SignalWire-Signature, or the legacy X-Twilio-Signature alias.
body
The raw request body as a string, before any JSON or form parsing.
signingKey
Your SignalWire Signing Key. An empty or non-string value throws an Error.
Returns
WebhookRejection | null — null when the signature is valid. Otherwise a
[403, {}, 'Forbidden'] triple, whether the header is missing, empty, or
wrong. The body never says which check failed.