Skip to content

nipcash, nipcw: RFC 8785 params strings (changes ph), circle-join max_amount and refusal codes - #123

Merged
naliyi merged 3 commits into
mainfrom
feat/nipcash-spec-followups
Oct 14, 2026
Merged

naliyi merged 3 commits into
mainfrom
feat/nipcash-spec-followups

Conversation

@naliyi

@naliyi naliyi commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Closes #122

Warning

This changes the NIP-CASH params hash (ph). Params containing <, >, &, U+2028 or U+2029 now hash as RFC 8785 writes them, so a client and a Hub on different sides of this change disagree, and the Hub omits those items. Params without those characters hash exactly as before. Release clients and Hubs (lokihub, cashctl) on the same nmilat.

Summary

  • transport.CanonicalParamsHash writes strings as RFC 8785 does (NIP-CASH §Item Proofs): only ", \ and control characters are escaped; keys sorted and numbers verbatim as before.
  • nipcw.CreateCircleWalletResponse.MaxAmountMillis carries the cap as the Hub resolved it (nil if the Hub did not send it), and nipcw exports ErrNotReady, ErrRestricted, ErrWalletExists, ErrRateLimited (NIP-CW §Errors).

Test plan

  • Known-answer vectors for the canonical form and hash (hash computed independently with sha256sum); the spec-named characters fail on main.
  • max_amount parse test fails when the field is dropped.
  • go vet, go mod tidy, gofmt, golangci-lint v2.13.2, govulncheck, go test -race -count=1 ./...
  • Downstream against this branch: cashctl build/vet/tests, lokihub build/vet/tests, ncli build/vet + Decode tests.

@naliyi
naliyi marked this pull request as ready for review October 14, 2026 18:24
@naliyi
naliyi merged commit b82059e into main Oct 14, 2026
3 checks passed
@naliyi
naliyi deleted the feat/nipcash-spec-followups branch October 17, 2026 20:59
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.

nipcash, nipcw: RFC 8785 params strings, circle-join max_amount and refusal codes

1 participant