Reading the register…
Department 04
When something changes in the suppression register, you can have it delivered instead of asking again and again. Every event is signed, has its own id, and is retried until you acknowledge it.
The sequence below covers a single event. The time between attempts is set by the backoff strategy, not a fixed schedule.
X-MarketMute-Signature header.Always compare signatures in constant time, and compare against the raw body — not an object that's already passed through a JSON parser. Reserializing changes the bytes and invalidates the signature.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(rawBody: Buffer, header: string, secret: string) {
const expected = createHmac("sha256", secret).update(rawBody).digest();
const received = Buffer.from(header, "hex");
// Different length => never valid, and timingSafeEqual throws.
if (expected.length !== received.length) return false;
return timingSafeEqual(expected, received);
}
Because delivery is retried on a missed acknowledgment, the same event can reach you more than once — for instance when your response got lost on the way back. Store the event's id and treat a repeat as a non-event.
// Acknowledge immediately if the event's already been processed.
if (await seen(event.id)) {
return response(204);
}
await apply(event);
await remember(event.id);
return response(204);
| Your response | Interpretation | Consequence |
|---|---|---|
| 200 | Acknowledged. | Delivery is done. |
| 204 | Acknowledged, no content. | Delivery is done. |
| 4xx | Failed attempt. | Another attempt per backoff, up to five. |
| 5xx | Failed attempt. | Another attempt per backoff, up to five. |