lnurlp: bind direct receives to the metadata description hash (LUD-18 payerdata) - #3221
Closed
singap2002-code wants to merge 1 commit into
Closed
Conversation
The metadata+payerdata description hash (LUD-18) is only enforced by the proxy wrap. For direct receives it was passed down unenforced (requireDescriptionHash is only set for NIP-57 requests), so hash-incapable protocols minted invoices whose description does not hash to what the service recorded, while LUD-06 wallets verify the invoice against the fetched metadata. Bind direct receives to the plain metadata hash (keeping the zap-request hash for NIP-57) so every protocol yields an invoice consistent with what wallets verify; payer identity is already persisted via lud18Data. Closes stackernews#3220
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.
Description
Fixes #3220.
Since
ca3b05e, LN-address payments to users withproxyReceivedisabled are received directly through their attached wallet viacreateExternalReceiveInvoice(). When the payer attaches LUD-18payerdata,pay.jscomputesdescriptionHash = sha256(metadata + payerdata)and passes it down the direct path withrequireDescriptionHash: !!nostr— i.e. unenforced for LUD-18 requests.Consequences:
createBolt11FromWalletProtocols()only filtersprotocolSupportsDescriptionHashwhenrequireDescriptionHashis true, so hash-incapable protocols (LN_ADDR,LNBITS,PHOENIXD,BLINK,CLINK) mint an invoice with a plaindescriptionmemo;The payer therefore receives an invoice whose description does not hash to what the service recorded, while LUD-06 wallets bind the invoice to the fetched metadata — a mismatch that spec-conforming wallets can reject. The proxy path doesn't have this problem because the wrapped payer-facing invoice is actually minted with the
descriptionHashtag.Fix
Bind direct receives to the plain-metadata description hash (LUD-18 payer identity is persisted separately via
lud18Data), and keep the zap-request hash for NIP-57, which is already enforced viarequireDescriptionHash: !!nostr:This keeps direct receives working for every protocol (no new hard requirement for hash-capable wallets) and makes the payer-facing invoice consistent with what wallets verify.
Additional Context
relaystag #3218 / draft worker: publish NIP-57 receipts even when zap request lacks relays tag #3219 (same commit area, NIP-57 path).requireDescriptionHashfor payerdata too — but that would break LUD-18 payments for users whose only protocols lack description-hash support).Checklist
pay.js)master(d4aaf0a) and the specs (LUD-06, LUD-18)