Skip to content

feat: support nodePubkeys invoice checks - #3

Merged
andrerfneves merged 1 commit into
mainfrom
feat/nodepubkeys-verification
Jun 13, 2026
Merged

feat: support nodePubkeys invoice checks#3
andrerfneves merged 1 commit into
mainfrom
feat/nodepubkeys-verification

Conversation

@andrerfneves

Copy link
Copy Markdown
Owner

Summary

Implements draft LUD-XX nodePubkeys support for LNURL-pay payRequest responses, aligned with the local proposal in /home/exedev/code/lud-proposals/lud-xx-node-pubkeys.md and the open upstream spec PR: lnurl/luds#297.

I verified the local proposal and PR #297 are byte-identical. The design is also materially stronger than older prior art like lnurl/luds#204 because it keeps the human Lightning Address unchanged and attaches structured invoice-origin metadata to the LUD-06 response.

What changed

  • Parse and validate optional payRequest.nodePubkeys:
    • non-empty array
    • object entries with required pubkey
    • compressed secp256k1 public key, 66-char hex, normalized lowercase
    • duplicate rejection
    • forward-compatible raw fields preserved
  • Extend BOLT11 validation to return the effective payee node id:
    • uses BOLT11 n tag when present
    • falls back to signature recovery when n is absent
  • Add payment.nodePubkeyVerification for BOLT11 instructions:
    • status: "verified" with matched pubkey
    • status: "mismatch" with non-blocking warning by default
  • Add nodePubkeyPolicy:
    • "warn" default — spec-compatible non-blocking warning result
    • "enforce" — throws NodePubkeyMismatchError
    • "off" — skips nodePubkeys comparison while preserving other BOLT11 validation
  • Export public types/errors:
    • NodePubkey
    • NodePubkeyPolicy
    • NodePubkeyVerification
    • Bolt11PayeeNodeIdSource
    • NodePubkeyMismatchError
  • Update README, SECURITY, CHANGELOG, and examples.
  • Add a runnable local examples/basic/node-pubkeys.ts using real signed test invoices.

Verification

  • bun run check
    • typecheck ✅
    • examples typecheck ✅
    • Biome lint/check ✅
    • unit/integration/e2e tests: 145 pass
    • package smoke tests: 3 pass
  • bun examples/basic/node-pubkeys.ts
  • npm publish --dry-run

Notes

This intentionally follows the LUD proposal's wallet UX: mismatches are surfaced but not blocked by default. Strict blocking is available only as an explicit caller policy.

@andrerfneves
andrerfneves merged commit 9b39465 into main Jun 13, 2026
5 checks passed
@andrerfneves
andrerfneves deleted the feat/nodepubkeys-verification branch June 13, 2026 21:51
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