Skip to content

Implement DSK utilities and QR code parser #157

@dfederm

Description

@dfederm

The Device Specific Key (DSK) is a 16-byte identifier unique to each S2-capable device. It's represented as a string ("34028-23669-20938-46346-33746-07431-56821-14553" - 8 groups of 5 decimal digits each representing 2 bytes). The QR code encodes the DSK plus metadata in a TLV-based binary format.

Scope:

  • DSK type in ZWave.Protocol: a 16-byte value type with:
    • Parse(string) / ToString() - convert to/from the "XXXXX-XXXXX-..." format
    • Pin property - first 5 digits (first 2 bytes), used for S2 authentication
    • NwiHomeId / AuthHomeId - derived HomeIDs for SmartStart Prime matching
    • TryParse, validation, equality/hashing
  • QR code parser: Parse the Z-Wave QR code data string (starts with "90" prefix):
    • Extract DSK (always present)
    • Parse TLV blocks: Product Type (0x00), Product ID (0x01), Max Inclusion Request Interval (0x02), UUID16 (0x03), Supported Protocols (0x04)
    • Extract requested security classes bitmask
    • Checksum validation (CRC-16 per spec)
  • Unit tests with known DSK/QR test vectors

Design notes: The DSK type should be a readonly record struct in ZWave.Protocol since it's used across layers. The QR parser can live in a new utility class. Make the DSK a proper value type - C# structs are ideal for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions