author: akumaigorodski author: hampus_s discussion: https://t.me/lnurl/14436 author: fiatjaf author: dpad85 discussion: https://t.me/lnurl/24003 discussion: https://github.com/fiatjaf/lnurl-rfc/pull/101
The idea here is that the payer can identify itself when paying. The scope varies from free-form names (or LUD-16 internet identifiers) useful for loose identification in comments or similar things, to cryptographic keys for proof of payment, to authentication keys for future login into a
SERVICE’s website after a payment and other use cases.
Aside from that, the payer ids are also committed to the invoice by means of the descriptionHash property, which ensures strong cryptographic guarantees for proof of payment.
1. payerData record
If SERVICE wants to get one or more types of payer identities from WALLET then it MUST alter its JSON response to the first callback to include a payerData field, as follows (notice that the payerData record below has a bunch of fields only for completion, an actual response will likely contain just a subset of these):
payerData record is enough to signal acceptance of that kind.
2. Specifying payer identity before sending a payment
In response to seeing apayerData record in the initial response from SERVICE, WALLET attaches a payerdata query parameter to LNURL-PAY callback with value set to a JSON object:
payerData record received from SERVICE.
WALLET CAN send any of the payer id kinds if they are listed in the payerData record. But if any is marked as "mandatory": true then WALLET MUST send or otherwise do not proceed with the payment flow.
WALLET SHOULD NOT send payer identity types omitted in payerData record, none at all if record is not present.
3. Committing payer to the invoice
IfSERVICE requests (section 1) and WALLET sends a payerdata record in the callback (section 2), the payer ids MUST be committed to the metadata before the invoice is created.
SERVICE MUST append it to the metadata as it was received (after url-decoding), as in the following example:
SERVICE proceeds to hash the metadata and include that hash in the generated BOLT11 invoice as the descriptionHash field.
On its own side, WALLET MUST do the same thing before hashing the metadata and checking its hashed value against the descriptionHash field of the invoice received from SERVICE.
Even if WALLET sends more payerdata fields than requested by SERVICE, SERVICE MUST still append everything as received.
WALLET MUST NOT expect SERVICE to append the identity records to the metadata if SERVICE hadn’t included the payerData record in the first response, as that would mean SERVICE doesn’t understand LUD-18 at all.