Skip to content

Verify signatures

Every delivery carries an IDEALX-Signature header:

IDEALX-Signature: t=1763631000,v1=e5b62c98312f1df0b8e332e5d167a371abdb9284cfa91a02407f300e00bd5e58
  • t is the Unix time (seconds) when IDEALX signed the delivery.
  • v1 is the hex HMAC-SHA256 of the string <t>.<raw body>, keyed with your endpoint’s signing secret.

To verify:

  1. Split the header on , and each part on the first =; read t and v1.
  2. Reject the delivery if t is more than five minutes away from your clock (it stops replays).
  3. Compute HMAC-SHA256 of t + "." + rawBody with your secret, using the body exactly as received, before any JSON parsing or re-encoding.
  4. Compare it with v1 in constant time.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyIdealxSignature(secret: string, rawBody: string, header: string, toleranceSeconds = 300): boolean {
const parts = Object.fromEntries(
header.split(",").map((p) => {
const i = p.indexOf("=");
return [p.slice(0, i).trim(), p.slice(i + 1).trim()];
}),
);
const t = Number(parts.t);
if (!parts.v1 || !Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const want = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
const got = Buffer.from(parts.v1, "hex");
return got.length === want.length && timingSafeEqual(got, want);
}

Check your code with these values (turn the time check off, or set your clock, for the test):

Value
Secret whsec_test_5cQx2rN8vLmA0pT7yK3eW9uB4sD6fG1h
t 1763631000
Raw body {"id":"whd_01937e5f6a7b8c9d0e1f2a3b4c5d6e7f","type":"deposit.credited","createdAt":"2026-11-20T09:30:00.000Z","data":{"accountId":"acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90","units":"25000","currency":"AUD"}}
Expected v1 e5b62c98312f1df0b8e332e5d167a371abdb9284cfa91a02407f300e00bd5e58

Each endpoint has its own secret. To replace one, add a new endpoint (for example a new path on your server) with the same events, move your code to it, then delete the old endpoint. While both exist, each event is delivered to both, each with its own delivery id.