Skip to content

Conversation

@Egge21M
Copy link
Collaborator

@Egge21M Egge21M commented Dec 17, 2025

Description

This adds the new bech32m and TLV based Payment Request encoding (creqB). We use @scure/base for bech32m and bech32 encoding. This dependency was transiently installed through @scure/bip32 already, so this should not affect our dep graph.

Changes

  • Adds tlv.ts with TLV encoding utils for Payment Requests and nostr nprofiles (required for noramlization)
  • Adds bech32m.ts that wraps @scure/base utils for convenience and isolation
  • Adds two new methods to PaymentRequest
    1. toEncodedCreqA (delegates to toEncodedRequest for compatibility
    2. toEncodedCrewB (new API)

PR Tasks

  • Open PR
  • run npm run test --> no failing unit tests
  • run npm run lint --> no warnings or errors
  • run npm run format
  • run npm run api:check --> run npm run api:update for changes to the API

@Egge21M Egge21M changed the base branch from main to development December 17, 2025 17:10
Copy link
Collaborator

@robwoodgate robwoodgate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Hats off to you, this is a seriously impressive bit of code, and I love that you've included all the test vectors from the NUT.

My only question (which @thesimplekid may want to input on) is what about the P2BK flag to signal that the PR should use blinded keys. Currently we have that implemented as a nut26 boolean, at same level as the nut10 tag, but it is not represented here.

@TheRealCheebs
Copy link
Contributor

Looks good and clean.

@Egge21M
Copy link
Collaborator Author

Egge21M commented Jan 4, 2026

@robwoodgate should we merge this and simply add P2BK once the NUT has been adjusted? I think P2BK signaling is not part of the spec right now and shouldn't block this.

@robwoodgate
Copy link
Collaborator

@robwoodgate should we merge this and simply add P2BK once the NUT has been adjusted? I think P2BK signaling is not part of the spec right now and shouldn't block this.

Yes, let's not let P2BK hold it up. I have removed all NUT-18 from P2BK pending another review, so this is correct to current spec.

@Egge21M Egge21M merged commit d343619 into development Jan 5, 2026
22 checks passed
@Egge21M Egge21M deleted the bech32m branch January 5, 2026 04:29
@robwoodgate robwoodgate mentioned this pull request Jan 9, 2026
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.

4 participants