|  | 
|  | 1 | +``` | 
|  | 2 | +bLIP: 11 | 
|  | 3 | +Title: Sender authentication | 
|  | 4 | +Status: Draft | 
|  | 5 | +Author: Joost Jager <joost.jager@gmail.com> | 
|  | 6 | +Created: 2022-02-04 | 
|  | 7 | +License: CC0 | 
|  | 8 | +``` | 
|  | 9 | + | 
|  | 10 | +## Abstract | 
|  | 11 | + | 
|  | 12 | +By default, the lightning protocol protects the sender identity by means of | 
|  | 13 | +ephemeral keys and onion routing. There are however use cases that ask for | 
|  | 14 | +inclusion of the sender identity with a payment. | 
|  | 15 | + | 
|  | 16 | +This bLIP serves to document a way to authenticate the sender of a payment via a | 
|  | 17 | +custom TLV record. | 
|  | 18 | + | 
|  | 19 | +## Copyright | 
|  | 20 | + | 
|  | 21 | +This bLIP is licensed under the CC0 license. | 
|  | 22 | + | 
|  | 23 | +## Specification | 
|  | 24 | + | 
|  | 25 | +Sender: | 
|  | 26 | + | 
|  | 27 | +* MUST include a TLV record keyed by type `83231` with the following TLV value: | 
|  | 28 | +   * [`33*byte`:`pubkey`] | 
|  | 29 | +   * [`32*byte`:`hmac`] | 
|  | 30 | + | 
|  | 31 | +  `pubkey` is set to the public key of the sender. Note that `pubkey` doesn't | 
|  | 32 | +  need to be the sender's node public key. It can also be a more general | 
|  | 33 | +  identity. | 
|  | 34 | +   | 
|  | 35 | +  `hmac` is calculated over `payment_secret`, using a shared secret as the key. | 
|  | 36 | +  This shared secret is calculated using Elliptic-curve Diffie-Hellman between | 
|  | 37 | +  sender private key and receiver public key. | 
|  | 38 | + | 
|  | 39 | +Receiver: | 
|  | 40 | + | 
|  | 41 | +* Derives the shared secret key using Elliptic-curve Diffie-Hellman between | 
|  | 42 | +  `pubkey` and receiver private key. | 
|  | 43 | +* Verifies `hmac` using the shared secret. | 
|  | 44 | +* If verification fails, SHOULD error with | 
|  | 45 | +  `PERM|15 incorrect_or_unknown_payment_details`. | 
|  | 46 | + | 
|  | 47 | +## Motivation | 
|  | 48 | + | 
|  | 49 | +There are many ways to authenticate the sender of a payment in Lightning. This | 
|  | 50 | +documentation is an attempt prevent the emergence of too many variants that all | 
|  | 51 | +do more or less the same thing. | 
|  | 52 | + | 
|  | 53 | +## Rationale | 
|  | 54 | + | 
|  | 55 | +* The TLV record key is an odd number, meaning that the record is ignored by | 
|  | 56 | +  receivers that do not support sender authentication. No feature bit is needed. | 
|  | 57 | + | 
|  | 58 | +* The choice for Diffie-Hellman rather than a signature is to preserve the | 
|  | 59 | +  privacy of the sender as much as possible. Senders are authenticating | 
|  | 60 | +  themselves to receivers, but receivers cannot prove anything to a third party | 
|  | 61 | +  because they could have made up the proof themselves. | 
|  | 62 | + | 
|  | 63 | +* `hmac` is calculated over `payment_secret` and not `payment_hash`. With | 
|  | 64 | +  `payment_hash`, an intermediate node could possibly attempt to pay to the same | 
|  | 65 | +  hash authenticated with their own identity key. | 
0 commit comments