• platform
  • usecases
  • learning
  • company
  • shop

Chapter 4 - Part 3

Review of TXT key functions

 

In the continuation of the fourth chapter with the topic of secure channel, in this section we will examine the TXT records and learn about the types of TXT key applications. Be with the moon.

 

TXT records 

After discovery, IPv6 addresses are returned in the AAAA records and key/value p
in the DNS‑SD TXT record. 

Nodes SHALL publish AAAA records for all their available IPv6 addresses.

TXT records available for Commissioning node discovery contain typical record key/value pairs.

 

TXT key for distinguisher (D)

The D-key MUST provide the full 12-bit identifier for the bootable node and must be present in the DNS-SD TXT record.

The distinguisher value must be encoded as a variable-length decimal number in ASCII text, with a maximum of four digits, excluding leading zeros.

Any D key with a value that does not match the above should be ignored.

 

TXT key for Vendor ID and Product ID (VP)

If the optional VP key is present, it may provide vendor ID and product ID information for the device. A seller may not include it at all for privacy reasons.

If the VP key is present, it may appear in two forms:

1. VP=123 gives the vendor ID.

2. VP=123+456 gives vendor id + product id.

Both the Vendor ID and the Product ID must be expressed as variable-length decimal numbers, encoded as ASCII text, with leading zeros omitted, and a maximum length of 5 characters each to match their 16-bit numeric range.

If the product ID is present, it must be separated from the vendor ID using a "+" character.

If a VP key exists without a product ID, the value must contain only the vendor ID alone, without the "+" character.

If a VP key is present, the value must contain at least the vendor ID.

If the VP key exists, it must not have an empty value.

 

TXT key for commission mode (CM)

The CM (Commission Mode) key should indicate whether the record publisher is currently in startup mode and available for immediate startup. In startup mode, the value corresponding to the CM key represents the password source.

There are four legal modes:

1. The absence of the CM key should indicate the value 0 (CM=0).

2. The CM=0 key/value pair should indicate that the publisher is not currently in startup mode.

3. The key/value pair CM=1 should indicate that the publisher is currently in startup mode and needs to use the password provided by Gateway to start up.

4. The key/value pair CM=2 SHALL indicates that the issuer is currently in commissioning mode and requires the use of a dynamically generated password associated with the verifier using the Open Commissioning Window command. sent to the device.

 

TXT key for device type (DT)

The optional DT key may provide the primary device type of the publisher. If the device combines multiple device types, the manufacturer must select the device type identifier of the primary function of the device for which the device wishes to be identified. If present, it must be encoded as a variable-length decimal number in ASCII text, with leading zeros removed.

 

TXT key for device name (DN)

The optional DN key may provide the advertised name of the device. If present, it must be encoded as a valid UTF-8 string with a maximum length of 32 bytes.

If provided, the source of this value MUST be user-editable and its use clearly specified for in-network advertising, and the value stored in the Node Label attribute MAY be the cluster's basic node information.

 

TXT key for device rotary identifier (RI)

The optional RI key may provide the rotary identifier of the device.

If present, the value associated with the RI key MUST contain the bytes of the rotating device identifier string, each byte represented as 2-digit hexadecimal.

The resulting ASCII string must not exceed 100 characters, which means a rotating device ID of up to 50 octets.

 

TXT key for pairing instructions (PH)

The optional PH key may provide a pairing hint. If present, it should be encoded as a variable-length decimal number in ASCII text, with leading zeros removed.

 

TXT key for pairing instructions (PI)

The optional PI key may command pairing, and the meaning of this key depends on the value of the PH key. If present, the value must be encoded as a valid UTF-8 string with a maximum length of 128 bytes.

 

Examples

The following examples simulate a node in startup mode that advertises its availability for startup.

Examples are shown using the dns-sd and avahi command-line testing tools. The dns-sd command line test tool is included in all versions of macOS. It is installed as a DOS command with Bonjour for Windows and is available on Linux by installing the mDNSResponder package. The Avahi command-line tools package from the Avahi project is available for most Linux distributions.

These examples are provided for illustrative purposes only. Real Matter gateways and endpoints do not use command-line testing tools for advertising and discovery. Real Matter gateways and endpoints use the appropriate DNS-SD APIs in their respective programming languages of choice.

Consider a device on Wi-Fi that uses the 48-bit device MAC address B75AFB458ECD as its hostname and the value DD200C20D25AE5F7 as its orderable service instance name. DNS-SD records for it can be set as follows:

 

dns-sd -R DD200C20D25AE5F7 _matterc. _udp, _S3, _L840, _CM. 11111 D=840 CM=2

or

avahi-publish-service --subtype=_S3._sub._matterc._udp
--subtype=_L840._sub._matterc._udp DD200C20D25AE5F7 --subtype=_CM._sub._matterc._udp
_matterc._udp 11111 D=840 CM=2

 

The short discriminator can be filtered through the _S3 subtype and algorithmically through the D=840 TXT key.

The long delimiter can be filtered via the _L840 subtype and directly via the D=840 TXT key.

 

In this lesson, we examined the functions of the TXT key, and in the next section, we will be with you with the continuation of the fourth chapter and the topic of the secure channel.