-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LUD-22: Payee Data. #252
Open
jklein24
wants to merge
2
commits into
lnurl:luds
Choose a base branch
from
jklein24:feat/lud22payeedata
base: luds
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
LUD-22: Payee identity data in `payRequest` protocol. | ||
================================================ | ||
|
||
`author: onthedeklein` `discussion: https://t.me/lnurl/36488` | ||
|
||
--- | ||
|
||
This is the payee-side equivalent of [LUD-18](18.md). It gives the opportunity for the payer to request that the payee provide identitifying information before the payment is made. This allows the sending `WALLET` to show information about the receiver in order to allow the payer to verify that they are paying the correct entity. This also gives the opportunity for the payee to authorize themselves via a challenge-response mechanism to provide some assurance that `SERVICE` has not been compromised. | ||
|
||
## 1. `payeeData` record | ||
|
||
If `WALLET` wants to get one or more types of payee identities/data from `SERVICE` then it MUST alter its JSON request to the second callback to include a `payeeData` query param, as follows (notice that the `payeeData` record below has a bunch of fields only for completion, an actual response will likely contain just a subset of these): | ||
|
||
```typescript | ||
{ | ||
"name": { "mandatory": boolean }, | ||
"pubkey": { "mandatory": boolean }, | ||
"identifier": { "mandatory": boolean }, | ||
"email": { "mandatory": boolean }, | ||
"auth": { | ||
"mandatory": boolean, | ||
"k1": string // hex encoded 32 bytes of challenge | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering changing the name k1 here to avoid confusion with LUD-04, since it's serving a slightly different purpose. Seeking opinions. |
||
}, | ||
"countryCode": { "mandatory": boolean }, | ||
...other fields may be negotiated | ||
}, | ||
``` | ||
|
||
This record is url-encoded and appended to the callback url as a query string, as follows: | ||
|
||
```diff | ||
- <callback><?|&>amount=<milliSatoshi> | ||
+ <callback><?|&>amount=<milliSatoshi>&payeedata=<urlencode({payeeData json object})> | ||
``` | ||
|
||
Notice that just including the payee id kind ("name", "pubkey" etc.) in the `payeeData` record is enough to signal acceptance of that kind. | ||
|
||
## 2. Responding with payee identity | ||
|
||
In response to seeing a `payeeData` record in the `payRequest` request from `WALLET`, `SERVICE` adds a `payeeData` field to the response as follows: | ||
|
||
```diff | ||
{ | ||
"pr": string, | ||
"routes": [], | ||
+ "payeeData": { | ||
+ "name": string, // free form string | ||
+ "pubkey": string, // hex(<randomly generated secp256k1 pubkey>), | ||
+ "auth": { | ||
+ "k1": string, // same as received from wallet on section 1 | ||
+ "sig": string, // hex(sign(hexToBytes(<k1>))) | ||
+ }, | ||
+ "email": string, | ||
+ "identifier": string, | ||
+ "countryCode": string, | ||
+ ...other fields may be included if supported by service and requested by wallet | ||
+ } | ||
} | ||
|
||
``` | ||
|
||
Each key in this JSON object should correspond to a requested payerdata from the `payerData` record received from `SERVICE`. | ||
|
||
`SERVICE` CAN send any of the payee id kinds if they are listed in the `payeeData` record. But if any is marked as `"mandatory": true` then `SERVICE` MUST send or otherwise do not proceed with the payment flow. | ||
|
||
`SERVICE` may choose to avoid sending any payee identity information for privacy reasons, which may cause the payment to fail if the `WALLET` requires it. For that reason, `WALLET` SHOULD NOT require any payee identity information to be sent by `SERVICE` unless it is absolutely necessary. | ||
|
||
`SERVICE` SHOULD NOT send payee identity types omitted in `payeeData` record, none at all if the record is not present. | ||
|
||
Note that LUD-22 can be used in conjunction with [LUD-18](18.md) to allow the payer to request that the payee provide identitifying information (which can be optionally verified by `SERVICE`) before sharing payee identity information. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally sure I want to mention this since it doesn't actually provide much assurance there except against particular types of attacks, where the sender already knows and remembered the payer's signing public key retrieved from some other mechanism.