bech32.bolt11_encode
Synopsis
local bech32 = require 'bech32'
bech32.bolt11_encode(output: byte_span, hrp: string, input: byte_span, encoding_variant: "m"|nil) -> byte_span (1)
bech32.bolt11_encode(hrp: string, input: byte_span, encoding_variant: "m"|nil) -> string (2)
Description
Encode a non-compliant BECH32 variant that is friendlier to BOLT11:
-
8bit groups are not converted into 5bit groups. Input is assumed to be already 5bit clean (i.e. it’s assumed that the highest value found in each byte from
input
is0x1F
). -
MAY exceed the 90-character limit specified in BIP-0173.
output
should have at least bolt11_encode_output_length(hrp, input)
bytes.
hrp
must be all-lower case.
input
must be 5bit clean.
Returns the slice of output
that was used to encode the address.