Skip to content

release 0.3.1: cash_consolidate delivery fix, LUD-06 chain parsing, zap invoice helper - #28

Merged
naliyi merged 4 commits into
mainfrom
release-0.3.1
Sep 21, 2026
Merged

naliyi merged 4 commits into
mainfrom
release-0.3.1

Conversation

@naliyi

@naliyi naliyi commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Everything that goes into 0.3.1. The [0.3.1] section is already in CHANGELOG.md, so merging this puts main in the state the release workflow expects.

  • fix(nipcash)CashConsolidateParams.ParseResult always decrypted new_wallet_token and returned an error if that failed, even though the merge itself had already succeeded. A bearer/connection_key target has no real pubkey yet, so the Hub delivers the token in the clear and decryption always failed for it. ParseResult now passes that token through unchanged; for a pubkey target it still decrypts with the first source's credential, but a decryption failure now preserves the raw value instead of returning an error.
    • The first commit on this branch gated decryption on a new Credential.ownIdentityPubkey method. The last commit replaces that with the simpler rule above and removes the method (it was unexported, so no API change). The changelog entry describes the final behavior.
  • feat(nip57,utils) — exports utils.ParsePayMetadataChains / utils.FetchLud16PayResponse (previously private inside the relay's profile-verification worker, which now calls the exported helper), and adds nip57.RequestZapInvoice (resolve a LUD-16 address, build and sign the zap request, fetch an invoice in one call). ZapRequestParams gains an optional Content field.
  • test(nip57) — swaps Write([]byte(fmt.Sprintf(...))) for fmt.Fprintf in the zap invoice test handlers (staticcheck QF1012, which the lint job flagged).

Closes #27

Test plan

Run locally with GOWORK=off against the module's own pinned dependencies (same as CI):

  • gofmt -l . — clean
  • go build ./...
  • go vet ./...
  • go mod tidygo.mod / go.sum unchanged
  • golangci-lint v2.13.2 — 0 issues
  • go test -race ./... — all packages pass (after the last commit, re-run for ./nipcash/...; full suite is covered by CI)

After merge

Run the Release workflow (workflow_dispatch, leave version empty) — it tags v0.3.1 from the top CHANGELOG.md entry and publishes the GitHub release.

…ash_transfer's

CashConsolidateParams.ParseResult unconditionally decrypted
new_wallet_token as if it were keyed to the caller, like cash_transfer.
cash_consolidate actually keys it to the target: plaintext for a
bearer/connection_key target, encrypted to that pubkey for a
third-party target. Both cases failed client-side with a decrypt error
even though the merge itself already succeeded on the Hub.

ParseResult now only decrypts when the target is the caller's own
pubkey (added Credential.ownIdentityPubkey to check this without
building a new proof), and otherwise passes the token through as
received.
…helper

Closes the private-vs-exported gap from issue #27: relay/verification.go's
profile worker already parsed a LUD-06 pay response's chain/* metadata
entries, but only for its own internal score, with no way for a client
to reuse that logic. utils.ParsePayMetadataChains and
utils.FetchLud16PayResponse export it directly; verification.go now
calls the exported helper instead of keeping its own copy.

Also adds nip57.RequestZapInvoice, a high-level zap helper: resolve a
recipient's LUD-16 address, build and sign the zap request, and fetch
back an invoice, in one call. ZapRequestParams gained a Content field
so a zap can carry a comment.
… tests

Fixes the three staticcheck QF1012 findings golangci-lint v2.13 reports on the RequestZapInvoice test handlers.
…eep the raw value

Replaces the ownIdentityPubkey gating from the previous nipcash fix with
a simpler rule that doesn't depend on which party the Hub keys a pubkey
target's delivery to.

ParseResult passes a bearer/connection_key target's token through
unchanged (it arrives in the clear), and for a pubkey target always
attempts to decrypt with the first source's credential. If decryption
fails it preserves the raw value instead of returning an error, since
the merge itself has already succeeded on the Hub.

Drops Credential.ownIdentityPubkey and its implementations, adds a test
for a third-party pubkey target whose delivery is encrypted to the
caller, and rewords the 0.3.1 changelog entry to match.
@naliyi
naliyi merged commit 2b5740b into main Sep 21, 2026
3 checks passed
@naliyi
naliyi deleted the release-0.3.1 branch September 21, 2026 20:46
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.

Export LUD-06 metadata chain/* parsing (relay/verification.go has it, but it's private)

1 participant