commit 548f2e701fcb3b20e7f9c52d23d276958912304d Author: Scott Garrett Date: Sun Aug 23 20:48:38 2026 -0400 Initial commit. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..455cf18 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,101 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## What this is + +A collection of Matter commissioning QR decoders (the `MT:` URI format used by +Matter/CHIP devices). Users either paste an `MT:` URI or scan a QR code; the +result shows the decoded payload (version, vendor/product IDs, commissioning +flow, discovery capabilities, discriminator, passcode). Three artifacts: + +- `matter-qr-decoder.html` — the single-file browser app (Vue 3 + Bootstrap). +- `matter-decode.sh` — a pure-bash CLI port of the same decode logic (no camera + scanning; takes a URI as an argument or on stdin). +- `manufacturers.tsv` — `vendor ID → name` table (~900 rows), shared by both + tools and optional (a missing file only drops the vendor-name lookup). +- `gen-manufacturers.py` — Python 3 stdlib script that regenerates + `manufacturers.tsv`. Default source is the upstream `manufacturers.xml` + **fetched over the network** (via `curl`; a GitHub `blob/` URL is auto-rewritten + to its `raw.githubusercontent.com` form). A positional arg overrides with + another URL or a local XML file; passing `matter-qr-decoder.html` uses the + embedded `` block as an offline fallback. Reproduces the committed TSV + byte-for-byte. +- `README.md` — user-facing docs; this file documents the internals. + +## Commands + +There is **no build, test, lint, or package step** — this is not a git repo and has no +`package.json`. The entire app is one HTML file that runs in the browser: + +- Run/develop: open `matter-qr-decoder.html` in a modern browser and edit it directly. +- Camera scanning (`getUserMedia`) requires a **secure context** — serve over HTTPS or + `localhost` (e.g. `python3 -m http.server` then open `http://localhost:8000`). +- The "Scan QR" feature uses the `BarcodeDetector` API, which is **Chromium-only** + (Chrome/Edge). Firefox/Safari fall back to a "not supported" message; paste-input works everywhere. +- The page loads Vue 3, Bootstrap 5.3, and Bootstrap Icons from CDNs, so it needs network access. + +## Architecture + +Everything lives in `matter-qr-decoder.html` (~1500 lines). Two regions matter: + +1. **App logic** (the `', + html, re.DOTALL | re.IGNORECASE) + if not m: + sys.exit('error: no + + + +
+
+
+
+ ← Tools +

Matter QR Code Decoder

+
+
+ +
+
+
+
+
Input
+
+
+
+ +
+ + +
+
Enter a Matter QR code URI starting with "MT:" or scan a QR code
+
+ +
+ + +
+
+
+
Camera Preview
+ +
+
+ + +
+
+
+ +
+ {{ scanError }} +
+ +
+ {{ errorMessage }} +
+
+
+ +
+
+
+
Decoded Payload
+
+
+
+ + Enter a Matter QR code URI to see decoded information. +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + +
Version:{{ decodedData.version }}
Vendor ID: + {{ formatVendorId(decodedData.vendorId) }} +
+ {{ vendorName }} +
+
Product ID:{{ formatProductId(decodedData.productId) }}
Custom Flow:{{ getCustomFlowName(decodedData.customFlow) }}
+
+
+ + + + + + + + + + + + + + + +
Discovery:{{ getDiscoveryCapabilities(decodedData.discoveryCapabilities) }}
Discriminator:{{ decodedData.discriminator }}
Passcode:{{ decodedData.passcode }}
+
+
+
+
+
+ +
+
+
Data Encoding Format
+
+
+
+

Matter QR Format: MT:<base38-encoded-data>

+ +

Bit Field Layout (84 bits total):

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldBitsPositionDescription
Version30-2QR format version (0-7)
Vendor ID163-18CSA-assigned vendor identifier
Product ID1619-34Vendor-assigned product identifier
Custom Flow235-36Commissioning flow type (0-3)
Discovery Caps837-44Supported discovery methods
Discriminator1245-56Device discriminator (0-4095)
Passcode2757-83Setup passcode (1-99999998)
+ +

Base38 Encoding: Uses character set 0-9A-Z-. (38 chars total)

+
    +
  • 5 base38 chars → 3 bytes (most efficient)
  • +
  • 4 base38 chars → 2 bytes
  • +
  • 2 base38 chars → 1 byte
  • +
+ +

Discovery Capabilities Bits:

+
    +
  • Bit 0: SoftAP support
  • +
  • Bit 1: BLE support
  • +
  • Bit 2: On IP Network support
  • +
+
+
+
+
+
+
+
+ +
+
+
+ Blog + Tools +
+ © 2025 Tommie Gannert. All rights reserved. +
+
+
+ + + + +