Skip to content

feat: IETF Payment client support#1

Open
TheCryptoDonkey wants to merge 2 commits intomainfrom
feat/ietf-payment
Open

feat: IETF Payment client support#1
TheCryptoDonkey wants to merge 2 commits intomainfrom
feat/ietf-payment

Conversation

@TheCryptoDonkey
Copy link
Collaborator

Summary

  • Adds client-side support for WWW-Authenticate: Payment challenges (draft-ryan-httpauth-payment-01)
  • Parses IETF Payment challenges from multi-scheme WWW-Authenticate headers (handles L402 + Payment coexistence)
  • Decodes Lightning charge requests to extract BOLT11 invoice, payment hash, and amount
  • Pays via existing wallet infrastructure (NWC, Cashu, human) — no new wallet code needed
  • Builds base64url credential for Authorization: Payment header that toll-booth can verify
  • Slots into fetch handler after xcashu/x402, before L402 (priority: cheapest first)
  • 22 new tests across parse, credential, and integration

Test plan

  • Parse tests: standard challenge, multi-scheme headers, missing fields, corrupted base64url, non-lightning methods
  • Credential tests: round-trip encode/decode, optional fields, toll-booth compatibility
  • All 483 existing tests pass (no regressions)
  • Manual test against satgate.trotters.dev dual-scheme endpoint

🤖 Generated with Claude Code

Parse WWW-Authenticate: Payment challenges, pay the embedded BOLT11
invoice via existing wallet infrastructure, build the base64url
credential, and retry. Slots in after xcashu/x402 and before L402
in the fetch handler priority chain.

New modules: src/ietf-payment/parse.ts (detect + parse),
src/ietf-payment/credential.ts (build Authorization: Payment header).
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