Stateless verification of Invoice for Refund
authorJeffrey Czyz <jkczyz@gmail.com>
Mon, 6 Feb 2023 21:30:44 +0000 (15:30 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Thu, 20 Apr 2023 02:31:07 +0000 (21:31 -0500)
commit2298af4d0b008d844eed12444948339ba7557de7
tree4c5e3f6fef17e2b9ae1e0c8f07f475bba1c507f3
parent1a7540f2c936ec778e76050f22371829dbfa9255
Stateless verification of Invoice for Refund

Stateless verification of Invoice for Offer

Verify that an Invoice was produced from a Refund constructed by the
payer using the payer metadata reflected in the Invoice. The payer
metadata consists of a 128-bit encrypted nonce and possibly a 256-bit
HMAC over the nonce and Refund TLV records (excluding the payer id)
using an ExpandedKey.

Thus, the HMAC can be reproduced from the refund bytes using the nonce
and the original ExpandedKey, and then checked against the metadata. If
metadata does not contain an HMAC, then the reproduced HMAC was used to
form the signing keys, and thus can be checked against the payer id.
lightning/src/offers/invoice.rs
lightning/src/offers/invoice_request.rs
lightning/src/offers/refund.rs