Skip to content

Commit 9c4d8f8

Browse files
committed
add sender authentication
1 parent 0cd3f84 commit 9c4d8f8

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

blip-0002.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The following table contains extension tlv fields for the `payment_onion_payload
8585

8686
| Type | Name | Link |
8787
|-------------|-----------------------------|--------------------------------|
88+
| 83231 | `sender_auth` | [bLIP 14](./blip-0014.md) |
8889
| 7629169 | `podcasting_2_0` | [bLIP 10](./blip-0010.md) |
8990

9091

blip-0014.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
```
2+
bLIP: 14
3+
Title: Sender authentication
4+
Status: Draft
5+
Author: Joost Jager <[email protected]>
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 value:
28+
29+
* [`33*byte`:`sender_pubkey`]
30+
* [`8*byte`:`timestamp`]
31+
* [`var length`:`signature`]
32+
33+
`sender_pubkey` is the public key of the sender. Note that `sender_pubkey` doesn't
34+
need to be the sender's node public key. It can also be a more general
35+
identity.
36+
37+
`timestamp` is the payment initiation time in nano seconds since unix epoch
38+
(big endian encoded).
39+
40+
`signature` is a DER-encoded ECDSA signature calculated using `sender_pubkey`
41+
over a message that is a concatenation of the following fields:
42+
43+
* `timestamp` (8 bytes)
44+
* `recipient_pubkey` (33 bytes)
45+
* `payment_hash` (32 bytes)
46+
* `payment_secret` (32 bytes)
47+
* `amount_msat` (8 bytes, big endian)
48+
49+
For multi-part payments, `amount_msat` is the total amount of the set. The
50+
value of the TLV record MUST be identical for all parts.
51+
52+
Receiver:
53+
54+
* MUST verify that `signature` is valid and produced using `sender_pubkey`.
55+
56+
* SHOULD verify that `timestamp` is not unreasonably long ago. Suggested cut-off is
57+
one hour.
58+
59+
* If verification fails, SHOULD error with
60+
`PERM|15 incorrect_or_unknown_payment_details`.
61+
62+
## Motivation
63+
64+
Example use cases:
65+
66+
* A donation payment where the donor wants to make themselves known.
67+
68+
* Regulated custodial wallets that can offer higher receive limits for payments
69+
originating from specific sources.
70+
71+
* Lightning deposits to an exchange where the exchange automatically credits the
72+
correct account based on the sender identity.
73+
74+
There are many ways to authenticate the sender of a payment in Lightning. This
75+
documentation is an attempt to prevent the emergence of too many variants that
76+
all do more or less the same thing.
77+
78+
## Rationale
79+
80+
* The TLV record key is an odd number, meaning that the record is ignored by
81+
receivers that do not support sender authentication. No feature bit is needed.
82+
83+
* It is possible to recover the public key from an ECDSA signature, so strictly
84+
speaking `sender_pubkey` is redundant. Note that with Schnorr signatures, recovery is no
85+
longer possible.
86+
87+
* It is undesired that a signature can be reused in any way. Therefore all of
88+
the identifying payment properties are covered by the signature.
89+
90+
## Test vectors
91+
92+
TBD

0 commit comments

Comments
 (0)