Skip to content

feat: add x402 verification badge endpoint for external indexers - #23

Merged
ralyodio merged 1 commit into
profullstack:mainfrom
eddyflores100-lang:feat/verification-badge-endpoint
Oct 28, 2026
Merged

ralyodio merged 1 commit into
profullstack:mainfrom
eddyflores100-lang:feat/verification-badge-endpoint

Conversation

@eddyflores100-lang

Copy link
Copy Markdown
Contributor

What

Add a read-only /.well-known/x402-verify endpoint that returns JSON metadata about the gateway's x402 configuration, so external indexers (like nullclear.dev) can verify the endpoint is live and schema-valid.

Why

Issue #19 asks for a way to index x402 endpoints and verify they're legitimate. Currently there's no standard metadata endpoint — indexers have to probe the 402 response to discover what methods are accepted, which is fragile and doesn't give them settlement flow details.

A well-known badge endpoint lets indexers:

  • Confirm the endpoint is live (HTTP 200)
  • See which payment methods are accepted (USDC on Base, Polygon, etc.)
  • Understand the settlement flow (verify-then-settle via CoinPay)
  • Optionally see the payee address for transparency

How

Added two files:

  • src/verify-badge.js — buildVerificationBadge() builds the metadata object, verificationBadgeHandler() returns a Response with JSON + CORS + 5-min cache.
  • test/verify-badge.test.js — 10 tests covering badge construction, CORS headers, cache headers, and body parsing.

The badge is pure metadata — no secrets, no keys, no payment logic. It's safe to expose publicly and CORS-enabled so any indexer can fetch it cross-origin.

Relates to #19.

Adds GET /.well-known/x402-verify — a read-only metadata endpoint that
lets external indexers (like nullclear.dev) verify that an x402 gateway
is live, what methods it accepts, and how settlement works.

The badge includes:
- x402 protocol version (1 or 2)
- accepted payment methods (network, asset, label)
- settlement flow (verify-then-settle via CoinPay)
- optional payee address for transparency
- ISO timestamp of badge generation

CORS-enabled and cached for 5 minutes. No secrets, no keys, no payment
logic — just metadata for discovery and verification.

Relates to profullstack#19.
@ralyodio
ralyodio merged commit 88c8db9 into profullstack:main Oct 28, 2026
2 checks passed
ralyodio added a commit that referenced this pull request Oct 28, 2026
Since 0.8 a stale or headless browser string is charged on every path,
including /login, /signup, /oauth, /dashboard, /pay and /api/*. Every fleet
site on ^0.13.1 answered an old Chrome or HeadlessChrome with 402 there, so an
agent whose CoinPay OAuth token lapsed could not sign back in.

APP_PATHS (exported, with isAppPath) lists those surfaces; handle() lets them
through after `exempt`. Sites append their own with `appPaths`, or pass false.

Also ports test/verify-badge.test.js from vitest (not a dependency) to
node:test, which had main's CI red since #23.

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants