Context
For LNURL-pay (LUD-06), the bolt11 invoice's description_hash must equal sha256(metadata) where metadata is the exact UTF-8 string returned in the pay params metadata field. Wallets that verify this will reject a mismatched invoice.
src/Invoice/Domain/BackendInvoice/LnbitsBackendInvoice.php — sends to LNbits:
'unhashed_description' => bin2hex($metadata),
'description_hash' => hash('sha256', $metadata),
src/Invoice/Application/InvoiceGenerator.php — builds metadata via LnurlPayMetadata and passes it to requestInvoice().
src/Shared/Value/LnurlPayMetadata.php — the metadata string builder.
Goal
Verify and, if needed, fix that the invoice returned to the wallet carries description_hash == sha256(metadata) using the same metadata string advertised in the pay params — so real wallets accept the invoice.
Scope / Tasks
Implementation notes
- The pay-params metadata and the invoice metadata must be byte-identical — both already flow from
LnurlPayMetadata; keep it that way.
- Back any claim about LNbits behavior with the LNbits API docs or a real response sample (do not assume) — see repo convention on evidence-backed external-API claims.
Acceptance criteria
References
Context
For LNURL-pay (LUD-06), the bolt11 invoice's
description_hashmust equalsha256(metadata)wheremetadatais the exact UTF-8 string returned in the pay paramsmetadatafield. Wallets that verify this will reject a mismatched invoice.src/Invoice/Domain/BackendInvoice/LnbitsBackendInvoice.php— sends to LNbits:src/Invoice/Application/InvoiceGenerator.php— buildsmetadataviaLnurlPayMetadataand passes it torequestInvoice().src/Shared/Value/LnurlPayMetadata.php— the metadata string builder.Goal
Verify and, if needed, fix that the invoice returned to the wallet carries
description_hash == sha256(metadata)using the same metadata string advertised in the pay params — so real wallets accept the invoice.Scope / Tasks
unhashed_descriptionanddescription_hashare supplied — determine whether they can conflict and which one LNbits honors. Send only what's needed (likely justunhashed_description, letting LNbits hash it, OR just the correctdescription_hash), backed by the LNbits API docs.bin2hex($metadata)is the encoding LNbits expects forunhashed_description(hex of the raw metadata bytes) and that the resulting invoice's description_hash matchessha256(metadata).HttpApiInterfaceencodes the metadata such thatdescription_hash == sha256(metadata)(stub the HTTP layer and assert on the request body).Implementation notes
LnurlPayMetadata; keep it that way.Acceptance criteria
description_hash == sha256(metadata).composer test-allgreen.References