Provide honest, executable evidence for a Stripe-like webhook and entitlement rescue method without client code, real payment data, hosted infrastructure, or production credentials.
- strict TypeScript targeting Node.js 20+
- injected authoritative-subscription reader boundary
- in-memory deterministic event, invoice, refund, and dead-letter stores
- HMAC-style local signature harness using synthetic secrets
- Node.js native test runner
- audit, rollback, risk, and run evidence under
docs/andruns/
npm ci
npm run typecheck
npm run lint
npm run check:project
npm run secret:scan
npm run check
npm test
npm run ciNo environment variables are required to run the reference. .env.example
contains names and blank values only. Never add Stripe keys, webhook secrets,
OAuth tokens, real event payloads, customer/payment data, private URLs, or
client code. Keep signature fixtures visibly synthetic.
- Event IDs are the idempotency boundary and must remain unique.
- Lifecycle reconciliation must come from the authoritative reader boundary.
- A lower lifecycle version must never replace a higher one.
- Invoice ordering remains per invoice and separate from lifecycle ordering.
- Refund/charge data must never silently act as a cancellation.
- Entitlements must be derived server-side from stored state.
- Processing failures must remain visible until explicit replay resolves them.
- A rollback must fail closed; never restore unsigned or non-idempotent handling.
None. This is a local and CI reference harness, not a deployed webhook service. Production adaptation requires a durable database, queue, official provider SDK, monitored dead-letter path, authentication, and infrastructure review.
npm cisucceeds from the committed lockfile- typecheck, deterministic lint, project/link/YAML checks, and secret scan pass
- forged and stale signatures cause zero mutation
- duplicate IDs cannot apply twice
- stale lifecycle and invoice deliveries cannot roll state backward
- invoice paid and payment failed transitions affect access explicitly
- refund data remains separate from lifecycle
- subscription deletion revokes access
- a synthetic authoritative failure is visible and replayable
- public docs disclose synthetic reference work and material residual risk
A change is complete only when the clean install, full npm run ci, public
claims, run manifest, rollback posture, and residual-risk statement agree. A
passing local harness must never be represented as production or client proof.
src/signature.ts: request authenticity and replay-window boundarysrc/processor.ts: idempotency, event ordering, and dead-letter statesrc/entitlement.ts: access-grant decisiontest/webhook-rescue.test.ts: claims must not outpace assertionsdocs/operations/rollback-runbook.md: recovery must remain fail closed