Closer/functions/dist
null 89d06eeb7d fix(billing): correct RevenueCat webhook auth to HMAC-SHA256 + enable export
The webhook verified an Ed25519 signature in an X-Signature header, but RevenueCat
offers no public-key signing — it sends HMAC-SHA256 in X-RevenueCat-Webhook-Signature
(t=<ts>,v1=<hex>) computed over "<ts>.<rawBody>". As written, every real event would
have 401'd and premium would never sync for the partner.

- Rewrite verification to HMAC-SHA256 with a +/-5-min timestamp replay guard and a
  constant-time compare; extract a pure verifyWebhookSignature() for unit testing.
- Rename secret REVENUECAT_SIGNING_KEY -> REVENUECAT_WEBHOOK_SECRET (it is an HMAC
  secret, not an Ed25519 key). Never deployed, so no migration.
- Uncomment the export in index.ts (deploy still gated on seeding the secret).
- Add revenueCatWebhook.test.ts: valid / tampered / wrong-secret / missing / stale.
- Reconcile Future.md + Engineering_Reference_Manual.md to the real scheme.

Verified against the live account: the entitlement identifier is now closer_premium,
so events match entitlementLogic. Build + 80 tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 03:43:59 -05:00
..
backup refactor(functions): B1 migrate 13 Firestore triggers to v2 + harden 2026-07-07 23:46:17 -05:00
billing fix(billing): correct RevenueCat webhook auth to HMAC-SHA256 + enable export 2026-07-09 03:43:59 -05:00
couples perf(functions): B6b bound the unbounded couple scanners (#10) 2026-07-08 00:05:32 -05:00
dates refactor(functions): B1 migrate 13 Firestore triggers to v2 + harden 2026-07-07 23:46:17 -05:00
games refactor(functions): B6c split game part-finished trigger + reorder reads (#11) 2026-07-08 00:08:18 -05:00
notifications refactor(functions): B6d finish logger migration in shared helpers 2026-07-08 00:10:10 -05:00
questions perf(functions): B6b bound the unbounded couple scanners (#10) 2026-07-08 00:05:32 -05:00
releaseKey refactor(functions): B3 migrate 12 callables to v2 + harden 2026-07-07 23:58:32 -05:00
security refactor(functions): B3 migrate 12 callables to v2 + harden 2026-07-07 23:58:32 -05:00
users refactor(functions): B4+B5 migrate webhook to v2 + pin onUserDelete on v1 2026-07-08 00:00:29 -05:00
index.js fix(billing): correct RevenueCat webhook auth to HMAC-SHA256 + enable export 2026-07-09 03:43:59 -05:00
index.js.map fix(billing): correct RevenueCat webhook auth to HMAC-SHA256 + enable export 2026-07-09 03:43:59 -05:00
log.js build(functions): B0 v2 foundation — global options, shared push helper, structured logging 2026-07-07 23:36:16 -05:00
log.js.map build(functions): B0 v2 foundation — global options, shared push helper, structured logging 2026-07-07 23:36:16 -05:00
options.js fix(functions): gcf_gen1 fractional CPU to fit the Cloud Run CPU quota 2026-07-08 03:04:26 -05:00
options.js.map fix(functions): gcf_gen1 fractional CPU to fit the Cloud Run CPU quota 2026-07-08 03:04:26 -05:00