Component evidence

verifyWebhookSignature (webhooks/verify.ts)

jira.js · src/webhooks/verify.ts · typescript · MIT
securityintegration

Verifies Jira webhook HMAC signatures from raw request bytes using Web Crypto and constant-time digest comparison.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/MrRefactoring/jira.js | License: MIT | Copyright 2020 Vladislav Tupikin
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Checks that a webhook body really came from your Jira site.
 *
 * A webhook registered with a secret arrives signed: Jira computes HMAC-SHA256 over the exact bytes of the request
 * body and sends the digest as `X-Hub-Signature: sha256=<hex>`. Recomputing it with the same secret is the only thing
 * that distinguishes a delivery from Jira from a POST anyone on the internet can make to the same URL.
 *
 * ```ts
 * import { verifyWebhookSignature } from 'jira.js/webhooks';
 *
 * app.post('/jira', express.raw({ type: 'application/json' }), async (request, response) => {
 *   const trusted = await verifyWebhookSignature({


... (truncated -- full source via MCP)