Skip to content

Commit 0d74c69

Browse files
committed
add sender authentication
1 parent 0cd3f84 commit 0d74c69

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-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

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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 timestamp in nano seconds since unix epoch (big endian encoded).
38+
39+
`signature` is a DER-encoded ECDSA signature calculated using `sender_pubkey`
40+
over a message that is a concatenation of the following fields:
41+
42+
* `timestamp` (8 bytes)
43+
* `recipient_pubkey` (33 bytes)
44+
* `payment_hash` (32 bytes)
45+
* `payment_secret` (32 bytes)
46+
* `amount_msat` (8 bytes, big endian)
47+
48+
Receiver:
49+
50+
* MUST verifiy that `signature` is valid and produced using `sender_pubkey`.
51+
52+
* SHOULD verify that `timestamp` is not unreasonably long ago. Suggested cut-off is
53+
one hour.
54+
55+
* If verification fails, SHOULD error with
56+
`PERM|15 incorrect_or_unknown_payment_details`.
57+
58+
## Motivation
59+
60+
There are many ways to authenticate the sender of a payment in Lightning. This
61+
documentation is an attempt prevent the emergence of too many variants that all
62+
do more or less the same thing.
63+
64+
## Rationale
65+
66+
* The TLV record key is an odd number, meaning that the record is ignored by
67+
receivers that do not support sender authentication. No feature bit is needed.
68+
69+
* It is possible to recover the public key from an ECDSA signature, so strictly
70+
speaking `sender_pubkey` is redundant. Note that with Schnorr signatures, recovery is no
71+
longer possible.
72+
73+
* It is undesired that a signature can be reused in any way. Therefore all of
74+
the identifying payment properties are covered by the signature.
75+
76+
## Test vectors
77+
78+
TBD

0 commit comments

Comments
 (0)