feat(nipcash,nipcw): add bech32 encoding for Hub connection strings - #16
Merged
Conversation
EncodeHubConnection/DecodeHubConnection package a Cash Hub's or Circle Wallet Hub's own connection (wallet pubkey, relay, secret, optional label) as a cashhub1.../circlehub1... bech32 string, alongside the existing PairingInfo/BuildPairingURI/ParsePairingURI. Same TLV/bech32 mechanics as the cash-token-family format, reused via the public bech32 package rather than nipcash's own unexported helpers.
git-nostr
added a commit
to flokiorg/lokihub
that referenced
this pull request
Sep 7, 2026
Consolidates 4 hand-rolled nostr+walletconnect:// URI builders (api.CreateApp, GetCashWalletConnection, the circle-wallet controller, cashwallet.Create) onto nmilat's own nip47.BuildPairingURI, which was already a dependency but never actually called. Uses the resulting single choke point to add the new bech32 token: CreateApp now returns cashHubToken/circleHubToken alongside pairingUri for cash_hub/circle_hub respectively, via nmilat's new nip47.EncodeHubConnection, using the app's own Name as the token's label. Temporarily depends on flokiorg/nmilat's feat/hub-connection-bech32 branch (ohstr/nmilat#16) for the new encoder; revert to a plain require once a released nmilat version ships it.
cashhub1.../circlehub1... are NIP-CASH/NIP-CW concepts, not base NIP-47 ones — move them into the packages that already own their own protocol's wire formats (mirroring nipcash.Token's existing bech32 codec), instead of a shared nip47.HubConnection. Each package's HRP is now fixed internally (EncodeCashHubConnection always emits cashhub1..., EncodeCircleHubConnection always emits circlehub1...) rather than caller-supplied, closing off a class of mix-up (passing the wrong HRP for the kind of Hub) the previous, generic design allowed. nipcash's version reuses its own existing writeTLV/readTLV/decodeKeyHex directly, now that it's in the same package; nipcw's duplicates the same small helpers locally, same size/reasoning as nipcash's own token codec.
naliyi
added a commit
that referenced
this pull request
Sep 7, 2026
Covers the three merged-but-unreleased PRs since v0.2.7: the NWC client NIP-44 fallback + CLOSED-message fixes (#14), the relay combined-kind cursor fairness fix (#15), and the nipcash/nipcw Hub connection bech32 encoding (#16). PR #12 (README wording cleanup) is docs-only and not user-facing, so it's omitted per house style.
git-nostr
added a commit
to flokiorg/lokihub
that referenced
this pull request
Sep 7, 2026
ohstr/nmilat#16 (cashhub1.../circlehub1... Hub connection codecs) is now merged upstream and tagged as part of v0.2.8, so the temporary replace pointing at the flokiorg/nmilat fork's pseudo-version is no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
EncodeHubConnection/DecodeHubConnectiontonip47, an alternative bech32 encoding of the same pairing dataBuildPairingURI/ParsePairingURIalready carry — for use by anything exposing a special-purpose Hub-style NWC connection (a Cash Hub, a Circle Wallet Hub, etc.) that wants a single recognizable, copy-paste-safe string instead of a rawnostr+walletconnect://URI.nipcash.Token), reused via the publicbech32package rather thannipcash's own unexported helpers.nipcash.Token.HRP), so this isn't tied to any one Hub kind.Test plan
go build ./...go test ./nip47/...