Offer parsing from bech32 strings
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 11 Aug 2022 21:51:06 +0000 (16:51 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 18 Nov 2022 17:33:06 +0000 (11:33 -0600)
commit60d7ffce10a322ed5c6d93d23c6657ebdd87d389
tree70e7d504282782193f12b6aac6774e398c50565b
parentf1428fdf129ad8a850af8481b2eb6a04119a41ea
Offer parsing from bech32 strings

Add common bech32 parsing for BOLT 12 messages. The encoding is similar
to bech32 only without a checksum and with support for continuing
messages across multiple parts.

Messages implementing Bech32Encode are parsed into a TLV stream, which
is converted to the desired message content while performing semantic
checks. Checking after conversion allows for more elaborate checks of
data composed of multiple TLV records and for more meaningful error
messages.

The parsed bytes are also saved to allow creating messages with mirrored
data, even if TLV records are unknown.
lightning/src/offers/mod.rs
lightning/src/offers/offer.rs
lightning/src/offers/parse.rs [new file with mode: 0644]
lightning/src/util/ser_macros.rs