MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / verifyWebhookSignature

Function verifyWebhookSignature

server/src/integrations/zoom.ts:466–492  ·  view source on GitHub ↗
(
  payload: string,
  signature: string,
  timestamp: string
)

Source from the content-addressed store, hash-verified

464 * See: https://developers.zoom.us/docs/api/rest/webhook-reference/#verify-webhook-events
465 */
466export function verifyWebhookSignature(
467 payload: string,
468 signature: string,
469 timestamp: string
470): boolean {
471 const webhookSecret = process.env.ZOOM_WEBHOOK_SECRET;
472 if (!webhookSecret) {
473 logger.error('ZOOM_WEBHOOK_SECRET not configured - rejecting webhook');
474 return false;
475 }
476
477 const message = `v0:${timestamp}:${payload}`;
478 const expectedSignature = 'v0=' + crypto
479 .createHmac('sha256', webhookSecret)
480 .update(message)
481 .digest('hex');
482
483 try {
484 return crypto.timingSafeEqual(
485 Buffer.from(signature),
486 Buffer.from(expectedSignature)
487 );
488 } catch {
489 // timingSafeEqual throws if buffers have different lengths
490 return false;
491 }
492}

Callers 1

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected