01a051eb - Reject non-NIP-57 forum invoices before showing a QR - #76
Conversation
POST /messages/:id/invoice now returns { pr, amountSats } only when the
minted BOLT11 description_hash matches the zap request. Plaintext LN
invoices are persisted as not_zap for debug and rejected with 400 so
the client never shows a QR that cannot produce a kind:9735 receipt.
The ok persist path stores a literal true after the gate, so the handbook Used-by line must not claim a second call.
9266ab0 to
4c1d78c
Compare
The 100% branch gate failed on inspected?.paymentHash when inspectBolt11 returns null (malformed LNURL invoice). Persist still stores the pr.
|
EN: DE: DetailsReview: two quality+logic passes on the invoice-gate diff (first quality pass: handbook Used-by claimed a second |
EN:
Forum pay now returns a Lightning invoice only when it is a NIP-57 zap invoice (
description_hashof the kind:9734 request). A Wallet of Satoshi-style plaintext invoice is stored asnot_zapfor operators and rejected with 400, so the app never shows a QR for a payment the forum cannot credit. Sats still increment only on a validated kind:9735 receipt.DE:
Die Forum-Zahlung gibt eine Lightning-Rechnung nur noch aus, wenn sie eine NIP-57-Zap-Rechnung ist (
description_hashder kind:9734-Anfrage). Eine Klartext-Rechnung wie bei Wallet of Satoshi wird alsnot_zapgespeichert und mit 400 abgelehnt, damit die App keinen QR für eine Zahlung zeigt, die das Forum nicht gutschreiben kann. Sats steigen weiterhin nur durch eine geprüfte kind:9735-Quittung.Details
Problem:
POST /messages/:id/invoicereturned any LNURL-pay BOLT11 after a successful zap fetch. Some wallets (notably Wallet of Satoshi) mint a plaintext-description invoice even whenallowsNostris true. Paying that invoice does not produce a NIP-57 kind:9735 receipt, so the forum never credits sats while the payer's funds are gone.Change: after
requestZapInvoicesucceeds, inspect the BOLT11 and callisNip57Invoiceonce. Return{ pr, amountSats }only when the invoicedescription_hashequals SHA-256 of the zap-request JSON. Otherwise persistresult: 'not_zap'with the rejectedpr(debug listing), HTTP 400{ "error": "Could not start the Bitcoin payment" }, and noprin the body.noZap(LNURL without Nostr) stays a separate result.Tests spy
isNip57Invoicetrue on existing HTTP 200 invoice paths (fakelnbc21n1testis not a real NIP-57 invoice) and add a Wallet of Satoshi plaintext case that must 400 /not_zap. SPEC and handbook updated. No SQL change (message_invoice.resultis text).