decode_qr_payload

Function decode_qr_payload 

Source
pub fn decode_qr_payload(qr: &str) -> Result<OnboardingInfo>
Expand description

Decode a Matter QR code payload (the MT:... string, with or without the MT: prefix).

The payload is a Base38-encoded 88-bit integer with the following layout (LSB first):

  • bits 0- 2 : version (3 bits)
  • bits 3-18 : vendor ID (16 bits)
  • bits 19-34 : product ID (16 bits)
  • bits 35-36 : custom flow (2 bits)
  • bits 37-43 : discovery capabilities (7 bits, we use low 3)
  • bits 44-55 : discriminator (12 bits)
  • bits 56-82 : passcode (27 bits)
  • bits 83-87 : padding (5 bits, must be zero)