Skip to content
This repository was archived by the owner on May 2, 2026. It is now read-only.

Add QR payload decompression for pairing flow#7

Merged
filinvadim merged 1 commit intomainfrom
claude/compress-nodeauthinfo-CWZ4u
Apr 26, 2026
Merged

Add QR payload decompression for pairing flow#7
filinvadim merged 1 commit intomainfrom
claude/compress-nodeauthinfo-CWZ4u

Conversation

@filinvadim
Copy link
Copy Markdown
Member

Summary

Adds support for decoding Brotli-compressed, Base45-encoded QR payloads in the pairing flow. The fat node now ships pairing QR codes with compression to fit more data within QR alphanumeric mode constraints.

Key Changes

  • New QrPayloadCodec class: Decodes QR payloads that are Brotli-compressed and Base45-encoded per RFC 9285, while maintaining backward compatibility with plain JSON payloads (legacy/manual paste scenarios)
  • Inline Base45 implementation: RFC 9285 Base45 codec (~50 lines) implemented directly to avoid adding a transitive dependency for minimal functionality
  • Updated AuthNodeInfoValidator: Modified to decompress payloads via QrPayloadCodec.decode() before JSON parsing, with proper error handling for malformed payloads
  • Added Brotli dependency: Pure-Java Brotli decoder (org.brotli:dec) for decompression

Implementation Details

  • The codec gracefully handles both compressed (Base45-encoded) and uncompressed (plain JSON) payloads by checking if the input starts with {
  • Comprehensive error handling distinguishes between invalid Base45 encoding and Brotli decompression failures
  • The Base45 alphabet (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:) is a strict subset of QR alphanumeric mode, enabling efficient packing of 5.5 bits per character vs. 8 bits in byte mode

https://claude.ai/code/session_011638L4REv78jEVUjQsniPz

The fat node now ships the full AuthNodeInfo Brotli-compressed and
Base45-encoded so the QR carries every dial field instead of the trimmed
subset the previous frontend sent. Decode the scanned (or pasted) payload
through QrPayloadCodec before handing it to the JSON parser. Plain-JSON
input is passed through unchanged so legacy desktops and manual paste
flows still validate.

Pulls in org.brotli:dec for the decompression step; the Base45 codec is
inlined to avoid another transitive on the transport module.
@filinvadim filinvadim merged commit a89c616 into main Apr 26, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants