Matter QR onboarding payload
A list of Matter commissioning QR strings was copied from the packaging labels of smart home devices in a warehouse: onboarding.txt. Each string consists of a Base38-encoded byte stream with the MT:... prefix (Matter Core Specification 5.1.3 and 5.1.4).
1. The Base38 rule: Alphabet: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. (38 characters, 0..37). Every 5 Base38 characters represent a 3-byte little-endian (LE) integer, the 4 characters left at the end represent a 2-byte LE number, and 2 characters represent 1 byte (in each group the first character is the least significant place: v = c0 + c1*38 + c2*38^2 + ...).
2. 88-bit (11-byte) bit fields (LSB-first): The first 11 bytes decoded (88 bits, starting from bit 0) are laid out in the following order:
• Version: 3 bits (must be 0)
• Vendor ID: 16 bits (SamSU SmartHome identifier = 0x1337)
• Product ID: 16 bits
• Custom Flow: 2 bits (custom flow = 2)
• Discovery Capabilities: an 8-bit bitmask (the BLE bit — 0x04 must be set)
• Discriminator: 12 bits
• Passcode: 27 bits
• Padding: 4 bits (must be 0)
3. Optional Matter TLV data (after byte 11): Between 0x15 (the start of the Structure) and 0x18 (its end) are the 0x2C <tag: 1 bayt> <len: 1 bayt> <UTF-8 satr> elements. From the list, find the device that satisfies all the bit conditions above (VendorID=0x1337, CustomFlow=2, DiscoveryCaps & 0x04 != 0, Padding=0) and take BAYROQ{...} from its 0x82 (active provisioning token) TLV tag (do not be fooled by the 0x80 test tag!). (Flag format: BAYROQ{MATTER_QR_<16 kichik hex>}).