BECH32(3em)

πŸ“¦ version 1.1.1, in nixos 26.05, nixpkgs unstable

πŸŽ€ 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 output that was used to decode the address πŸŽ€.
  • the encoding variant β€” or nil on 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