Datafy Webhook Signature Verifier (graph-parceiro/webhook.ts)

DeskcommCRM · lib/channels/graph-parceiro/webhook.ts · typescript · MIT
security, integration, crm, tag:crypto

Verifies HMAC-SHA256 signatures for webhook payloads from the Datafy messaging partner. Reuse this to secure incoming webhook endpoints against forged messages.

// Source: https://github.com/melgarafael/DeskcommCRM | License: MIT | Copyright 2026 Rafael Melgaço
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Assinatura do webhook do Datafy — módulo PURO (recorte do #1130, @vgamkt).
 *
 * O Datafy entrega o payload idêntico ao da Meta, mas assina diferente: o
 * header é `x-datafy-signature-256` (`sha256=<hex>`) e o HMAC-SHA256 é do texto
 * `"{timestamp}.{corpo}"`, com o timestamp em `x-datafy-timestamp` (a Meta
 * assina só o corpo). O segredo (`whsec_…`) nasce no painel do Datafy, por
 * número, quando a assinatura é ativada lá.
 *
 * Do NOSSO lado a assinatura não é opcional: sem o `whsec_` gravado, a entrada
 * recusa tudo. Uma URL secreta sozinha deixaria qualquer um que a visse
 * (log de proxy, print de tela) injetar

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

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key