bitcoinjs / bolt11

A library for encoding and decoding lightning network payment requests as defined in BOLT #11.
MIT License
92 stars 64 forks source link

Alternate Fix: Skip unknown tagged fields #16

Closed junderw closed 5 years ago

junderw commented 5 years ago

Alternative to #15

There should be a way to encode unknown tags so that you can re-encode decoded payment requests.

canReconstruct check should make sure that people do not create random tags, but still allow for decoding and reconstructing with encode.

junderw commented 5 years ago

OR an f field with unknown version, OR p, h, or n fields that do NOT have data_lengths of 52, 52, or 53, respectively.

Might need to work on this more... We should avoid parsing the wrong-version fallback address and avoid parsing the p, h, n of wrong lengths, but still keep them in the tags for reconstruction.

unknownTag type should maybe be changed to "invalid tag" or something... Then we can pipe any incorrect tags into that format. (encode with bech32 should be fine)

Not just unknown tags, but tags that are invalid...

junderw commented 5 years ago

meh, on second thought. just allowing for unknown tags should be fine for now...

junderw commented 5 years ago

@cavanmflynn Published to npm in v1.2.5