Documentation
¶
Overview ¶
Package bbqr implements the BBQr ("Better Bitcoin QR") protocol: splitting binary data into a series of QR-code text payloads and joining them back.
This is a clean-room Go port of the public-domain reference implementation by Coinkite (github.com/coinkite/BBQr). It is byte-for-byte compatible with that reference for the Hex ('H') and Base32 ('2') encodings, which is validated by golden vectors generated from the Python reference (see testdata/). The Zlib ('Z') encoding is decode-only for now (Join handles it; Split does not yet emit it - see encode.go).
Each part is an 8-character header followed by the encoded body:
B$ fixed protocol magic (2 chars) <enc> one char: '2'=Base32, 'H'=Hex, 'Z'=Zlib+Base32 <type> one char file type: 'B'=Binary, 'P'=PSBT, ... <NN> two base36 digits: total number of parts (1..1295) <nn> two base36 digits: index of this part (0-based)
All characters are within the QR "alphanumeric" charset so encoders can use the dense 5.5-bit-per-char mode.
Index ¶
Constants ¶
const ( EncBase32 byte = '2' EncHex byte = 'H' EncZlib byte = 'Z' )
Encoding codes.
const ( TypePSBT byte = 'P' TypeTxn byte = 'T' TypeJSON byte = 'J' TypeCBOR byte = 'C' TypeUnicode byte = 'U' TypeExec byte = 'X' TypeBinary byte = 'B' )
File type codes (FILETYPE_NAMES in the reference).
const HeaderLen = 8
HeaderLen is the fixed BBQr header length in characters.
Variables ¶
var ErrEncodeNotImplemented = errors.New("bbqr: requested encoding not implemented on encode side yet (use '2' or 'H')")
ErrEncodeNotImplemented is returned by Split when asked to produce an encoding that is not yet implemented on the encode side (auto/Zlib).
Functions ¶
Types ¶
type Header ¶
Header holds the parsed fields of a BBQr part header.
func ParseHeader ¶
ParseHeader parses the 8-char header of a single BBQr part string.