bech32.bolt11_decode

Synopsis

local bech32 = require 'bech32'

bech32.bolt11_decode(output: byte_span, input: byte_span|string) -> string, byte_span, "m"|nil (1)
bech32.bolt11_decode(input: byte_span|string) -> string, byte_span, "m"|nil (2)

Description

Decode a non-compliant BECH32 variant that is friendlier to BOLT11:

  • 5bit groups are not converted into 8bit groups (i.e. the highest value you’ll be able to find in each byte from the returned slice is 0x1F).

  • MAY exceed the 90-character limit specified in BIP-0173.

output should have at least bolt11_decode_output_length(input) bytes.

Returns a tuple with the following elements:

  • The lower-case version of the human-readable part.

  • The slice of output that was used to decode the address.

  • The encoding variant (or nil on none).