/opt/mawid/apps/api/src/whatsapp
NameSizeModeActions
owner-notifier.service.ts17450644editdlrm
wa-core.module.ts13520644editdlrm
wa-http.client.ts17360644editdlrm
wa-inbound.service.spec.ts50660644editdlrm
wa-inbound.service.ts54310644editdlrm
wa-outbound.worker.ts27230644editdlrm
wa-queue.ts4470644editdlrm
wa-sender.service.ts49590644editdlrm
wa-signature.spec.ts12640644editdlrm
wa-signature.ts6620644editdlrm
wa-types.ts16830644editdlrm
wa-webhook.controller.spec.ts26840644editdlrm
wa-webhook.controller.ts23080644editdlrm
wa-window.spec.ts8600644editdlrm
wa-window.ts5090644editdlrm
whatsapp.module.ts5790644editdlrm
Edit: /opt/mawid/apps/api/src/whatsapp/wa-signature.ts (662B)
import { createHmac, timingSafeEqual } from 'node:crypto'; /** * Validates Meta's X-Hub-Signature-256 header: "sha256=" + HMAC-SHA256(appSecret, rawBody). */ export function verifyWaSignature( rawBody: Buffer | undefined, signatureHeader: string | undefined, appSecret: string, ): boolean { if (!rawBody || !signatureHeader?.startsWith('sha256=')) return false; const expected = createHmac('sha256', appSecret).update(rawBody).digest('hex'); const received = signatureHeader.slice('sha256='.length); if (received.length !== expected.length) return false; return timingSafeEqual(Buffer.from(received, 'utf8'), Buffer.from(expected, 'utf8')); }