Clarification needed about order of items in TLVs

Hello,


I could not find any explicit requirement in the non-commercial version of the HAP specification about the ordering of items in TLVs.

For example, Chapter 4.7.2 Step 10 defines:

kTLVType_StateM2
kTLVType_PublicKey<Accessories Public Key>
kTLVType_Salt<16 Byte Salt>


Now, https://github.com/maximkulkin/esp-homekit sends out in a slightly different order:

kTLVType_StateM2
kTLVType_Salt<16 Byte Salt>
kTLVType_PublicKey<Accessories Public Key>

This seems to be no problem with an iOS Device (iPhone).


But in some use cases, the order of the items seemst to be more relevant. For example list pairing request's answer should strictly follow the order as described in the spec.

kTLVType_State
kTLVType_Identifer
kTLVType_PublicKey
kTLVType_Permission
kTLVType_Separator
kTLVType_Identifer
kTLVType_PublicKey
kTLVType_Permission
...


The question now is: does the specification implicitly define the order of TLV item? Or is it more or less free to the implementors?


Regards

Joachim