Skip to content

v4: ingest signed relay notifications - #49

Merged
Phloraxx merged 1 commit into
mainfrom
v4/signed-relay-ingestion
Sep 1, 2026
Merged

v4: ingest signed relay notifications#49
Phloraxx merged 1 commit into
mainfrom
v4/signed-relay-ingestion

Conversation

@Phloraxx

@Phloraxx Phloraxx commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Scope

Seventh stacked PayGate v4 implementation slice. Depends on PR #48.

Implements

  • reuses the proven v3 P-256 ECDSA device-signature model on direct SQLite
  • device ID is SHA-256 of SubjectPublicKeyInfo DER
  • request signature covers METHOD + path + timestamp + SHA256(raw body) with a 5-minute tolerance
  • signature is explicitly bound to POST /api/v4/relay/events
  • minimal v4 relay event JSON: schema version, source event ID, package, notification post time, title/text/big-text, optional untrusted amount hint
  • v4.0 package allowlist is Paytm Business + Google Messages only; GPay remains rejected
  • validates/bounds body and notification text before persistence
  • only authenticated, valid allowlisted traffic refreshes device last_seen_at
  • stores one SQLite relay_events row and normalizes provider wording server-side
  • Paytm/Kotak normalized observations flow directly into the fail-closed matcher from PR v4: match payment observations safely #48
  • .00 / unrelated notifications are stored as ignored Activity, never matched
  • pre-enrollment notifications are ignored
  • invalid/future notification post time falls back to server_received_at confidence rather than being trusted
  • half-processed received relay rows can be safely resumed on retry
  • completed duplicate events are idempotent and cannot emit duplicate payment transitions/webhooks
  • no PocketBase, libgm, UTR/RRN, or provider-specific Android matching logic

Tests

End-to-end tests cover signed Paytm→paid, duplicate event idempotency, invalid signature, stale timestamp, tampered body, unsupported GPay, .00 ignore, pre-enrollment ignore, retrying a previously stored received event, and signed Kotak-through-Google-Messages→paid. Full internal/v4/... unit tests, race tests, vet and diff checks pass locally.

Safety

Still no production HTTP route registration and no Android rollout. This is an isolated v4 service package.

@Phloraxx
Phloraxx force-pushed the v4/observation-matching branch from 765494f to a802b78 Compare September 1, 2026 04:24
@Phloraxx
Phloraxx force-pushed the v4/signed-relay-ingestion branch from 4aa4463 to a31df19 Compare September 1, 2026 04:24
@Phloraxx
Phloraxx changed the base branch from v4/observation-matching to main September 1, 2026 05:28
@Phloraxx
Phloraxx marked this pull request as ready for review September 1, 2026 05:28
@Phloraxx
Phloraxx merged commit 576afe1 into main Sep 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant