Headers
Como a assinatura é calculada
Exemplo conceitual em Node.js
Boas práticas
- Rejeite timestamps antigos.
- Deduplicate por
x-atriby-delivery. - Responda 2xx apenas depois de aceitar o evento.
- Guarde o segredo em cofre/variável de ambiente.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Headers enviados e como validar HMAC-SHA256 nos webhooks.
| Header | Descrição |
|---|---|
x-atriby-event | Evento enviado, como order.paid. |
x-atriby-delivery | ID único da entrega. |
x-atriby-timestamp | Timestamp usado na assinatura. |
x-atriby-signature | sha256=<hmac>. |
HMAC_SHA256(secret, timestamp + "." + rawBody)
sha256=<hex>
import crypto from "node:crypto"
function verifyWebhook({ secret, timestamp, rawBody, signature }) {
const expected =
"sha256=" +
crypto
.createHmac("sha256", secret)
.update(`${timestamp}.${rawBody}`)
.digest("hex")
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected),
)
}
x-atriby-delivery.