BECH32(3em)
π NAME π
okay so this is the bech32 page from the 3em manual, and it's literally the bech32 codec π
. bestie, we're decoding a very specific little variant, so stay with me π«Ά.
β¨ 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)
so there are two call shapes, numbered (1) and (2) above β one takes output plus input, and the other takes just input. both hand you back that same string, byte_span, "m"|nil tuple situation πΈ.
π DESCRIPTION π
okay so this decodes a non-compliant BECH32 variant that is friendlier to BOLT11 β yes, it's giving "special little guy" energy, and we love that for it π₯.
here's the tea:
- the 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π. - it MAY exceed the 90-character limit specified in
BIP-0173, so do not come in here expecting vanilla BIP-0173 behavior, bestie π.
output should have at least bolt11_decode_output_length(input) bytes. like, that's the requirement β don't skimp on the output buffer π.
it returns a tuple with these elements:
- the lower-case version of the human-readable part β lowercase era, periodt β¨.
- the slice of
outputthat was used to decode the address π. - the encoding variant β or
nilon none π¦.
π real talk: this is a non-compliant BECH32 variant, so the vibe check is "friendlier to BOLT11", not "standard BIP-0173 rules apply." iykyk π
.
β¨ that's the whole page, bestie β this bech32(3em) manual is from Emilua 0.12.1, dated 1980-01-01. mwah ππ«Ά
π¦ where this page comes from
- nixos 26.05: emilua-bech32 1.1.1
- nixpkgs unstable: emilua-bech32 1.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms