Skip to content

bbqr: base32 and zlib encodings - #177

Closed
odudex wants to merge 9 commits into
bwk-bitcoin:masterfrom
odudex:bbqr-base32-zlib
Closed

odudex wants to merge 9 commits into
bwk-bitcoin:masterfrom
odudex:bbqr-base32-zlib

Conversation

@odudex

@odudex odudex commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Adds the two BBQr encodings every receiver must support, base32 (2) and zlib (Z), next to hex. Stacked on bbqr-equal-parts #176: only the last six commits are new.

What changes

  • bwk-bbqr reads and writes H, 2 and Z parts. Inflate and the compressor (1024-byte window, as zlib's wbits=-10) are in-house, so there is no new runtime dependency. miniz_oxide is a dev-dependency, for
    differential tests only.
  • bwk-qr's Encoder now writes zlib by default and falls back to base32 when compression does not shrink the payload, as the reference does.
    Encoder::with_bbqr_encoding picks another encoding. A reader that only knows hex cannot read the new default.
  • The file type is still B only.

Liana

With this bwk Liana sends B$ZB or B$2B parts instead of B$HB. Kern reads them, and BIP 377 is transport-agnostic, so I'd keep the zlib default. A hex-only signer would stop reading Liana's requests; the opt-out is .with_bbqr_encoding(Encoding::Hex) at liana-gui/src/airgap/animation.rs:104. doc/QR_EXCHANGE.md:8 should say the device must read zlib and base32 parts.

All QR code exchanges have both less frames and lower densities, improving reliability and UX.

Tested with Liana (pythcoiner/liana@95ba4b2) and Kern (odudex/Kern@c2adbd8)

@pythcoiner

Copy link
Copy Markdown
Collaborator

merged #182 that is a variant of this, thanks!

@pythcoiner pythcoiner closed this Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants