Playground

The pure core, running in your browser

No backend, no database. commitcourier/core is dependency-free and Web-standard-only, so these are the library's actual functions executing client-side.

Signing

Sign & verify (Standard Webhooks)

HMAC-SHA256 over {id}.{timestamp}.{body}. Tamper with the payload and verification fails.

const h = await sign({ id, timestampSec, body, secrets });
// h["webhook-signature"] => "v1,<base64>"
const ok = await verifySignature({
  id, timestamp: h["webhook-timestamp"],
  payload: body, header: h["webhook-signature"], secrets,
});
SSRF

Outbound SSRF guard

Private, loopback, link-local and cloud-metadata ranges are blocked by default. Allowlist wins.

blocked — metadata
evaluateIp("169.254.169.254", {
  blockPrivateRanges: true, allowlist: [], blocklist: [],
});
// => { allowed: false, reason: "metadata" }
Retry

Exponential backoff + jitter

Delay before each retry: baseMs · 2^(n-1), jittered, capped. Tune and watch the curve.

#1
1.0s
#2
2.0s
#3
4.0s
#4
8.0s
#5
16.0s
#6
32.0s
#7
1.1m
#8
2.1m
backoffMs(attempt, {
  maxAttempts, backoff: "exponential",
  baseMs: 1000, capMs: 3_600_000, jitter: 0.2,
});
At-rest encryption

Encrypt signing secrets (AES-256-GCM)

Optional: pass a cipher to createRelay and secrets become ciphertext in your DB (ccsec.v1.…).

const cipher = createAesGcmCipher(generateSecretKey());
const ct = await cipher.encrypt("whsec_...");  // "ccsec.v1.<base64>"
const pt = await cipher.decrypt(ct);           // round-trips
State machine

Transitions as pure functions

Each function returns only the field delta to persist. pending → in_flight → delivered / dead.

Apply a transition to see the persisted delta.
onClaim(now, "worker-1");       // -> in_flight
onSuccess(now);                  // -> delivered
onFailure({ attempts }, cfg, now, "500", backoffMs); // -> pending|dead
onCancel();                      // -> cancelled