@matter/protocol 0.16.0-alpha.0-20250812-285b75d83 → 0.16.0-alpha.0-20250815-ac9fd6eb0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/dist/cjs/advertisement/ble/BleAdvertisement.js +1 -1
  2. package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts +2 -2
  3. package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
  4. package/dist/cjs/ble/Ble.d.ts +2 -2
  5. package/dist/cjs/ble/Ble.d.ts.map +1 -1
  6. package/dist/cjs/ble/Ble.js.map +1 -1
  7. package/dist/cjs/ble/BtpSessionHandler.d.ts +6 -6
  8. package/dist/cjs/ble/BtpSessionHandler.d.ts.map +1 -1
  9. package/dist/cjs/ble/BtpSessionHandler.js +9 -9
  10. package/dist/cjs/ble/BtpSessionHandler.js.map +1 -1
  11. package/dist/cjs/certificate/AttestationCertificateManager.d.ts +5 -5
  12. package/dist/cjs/certificate/AttestationCertificateManager.d.ts.map +1 -1
  13. package/dist/cjs/certificate/AttestationCertificateManager.js +2 -2
  14. package/dist/cjs/certificate/AttestationCertificateManager.js.map +1 -1
  15. package/dist/cjs/certificate/CertificateAuthority.d.ts +5 -5
  16. package/dist/cjs/certificate/CertificateAuthority.d.ts.map +1 -1
  17. package/dist/cjs/certificate/CertificateAuthority.js +6 -3
  18. package/dist/cjs/certificate/CertificateAuthority.js.map +1 -1
  19. package/dist/cjs/certificate/ChipPAAuthorities.d.ts +8 -8
  20. package/dist/cjs/certificate/DeviceCertification.d.ts +9 -9
  21. package/dist/cjs/certificate/DeviceCertification.d.ts.map +1 -1
  22. package/dist/cjs/certificate/DeviceCertification.js +2 -3
  23. package/dist/cjs/certificate/DeviceCertification.js.map +1 -1
  24. package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts +1 -1
  25. package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
  26. package/dist/cjs/certificate/kinds/AttestationCertificates.js.map +1 -1
  27. package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts +4 -4
  28. package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
  29. package/dist/cjs/certificate/kinds/CertificationDeclaration.js.map +1 -1
  30. package/dist/cjs/certificate/kinds/Icac.d.ts +3 -3
  31. package/dist/cjs/certificate/kinds/Icac.d.ts.map +1 -1
  32. package/dist/cjs/certificate/kinds/Icac.js +2 -2
  33. package/dist/cjs/certificate/kinds/Icac.js.map +1 -1
  34. package/dist/cjs/certificate/kinds/Noc.d.ts +3 -3
  35. package/dist/cjs/certificate/kinds/Noc.d.ts.map +1 -1
  36. package/dist/cjs/certificate/kinds/Noc.js +2 -2
  37. package/dist/cjs/certificate/kinds/Noc.js.map +1 -1
  38. package/dist/cjs/certificate/kinds/OperationalBase.d.ts +2 -1
  39. package/dist/cjs/certificate/kinds/OperationalBase.d.ts.map +1 -1
  40. package/dist/cjs/certificate/kinds/OperationalBase.js +2 -2
  41. package/dist/cjs/certificate/kinds/OperationalBase.js.map +1 -1
  42. package/dist/cjs/certificate/kinds/Rcac.d.ts +3 -3
  43. package/dist/cjs/certificate/kinds/Rcac.d.ts.map +1 -1
  44. package/dist/cjs/certificate/kinds/Rcac.js +2 -2
  45. package/dist/cjs/certificate/kinds/Rcac.js.map +1 -1
  46. package/dist/cjs/certificate/kinds/X509Base.d.ts +11 -11
  47. package/dist/cjs/certificate/kinds/X509Base.d.ts.map +1 -1
  48. package/dist/cjs/certificate/kinds/X509Base.js +1 -1
  49. package/dist/cjs/certificate/kinds/X509Base.js.map +1 -1
  50. package/dist/cjs/certificate/kinds/common.d.ts +2 -2
  51. package/dist/cjs/certificate/kinds/common.d.ts.map +1 -1
  52. package/dist/cjs/certificate/kinds/common.js +2 -2
  53. package/dist/cjs/certificate/kinds/common.js.map +1 -1
  54. package/dist/cjs/certificate/kinds/definitions/base.d.ts +7 -6
  55. package/dist/cjs/certificate/kinds/definitions/base.d.ts.map +1 -1
  56. package/dist/cjs/certificate/kinds/definitions/base.js.map +1 -1
  57. package/dist/cjs/certificate/kinds/definitions/certification-declaration.d.ts +1 -1
  58. package/dist/cjs/certificate/kinds/definitions/operational.d.ts +21 -21
  59. package/dist/cjs/codec/BtpCodec.d.ts +12 -11
  60. package/dist/cjs/codec/BtpCodec.d.ts.map +1 -1
  61. package/dist/cjs/codec/BtpCodec.js +1 -1
  62. package/dist/cjs/codec/BtpCodec.js.map +1 -1
  63. package/dist/cjs/codec/MessageCodec.d.ts +8 -8
  64. package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
  65. package/dist/cjs/codec/MessageCodec.js +2 -2
  66. package/dist/cjs/codec/MessageCodec.js.map +1 -1
  67. package/dist/cjs/common/FailsafeContext.d.ts +8 -8
  68. package/dist/cjs/common/FailsafeContext.d.ts.map +1 -1
  69. package/dist/cjs/common/FailsafeContext.js.map +1 -1
  70. package/dist/cjs/common/OperationalCredentialsTypes.d.ts +8 -8
  71. package/dist/cjs/fabric/Fabric.d.ts +27 -27
  72. package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
  73. package/dist/cjs/fabric/Fabric.js +3 -6
  74. package/dist/cjs/fabric/Fabric.js.map +1 -1
  75. package/dist/cjs/fabric/FabricManager.d.ts +2 -2
  76. package/dist/cjs/fabric/FabricManager.d.ts.map +1 -1
  77. package/dist/cjs/fabric/FabricManager.js.map +1 -1
  78. package/dist/cjs/groups/FabricGroups.d.ts +4 -4
  79. package/dist/cjs/groups/FabricGroups.d.ts.map +1 -1
  80. package/dist/cjs/groups/Groups.d.ts +1 -1
  81. package/dist/cjs/groups/KeySets.d.ts +12 -12
  82. package/dist/cjs/groups/KeySets.d.ts.map +1 -1
  83. package/dist/cjs/groups/KeySets.js.map +1 -1
  84. package/dist/cjs/groups/MessagingState.d.ts +4 -4
  85. package/dist/cjs/groups/MessagingState.d.ts.map +1 -1
  86. package/dist/cjs/groups/MessagingState.js.map +1 -1
  87. package/dist/cjs/interaction/InteractionMessenger.d.ts +3 -2
  88. package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
  89. package/dist/cjs/interaction/InteractionMessenger.js +9 -9
  90. package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
  91. package/dist/cjs/mdns/MdnsClient.d.ts +2 -2
  92. package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -1
  93. package/dist/cjs/mdns/MdnsClient.js.map +1 -1
  94. package/dist/cjs/mdns/MdnsSocket.d.ts.map +1 -1
  95. package/dist/cjs/mdns/MdnsSocket.js +5 -5
  96. package/dist/cjs/mdns/MdnsSocket.js.map +1 -1
  97. package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
  98. package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
  99. package/dist/cjs/peer/ControllerCommissioningFlow.js +2 -2
  100. package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
  101. package/dist/cjs/protocol/ChannelManager.d.ts +2 -2
  102. package/dist/cjs/protocol/ChannelManager.d.ts.map +1 -1
  103. package/dist/cjs/protocol/ChannelManager.js.map +1 -1
  104. package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
  105. package/dist/cjs/protocol/ExchangeManager.js +4 -3
  106. package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
  107. package/dist/cjs/protocol/MessageChannel.d.ts +3 -3
  108. package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
  109. package/dist/cjs/protocol/MessageChannel.js +2 -2
  110. package/dist/cjs/protocol/MessageChannel.js.map +1 -1
  111. package/dist/cjs/protocol/MessageExchange.d.ts +2 -2
  112. package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
  113. package/dist/cjs/protocol/MessageExchange.js.map +1 -1
  114. package/dist/cjs/protocol/ProtocolStatusMessage.d.ts +6 -5
  115. package/dist/cjs/protocol/ProtocolStatusMessage.d.ts.map +1 -1
  116. package/dist/cjs/protocol/ProtocolStatusMessage.js +1 -1
  117. package/dist/cjs/protocol/ProtocolStatusMessage.js.map +1 -1
  118. package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +1 -1
  119. package/dist/cjs/session/GroupSession.d.ts +5 -4
  120. package/dist/cjs/session/GroupSession.d.ts.map +1 -1
  121. package/dist/cjs/session/GroupSession.js.map +1 -1
  122. package/dist/cjs/session/InsecureSession.d.ts +1 -1
  123. package/dist/cjs/session/InsecureSession.d.ts.map +1 -1
  124. package/dist/cjs/session/InsecureSession.js.map +1 -1
  125. package/dist/cjs/session/NodeSession.d.ts +8 -8
  126. package/dist/cjs/session/NodeSession.d.ts.map +1 -1
  127. package/dist/cjs/session/NodeSession.js +7 -5
  128. package/dist/cjs/session/NodeSession.js.map +1 -1
  129. package/dist/cjs/session/Session.d.ts +4 -4
  130. package/dist/cjs/session/Session.d.ts.map +1 -1
  131. package/dist/cjs/session/Session.js.map +1 -1
  132. package/dist/cjs/session/SessionManager.d.ts +8 -8
  133. package/dist/cjs/session/SessionManager.d.ts.map +1 -1
  134. package/dist/cjs/session/SessionManager.js +1 -2
  135. package/dist/cjs/session/SessionManager.js.map +1 -1
  136. package/dist/cjs/session/case/CaseMessages.d.ts +30 -30
  137. package/dist/cjs/session/case/CaseMessages.d.ts.map +1 -1
  138. package/dist/cjs/session/case/CaseMessenger.d.ts +18 -18
  139. package/dist/cjs/session/pase/PaseClient.d.ts +1 -1
  140. package/dist/cjs/session/pase/PaseMessages.d.ts +8 -8
  141. package/dist/cjs/session/pase/PaseMessenger.d.ts +16 -16
  142. package/dist/cjs/session/pase/PaseMessenger.d.ts.map +1 -1
  143. package/dist/cjs/session/pase/PaseServer.d.ts +3 -3
  144. package/dist/cjs/session/pase/PaseServer.d.ts.map +1 -1
  145. package/dist/cjs/session/pase/PaseServer.js +3 -2
  146. package/dist/cjs/session/pase/PaseServer.js.map +1 -1
  147. package/dist/esm/advertisement/ble/BleAdvertisement.js +1 -1
  148. package/dist/esm/advertisement/ble/BleAdvertiser.d.ts +2 -2
  149. package/dist/esm/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
  150. package/dist/esm/ble/Ble.d.ts +2 -2
  151. package/dist/esm/ble/Ble.d.ts.map +1 -1
  152. package/dist/esm/ble/Ble.js.map +1 -1
  153. package/dist/esm/ble/BtpSessionHandler.d.ts +6 -6
  154. package/dist/esm/ble/BtpSessionHandler.d.ts.map +1 -1
  155. package/dist/esm/ble/BtpSessionHandler.js +9 -9
  156. package/dist/esm/ble/BtpSessionHandler.js.map +1 -1
  157. package/dist/esm/certificate/AttestationCertificateManager.d.ts +5 -5
  158. package/dist/esm/certificate/AttestationCertificateManager.d.ts.map +1 -1
  159. package/dist/esm/certificate/AttestationCertificateManager.js +2 -2
  160. package/dist/esm/certificate/AttestationCertificateManager.js.map +1 -1
  161. package/dist/esm/certificate/CertificateAuthority.d.ts +5 -5
  162. package/dist/esm/certificate/CertificateAuthority.d.ts.map +1 -1
  163. package/dist/esm/certificate/CertificateAuthority.js +6 -3
  164. package/dist/esm/certificate/CertificateAuthority.js.map +1 -1
  165. package/dist/esm/certificate/ChipPAAuthorities.d.ts +8 -8
  166. package/dist/esm/certificate/DeviceCertification.d.ts +9 -9
  167. package/dist/esm/certificate/DeviceCertification.d.ts.map +1 -1
  168. package/dist/esm/certificate/DeviceCertification.js +3 -4
  169. package/dist/esm/certificate/DeviceCertification.js.map +1 -1
  170. package/dist/esm/certificate/kinds/AttestationCertificates.d.ts +1 -1
  171. package/dist/esm/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
  172. package/dist/esm/certificate/kinds/AttestationCertificates.js.map +1 -1
  173. package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts +4 -4
  174. package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
  175. package/dist/esm/certificate/kinds/CertificationDeclaration.js.map +1 -1
  176. package/dist/esm/certificate/kinds/Icac.d.ts +3 -3
  177. package/dist/esm/certificate/kinds/Icac.d.ts.map +1 -1
  178. package/dist/esm/certificate/kinds/Icac.js +2 -2
  179. package/dist/esm/certificate/kinds/Icac.js.map +1 -1
  180. package/dist/esm/certificate/kinds/Noc.d.ts +3 -3
  181. package/dist/esm/certificate/kinds/Noc.d.ts.map +1 -1
  182. package/dist/esm/certificate/kinds/Noc.js +2 -2
  183. package/dist/esm/certificate/kinds/Noc.js.map +1 -1
  184. package/dist/esm/certificate/kinds/OperationalBase.d.ts +2 -1
  185. package/dist/esm/certificate/kinds/OperationalBase.d.ts.map +1 -1
  186. package/dist/esm/certificate/kinds/OperationalBase.js +2 -2
  187. package/dist/esm/certificate/kinds/OperationalBase.js.map +1 -1
  188. package/dist/esm/certificate/kinds/Rcac.d.ts +3 -3
  189. package/dist/esm/certificate/kinds/Rcac.d.ts.map +1 -1
  190. package/dist/esm/certificate/kinds/Rcac.js +2 -2
  191. package/dist/esm/certificate/kinds/Rcac.js.map +1 -1
  192. package/dist/esm/certificate/kinds/X509Base.d.ts +11 -11
  193. package/dist/esm/certificate/kinds/X509Base.d.ts.map +1 -1
  194. package/dist/esm/certificate/kinds/X509Base.js +1 -1
  195. package/dist/esm/certificate/kinds/X509Base.js.map +1 -1
  196. package/dist/esm/certificate/kinds/common.d.ts +2 -2
  197. package/dist/esm/certificate/kinds/common.d.ts.map +1 -1
  198. package/dist/esm/certificate/kinds/common.js +2 -2
  199. package/dist/esm/certificate/kinds/common.js.map +1 -1
  200. package/dist/esm/certificate/kinds/definitions/base.d.ts +7 -6
  201. package/dist/esm/certificate/kinds/definitions/base.d.ts.map +1 -1
  202. package/dist/esm/certificate/kinds/definitions/base.js.map +1 -1
  203. package/dist/esm/certificate/kinds/definitions/certification-declaration.d.ts +1 -1
  204. package/dist/esm/certificate/kinds/definitions/operational.d.ts +21 -21
  205. package/dist/esm/codec/BtpCodec.d.ts +12 -11
  206. package/dist/esm/codec/BtpCodec.d.ts.map +1 -1
  207. package/dist/esm/codec/BtpCodec.js +1 -1
  208. package/dist/esm/codec/BtpCodec.js.map +1 -1
  209. package/dist/esm/codec/MessageCodec.d.ts +8 -8
  210. package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
  211. package/dist/esm/codec/MessageCodec.js +2 -2
  212. package/dist/esm/codec/MessageCodec.js.map +1 -1
  213. package/dist/esm/common/FailsafeContext.d.ts +8 -8
  214. package/dist/esm/common/FailsafeContext.d.ts.map +1 -1
  215. package/dist/esm/common/FailsafeContext.js.map +1 -1
  216. package/dist/esm/common/OperationalCredentialsTypes.d.ts +8 -8
  217. package/dist/esm/fabric/Fabric.d.ts +27 -27
  218. package/dist/esm/fabric/Fabric.d.ts.map +1 -1
  219. package/dist/esm/fabric/Fabric.js +3 -6
  220. package/dist/esm/fabric/Fabric.js.map +1 -1
  221. package/dist/esm/fabric/FabricManager.d.ts +2 -2
  222. package/dist/esm/fabric/FabricManager.d.ts.map +1 -1
  223. package/dist/esm/fabric/FabricManager.js.map +1 -1
  224. package/dist/esm/groups/FabricGroups.d.ts +4 -4
  225. package/dist/esm/groups/FabricGroups.d.ts.map +1 -1
  226. package/dist/esm/groups/Groups.d.ts +1 -1
  227. package/dist/esm/groups/KeySets.d.ts +12 -12
  228. package/dist/esm/groups/KeySets.d.ts.map +1 -1
  229. package/dist/esm/groups/KeySets.js.map +1 -1
  230. package/dist/esm/groups/MessagingState.d.ts +4 -4
  231. package/dist/esm/groups/MessagingState.d.ts.map +1 -1
  232. package/dist/esm/groups/MessagingState.js.map +1 -1
  233. package/dist/esm/interaction/InteractionMessenger.d.ts +3 -2
  234. package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
  235. package/dist/esm/interaction/InteractionMessenger.js +9 -9
  236. package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
  237. package/dist/esm/mdns/MdnsClient.d.ts +2 -2
  238. package/dist/esm/mdns/MdnsClient.d.ts.map +1 -1
  239. package/dist/esm/mdns/MdnsClient.js.map +1 -1
  240. package/dist/esm/mdns/MdnsSocket.d.ts.map +1 -1
  241. package/dist/esm/mdns/MdnsSocket.js +5 -5
  242. package/dist/esm/mdns/MdnsSocket.js.map +1 -1
  243. package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
  244. package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
  245. package/dist/esm/peer/ControllerCommissioningFlow.js +2 -2
  246. package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
  247. package/dist/esm/protocol/ChannelManager.d.ts +2 -2
  248. package/dist/esm/protocol/ChannelManager.d.ts.map +1 -1
  249. package/dist/esm/protocol/ChannelManager.js.map +1 -1
  250. package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
  251. package/dist/esm/protocol/ExchangeManager.js +5 -3
  252. package/dist/esm/protocol/ExchangeManager.js.map +1 -1
  253. package/dist/esm/protocol/MessageChannel.d.ts +3 -3
  254. package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
  255. package/dist/esm/protocol/MessageChannel.js +2 -2
  256. package/dist/esm/protocol/MessageChannel.js.map +1 -1
  257. package/dist/esm/protocol/MessageExchange.d.ts +2 -2
  258. package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
  259. package/dist/esm/protocol/MessageExchange.js.map +1 -1
  260. package/dist/esm/protocol/ProtocolStatusMessage.d.ts +6 -5
  261. package/dist/esm/protocol/ProtocolStatusMessage.d.ts.map +1 -1
  262. package/dist/esm/protocol/ProtocolStatusMessage.js +1 -1
  263. package/dist/esm/protocol/ProtocolStatusMessage.js.map +1 -1
  264. package/dist/esm/securechannel/SecureChannelMessenger.d.ts +1 -1
  265. package/dist/esm/session/GroupSession.d.ts +5 -4
  266. package/dist/esm/session/GroupSession.d.ts.map +1 -1
  267. package/dist/esm/session/GroupSession.js.map +1 -1
  268. package/dist/esm/session/InsecureSession.d.ts +1 -1
  269. package/dist/esm/session/InsecureSession.d.ts.map +1 -1
  270. package/dist/esm/session/InsecureSession.js.map +1 -1
  271. package/dist/esm/session/NodeSession.d.ts +8 -8
  272. package/dist/esm/session/NodeSession.d.ts.map +1 -1
  273. package/dist/esm/session/NodeSession.js +7 -5
  274. package/dist/esm/session/NodeSession.js.map +1 -1
  275. package/dist/esm/session/Session.d.ts +4 -4
  276. package/dist/esm/session/Session.d.ts.map +1 -1
  277. package/dist/esm/session/Session.js.map +1 -1
  278. package/dist/esm/session/SessionManager.d.ts +8 -8
  279. package/dist/esm/session/SessionManager.d.ts.map +1 -1
  280. package/dist/esm/session/SessionManager.js +1 -2
  281. package/dist/esm/session/SessionManager.js.map +1 -1
  282. package/dist/esm/session/case/CaseMessages.d.ts +30 -30
  283. package/dist/esm/session/case/CaseMessages.d.ts.map +1 -1
  284. package/dist/esm/session/case/CaseMessenger.d.ts +18 -18
  285. package/dist/esm/session/pase/PaseClient.d.ts +1 -1
  286. package/dist/esm/session/pase/PaseMessages.d.ts +8 -8
  287. package/dist/esm/session/pase/PaseMessenger.d.ts +16 -16
  288. package/dist/esm/session/pase/PaseMessenger.d.ts.map +1 -1
  289. package/dist/esm/session/pase/PaseServer.d.ts +3 -3
  290. package/dist/esm/session/pase/PaseServer.d.ts.map +1 -1
  291. package/dist/esm/session/pase/PaseServer.js +3 -2
  292. package/dist/esm/session/pase/PaseServer.js.map +1 -1
  293. package/package.json +6 -6
  294. package/src/advertisement/ble/BleAdvertisement.ts +1 -1
  295. package/src/advertisement/ble/BleAdvertiser.ts +1 -1
  296. package/src/ble/Ble.ts +2 -2
  297. package/src/ble/BtpSessionHandler.ts +20 -20
  298. package/src/certificate/AttestationCertificateManager.ts +5 -5
  299. package/src/certificate/CertificateAuthority.ts +14 -11
  300. package/src/certificate/DeviceCertification.ts +11 -13
  301. package/src/certificate/kinds/AttestationCertificates.ts +1 -1
  302. package/src/certificate/kinds/CertificationDeclaration.ts +3 -6
  303. package/src/certificate/kinds/Icac.ts +3 -3
  304. package/src/certificate/kinds/Noc.ts +3 -3
  305. package/src/certificate/kinds/OperationalBase.ts +4 -4
  306. package/src/certificate/kinds/Rcac.ts +3 -3
  307. package/src/certificate/kinds/X509Base.ts +7 -7
  308. package/src/certificate/kinds/common.ts +4 -4
  309. package/src/certificate/kinds/definitions/base.ts +7 -6
  310. package/src/codec/BtpCodec.ts +13 -13
  311. package/src/codec/MessageCodec.ts +10 -10
  312. package/src/common/FailsafeContext.ts +6 -5
  313. package/src/fabric/Fabric.ts +31 -34
  314. package/src/fabric/FabricManager.ts +1 -1
  315. package/src/groups/KeySets.ts +6 -6
  316. package/src/groups/MessagingState.ts +3 -3
  317. package/src/interaction/InteractionMessenger.ts +12 -11
  318. package/src/mdns/MdnsClient.ts +2 -2
  319. package/src/mdns/MdnsSocket.ts +7 -6
  320. package/src/peer/ControllerCommissioner.ts +2 -1
  321. package/src/peer/ControllerCommissioningFlow.ts +5 -5
  322. package/src/protocol/ChannelManager.ts +3 -3
  323. package/src/protocol/ExchangeManager.ts +7 -5
  324. package/src/protocol/MessageChannel.ts +4 -4
  325. package/src/protocol/MessageExchange.ts +2 -1
  326. package/src/protocol/ProtocolStatusMessage.ts +6 -6
  327. package/src/session/GroupSession.ts +7 -7
  328. package/src/session/InsecureSession.ts +1 -1
  329. package/src/session/NodeSession.ts +17 -15
  330. package/src/session/Session.ts +3 -3
  331. package/src/session/SessionManager.ts +9 -10
  332. package/src/session/case/CaseServer.ts +8 -8
  333. package/src/session/pase/PaseServer.ts +5 -4
@@ -46,8 +46,8 @@ export interface PayloadHeader {
46
46
 
47
47
  export interface Packet {
48
48
  header: PacketHeader;
49
- messageExtension?: Uint8Array;
50
- applicationPayload: Uint8Array;
49
+ messageExtension?: Bytes;
50
+ applicationPayload: Bytes;
51
51
  }
52
52
 
53
53
  export interface DecodedPacket extends Packet {
@@ -56,8 +56,8 @@ export interface DecodedPacket extends Packet {
56
56
  export interface Message {
57
57
  packetHeader: PacketHeader;
58
58
  payloadHeader: PayloadHeader;
59
- securityExtension?: Uint8Array;
60
- payload: Uint8Array;
59
+ securityExtension?: Bytes;
60
+ payload: Bytes;
61
61
  }
62
62
 
63
63
  export interface DecodedMessage extends Message {
@@ -113,11 +113,11 @@ function mapProtocolAndMessageType(protocolId: number, messageType: number): { t
113
113
  }
114
114
 
115
115
  export class MessageCodec {
116
- static decodePacket(data: Uint8Array): DecodedPacket {
116
+ static decodePacket(data: Bytes): DecodedPacket {
117
117
  const reader = new DataReader(data, Endian.Little);
118
118
  const header = this.decodePacketHeader(reader);
119
119
 
120
- let messageExtension: Uint8Array | undefined = undefined;
120
+ let messageExtension: Bytes | undefined = undefined;
121
121
  if (header.hasMessageExtensions) {
122
122
  const extensionLength = reader.readUInt16();
123
123
  messageExtension = reader.readByteArray(extensionLength);
@@ -134,7 +134,7 @@ export class MessageCodec {
134
134
  static decodePayload({ header, applicationPayload }: DecodedPacket): DecodedMessage {
135
135
  const reader = new DataReader(applicationPayload, Endian.Little);
136
136
  const payloadHeader = this.decodePayloadHeader(reader);
137
- let securityExtension: Uint8Array | undefined = undefined;
137
+ let securityExtension: Bytes | undefined = undefined;
138
138
  if (payloadHeader.hasSecuredExtension) {
139
139
  const extensionLength = reader.readUInt16();
140
140
  securityExtension = reader.readByteArray(extensionLength);
@@ -165,7 +165,7 @@ export class MessageCodec {
165
165
  };
166
166
  }
167
167
 
168
- static encodePacket({ header, applicationPayload, messageExtension }: Packet): Uint8Array {
168
+ static encodePacket({ header, applicationPayload, messageExtension }: Packet): Bytes {
169
169
  if (messageExtension !== undefined || header.hasMessageExtensions) {
170
170
  throw new NotImplementedError(`Message extensions not supported when encoding a packet.`);
171
171
  }
@@ -316,8 +316,8 @@ export class MessageCodec {
316
316
  reqAck: requiresAck,
317
317
  dup: duplicate,
318
318
  }),
319
- size: payload.length ? payload.length : undefined,
320
- payload: payload.length ? payload : undefined,
319
+ size: payload.byteLength ? payload.byteLength : undefined,
320
+ payload: payload.byteLength ? payload : undefined,
321
321
  },
322
322
  true,
323
323
  );
@@ -6,6 +6,7 @@
6
6
 
7
7
  import {
8
8
  AsyncObservable,
9
+ Bytes,
9
10
  Construction,
10
11
  Logger,
11
12
  MatterFlowError,
@@ -193,7 +194,7 @@ export abstract class FailsafeContext {
193
194
  }
194
195
 
195
196
  /** Handles adding a trusted root certificate from Operational Credentials cluster. */
196
- async setRootCert(rootCert: Uint8Array) {
197
+ async setRootCert(rootCert: Bytes) {
197
198
  await this.#builder.setRootCert(rootCert);
198
199
  this.#rootCertSet = true;
199
200
  }
@@ -202,7 +203,7 @@ export abstract class FailsafeContext {
202
203
  * Build a new Fabric object based on an existing fabric for the "UpdateNoc" case of the Operational Credentials
203
204
  * cluster.
204
205
  */
205
- async buildUpdatedFabric(nocValue: Uint8Array, icacValue: Uint8Array | undefined) {
206
+ async buildUpdatedFabric(nocValue: Bytes, icacValue: Bytes | undefined) {
206
207
  if (this.associatedFabric === undefined) {
207
208
  throw new MatterFlowError("No fabric associated with failsafe context, but we prepare an Fabric update.");
208
209
  }
@@ -213,10 +214,10 @@ export abstract class FailsafeContext {
213
214
 
214
215
  /** Build a new Fabric object for a new fabric for the "AddNoc" case of the Operational Credentials cluster. */
215
216
  async buildFabric(nocData: {
216
- nocValue: Uint8Array;
217
- icacValue: Uint8Array | undefined;
217
+ nocValue: Bytes;
218
+ icacValue: Bytes | undefined;
218
219
  adminVendorId: VendorId;
219
- ipkValue: Uint8Array;
220
+ ipkValue: Bytes;
220
221
  caseAdminSubject: NodeId;
221
222
  }) {
222
223
  const builder = this.#builder;
@@ -52,14 +52,14 @@ export class Fabric {
52
52
  readonly fabricId: FabricId;
53
53
  readonly nodeId: NodeId;
54
54
  readonly rootNodeId: NodeId;
55
- readonly operationalId: Uint8Array;
56
- readonly rootPublicKey: Uint8Array;
55
+ readonly operationalId: Bytes;
56
+ readonly rootPublicKey: Bytes;
57
57
  readonly rootVendorId: VendorId;
58
- readonly rootCert: Uint8Array;
59
- readonly identityProtectionKey: Uint8Array;
60
- readonly operationalIdentityProtectionKey: Uint8Array;
61
- readonly intermediateCACert: Uint8Array | undefined;
62
- readonly operationalCert: Uint8Array;
58
+ readonly rootCert: Bytes;
59
+ readonly identityProtectionKey: Bytes;
60
+ readonly operationalIdentityProtectionKey: Bytes;
61
+ readonly intermediateCACert: Bytes | undefined;
62
+ readonly operationalCert: Bytes;
63
63
  readonly #keyPair: Key;
64
64
  readonly #sessions = new Set<Session>();
65
65
  readonly #groups: FabricGroups;
@@ -148,11 +148,11 @@ export class Fabric {
148
148
  return this.#keyPair.publicKey;
149
149
  }
150
150
 
151
- sign(data: Uint8Array) {
151
+ sign(data: Bytes) {
152
152
  return this.crypto.signEcdsa(this.#keyPair, data);
153
153
  }
154
154
 
155
- async verifyCredentials(operationalCert: Uint8Array, intermediateCACert?: Uint8Array) {
155
+ async verifyCredentials(operationalCert: Bytes, intermediateCACert?: Bytes) {
156
156
  const rootCert = Rcac.fromTlv(this.rootCert);
157
157
  const nocCert = Noc.fromTlv(operationalCert);
158
158
  const icaCert = intermediateCACert !== undefined ? Icac.fromTlv(intermediateCACert) : undefined;
@@ -164,7 +164,7 @@ export class Fabric {
164
164
  await nocCert.verify(this.#crypto, rootCert, icaCert);
165
165
  }
166
166
 
167
- matchesFabricIdAndRootPublicKey(fabricId: FabricId, rootPublicKey: Uint8Array) {
167
+ matchesFabricIdAndRootPublicKey(fabricId: FabricId, rootPublicKey: Bytes) {
168
168
  return this.fabricId === fabricId && Bytes.areEqual(this.rootPublicKey, rootPublicKey);
169
169
  }
170
170
 
@@ -175,7 +175,7 @@ export class Fabric {
175
175
  );
176
176
  }
177
177
 
178
- #generateSalt(nodeId: NodeId, random: Uint8Array) {
178
+ #generateSalt(nodeId: NodeId, random: Bytes) {
179
179
  const writer = new DataWriter(Endian.Little);
180
180
  writer.writeByteArray(random);
181
181
  writer.writeByteArray(this.rootPublicKey);
@@ -188,18 +188,15 @@ export class Fabric {
188
188
  * Returns the destination IDs for a given nodeId, random value and optional groupId. When groupId is provided, it
189
189
  * returns the time-wise valid operational keys for that groupId.
190
190
  */
191
- async currentDestinationIdFor(nodeId: NodeId, random: Uint8Array) {
192
- return await this.#crypto.signHmac(
193
- this.groups.keySets.currentKeyForId(0).key,
194
- this.#generateSalt(nodeId, random),
195
- );
191
+ async currentDestinationIdFor(nodeId: NodeId, random: Bytes) {
192
+ return this.#crypto.signHmac(this.groups.keySets.currentKeyForId(0).key, this.#generateSalt(nodeId, random));
196
193
  }
197
194
 
198
195
  /**
199
196
  * Returns the destination IDs for a given nodeId, random value and optional groupId. When groupId is provided, it
200
197
  * returns all operational keys for that groupId.
201
198
  */
202
- async destinationIdsFor(nodeId: NodeId, random: Uint8Array) {
199
+ async destinationIdsFor(nodeId: NodeId, random: Bytes) {
203
200
  const salt = this.#generateSalt(nodeId, random);
204
201
  // Check all keys of keyset 0 - typically it is only the IPK
205
202
  const destinationIds = this.groups.keySets.allKeysForId(0).map(({ key }) => this.#crypto.signHmac(key, salt));
@@ -277,14 +274,14 @@ export class FabricBuilder {
277
274
  #crypto: Crypto;
278
275
  #keyPair: PrivateKey;
279
276
  #rootVendorId?: VendorId;
280
- #rootCert?: Uint8Array;
281
- #intermediateCACert?: Uint8Array;
282
- #operationalCert?: Uint8Array;
277
+ #rootCert?: Bytes;
278
+ #intermediateCACert?: Bytes;
279
+ #operationalCert?: Bytes;
283
280
  #fabricId?: FabricId;
284
281
  #nodeId?: NodeId;
285
282
  #rootNodeId?: NodeId;
286
- #rootPublicKey?: Uint8Array;
287
- #identityProtectionKey?: Uint8Array;
283
+ #rootPublicKey?: Bytes;
284
+ #identityProtectionKey?: Bytes;
288
285
  #fabricIndex?: FabricIndex;
289
286
  #label = "";
290
287
 
@@ -309,7 +306,7 @@ export class FabricBuilder {
309
306
  return X509Base.createCertificateSigningRequest(this.#crypto, this.#keyPair);
310
307
  }
311
308
 
312
- async setRootCert(rootCert: Uint8Array) {
309
+ async setRootCert(rootCert: Bytes) {
313
310
  const root = Rcac.fromTlv(rootCert);
314
311
  await root.verify(this.#crypto);
315
312
  this.#rootCert = rootCert;
@@ -321,8 +318,8 @@ export class FabricBuilder {
321
318
  return this.#rootCert;
322
319
  }
323
320
 
324
- async setOperationalCert(operationalCert: Uint8Array, intermediateCACert?: Uint8Array) {
325
- if (intermediateCACert !== undefined && intermediateCACert.length === 0) {
321
+ async setOperationalCert(operationalCert: Bytes, intermediateCACert?: Bytes) {
322
+ if (intermediateCACert !== undefined && intermediateCACert.byteLength === 0) {
326
323
  intermediateCACert = undefined;
327
324
  }
328
325
  const {
@@ -371,7 +368,7 @@ export class FabricBuilder {
371
368
  return this;
372
369
  }
373
370
 
374
- setIdentityProtectionKey(key: Uint8Array) {
371
+ setIdentityProtectionKey(key: Bytes) {
375
372
  this.#identityProtectionKey = key;
376
373
  return this;
377
374
  }
@@ -426,7 +423,7 @@ export class FabricBuilder {
426
423
  const saltWriter = new DataWriter();
427
424
  saltWriter.writeUInt64(this.#fabricId);
428
425
  const operationalId = await this.#crypto.createHkdfKey(
429
- this.#rootPublicKey.slice(1),
426
+ Bytes.of(this.#rootPublicKey).slice(1),
430
427
  saltWriter.toByteArray(),
431
428
  COMPRESSED_FABRIC_ID_INFO,
432
429
  8,
@@ -461,15 +458,15 @@ export namespace Fabric {
461
458
  fabricId: FabricId;
462
459
  nodeId: NodeId;
463
460
  rootNodeId: NodeId;
464
- operationalId: Uint8Array;
465
- rootPublicKey: Uint8Array;
461
+ operationalId: Bytes;
462
+ rootPublicKey: Bytes;
466
463
  keyPair: BinaryKeyPair;
467
464
  rootVendorId: VendorId;
468
- rootCert: Uint8Array;
469
- identityProtectionKey: Uint8Array;
470
- operationalIdentityProtectionKey: Uint8Array;
471
- intermediateCACert: Uint8Array | undefined;
472
- operationalCert: Uint8Array;
465
+ rootCert: Bytes;
466
+ identityProtectionKey: Bytes;
467
+ operationalIdentityProtectionKey: Bytes;
468
+ intermediateCACert: Bytes | undefined;
469
+ operationalCert: Bytes;
473
470
  label: string;
474
471
  };
475
472
  }
@@ -225,7 +225,7 @@ export class FabricManager {
225
225
  return this.fabrics.map(translator);
226
226
  }
227
227
 
228
- async findFabricFromDestinationId(destinationId: Uint8Array, initiatorRandom: Uint8Array) {
228
+ async findFabricFromDestinationId(destinationId: Bytes, initiatorRandom: Bytes) {
229
229
  this.#construction.assert();
230
230
 
231
231
  for (const fabric of this.#fabrics.values()) {
@@ -11,7 +11,7 @@ export const GROUP_KEY_INFO = Bytes.fromString("GroupKeyHash");
11
11
 
12
12
  export class KeySets<T extends OperationalKeySet> extends BasicSet<T> {
13
13
  /** Operational enhanced structure for fast access based on the group session id. */
14
- readonly #sessions = new Map<number, { keySetId: number; key: Uint8Array }[]>();
14
+ readonly #sessions = new Map<number, { keySetId: number; key: Bytes }[]>();
15
15
 
16
16
  get sessions() {
17
17
  return this.#sessions;
@@ -44,7 +44,7 @@ export class KeySets<T extends OperationalKeySet> extends BasicSet<T> {
44
44
  if (groupKeySet === undefined) {
45
45
  throw new MatterFlowError(`GroupKeySet for groupKeySet ${keySetId} not found.`);
46
46
  }
47
- const operationalKeys = Array<{ key: Uint8Array; sessionId?: number; startTime: number | bigint }>();
47
+ const operationalKeys = Array<{ key: Bytes; sessionId?: number; startTime: number | bigint }>();
48
48
  const {
49
49
  operationalEpochKey0,
50
50
  groupSessionId0,
@@ -141,7 +141,7 @@ export class KeySets<T extends OperationalKeySet> extends BasicSet<T> {
141
141
  }
142
142
 
143
143
  /** Calculates a group session id based on the operational group key. */
144
- async sessionIdFromKey(crypto: Crypto, operationalGroupKey: Uint8Array) {
144
+ async sessionIdFromKey(crypto: Crypto, operationalGroupKey: Bytes) {
145
145
  // GroupKeyHash is an array of 2 bytes (16 bits) per Crypto_KDF
146
146
  const groupKeyHash = await crypto.createHkdfKey(operationalGroupKey, new Uint8Array(), GROUP_KEY_INFO, 2);
147
147
 
@@ -185,10 +185,10 @@ export type GroupKeySet = GroupKeyManagement.GroupKeySet;
185
185
 
186
186
  /** Enhanced structure of GroupKeySet to include operational data for easier operational processing. */
187
187
  export type OperationalKeySet = GroupKeySet & {
188
- operationalEpochKey0: Uint8Array;
188
+ operationalEpochKey0: Bytes;
189
189
  groupSessionId0: number | null;
190
- operationalEpochKey1: Uint8Array | null;
190
+ operationalEpochKey1: Bytes | null;
191
191
  groupSessionId1: number | null;
192
- operationalEpochKey2: Uint8Array | null;
192
+ operationalEpochKey2: Bytes | null;
193
193
  groupSessionId2: number | null;
194
194
  };
@@ -40,7 +40,7 @@ export class MessagingState {
40
40
  /**
41
41
  * Return the message counter for sending messages to a group with the given operational key.
42
42
  */
43
- counterFor(operationalKey: Uint8Array) {
43
+ counterFor(operationalKey: Bytes) {
44
44
  if (!this.#storage) {
45
45
  throw new ImplementationError("Group session cannot be created without storage context.");
46
46
  }
@@ -53,7 +53,7 @@ export class MessagingState {
53
53
  return counter;
54
54
  }
55
55
 
56
- async removeCounter(key: Uint8Array, forDelete = false) {
56
+ async removeCounter(key: Bytes, forDelete = false) {
57
57
  const operationalKeyHex = Bytes.toHex(key);
58
58
  this.#groupDataCounters.delete(operationalKeyHex);
59
59
  if (forDelete) {
@@ -65,7 +65,7 @@ export class MessagingState {
65
65
  /**
66
66
  * Returns the message reception state for a given source node id and operational key.
67
67
  */
68
- receptionStateFor(sourceNodeId: NodeId, operationalKey: Uint8Array) {
68
+ receptionStateFor(sourceNodeId: NodeId, operationalKey: Bytes) {
69
69
  const operationalKeyHex = Bytes.toHex(operationalKey);
70
70
  let receptionState = this.#messageDataReceptionState.get(operationalKeyHex)?.get(sourceNodeId);
71
71
  if (receptionState === undefined) {
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { ReadResult } from "#action/response/ReadResult.js";
8
8
  import {
9
+ Bytes,
9
10
  Diagnostic,
10
11
  InternalError,
11
12
  Logger,
@@ -98,7 +99,7 @@ const DATA_REPORT_MIN_AVAILABLE_BYTES_BEFORE_SENDING = 40;
98
99
  class InteractionMessenger {
99
100
  constructor(protected exchange: MessageExchange) {}
100
101
 
101
- send(messageType: number, payload: Uint8Array, options?: ExchangeSendOptions) {
102
+ send(messageType: number, payload: Bytes, options?: ExchangeSendOptions) {
102
103
  return this.exchange.send(messageType, payload, options);
103
104
  }
104
105
 
@@ -366,12 +367,12 @@ export class InteractionServerMessenger extends InteractionMessenger {
366
367
  // Empty the dataReport data fields for the next chunk and reset the messageSize
367
368
  delete dataReport.attributeReports;
368
369
  delete dataReport.eventReports;
369
- messageSize = emptyDataReportBytes.length;
370
+ messageSize = emptyDataReportBytes.byteLength;
370
371
  processQueueFirst = true; // After sending a message we first try to process queue
371
372
  };
372
373
 
373
374
  /** Current size of the message */
374
- let messageSize = emptyDataReportBytes.length;
375
+ let messageSize = emptyDataReportBytes.byteLength;
375
376
 
376
377
  /** Queue of attribute reports to send */
377
378
  const attributeReportsToSend = new Array<{
@@ -608,7 +609,7 @@ export class InteractionServerMessenger extends InteractionMessenger {
608
609
  attributeReportsToSend.push(attributeToSend);
609
610
  continue;
610
611
  }
611
- if (encodedSize > this.exchange.maxPayloadSize - emptyDataReportBytes.length - 3) {
612
+ if (encodedSize > this.exchange.maxPayloadSize - emptyDataReportBytes.byteLength - 3) {
612
613
  // We sent the message but the current attribute is too big for a message alone so needs to
613
614
  // be chunked, so add it to the queue at the beginning
614
615
  attributeReportsToSend.unshift(attributeToSend);
@@ -657,9 +658,9 @@ export class InteractionServerMessenger extends InteractionMessenger {
657
658
  suppressResponse: dataReport.moreChunkedMessages ? false : dataReport.suppressResponse, // always false when moreChunkedMessages is true
658
659
  };
659
660
  const encodedMessage = TlvDataReportForSend.encode(dataReportToSend);
660
- if (encodedMessage.length > this.exchange.maxPayloadSize) {
661
+ if (encodedMessage.byteLength > this.exchange.maxPayloadSize) {
661
662
  throw new MatterFlowError(
662
- `DataReport with ${encodedMessage.length}bytes is too long to fit in a single chunk (${this.exchange.maxPayloadSize}bytes), This should not happen! Data: ${Diagnostic.json(
663
+ `DataReport with ${encodedMessage.byteLength}bytes is too long to fit in a single chunk (${this.exchange.maxPayloadSize}bytes), This should not happen! Data: ${Diagnostic.json(
663
664
  dataReportToSend,
664
665
  )}`,
665
666
  );
@@ -915,7 +916,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
915
916
  }
916
917
 
917
918
  /** Implements a send method with an automatic reconnection mechanism */
918
- override async send(messageType: number, payload: Uint8Array, options?: ExchangeSendOptions) {
919
+ override async send(messageType: number, payload: Bytes, options?: ExchangeSendOptions) {
919
920
  try {
920
921
  if (this.exchange.channel.closed) {
921
922
  throw new ChannelNotConnectedError("The exchange channel is closed. Please connect the device first.");
@@ -950,7 +951,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
950
951
 
951
952
  #encodeReadingRequest<T extends TlvSchema<any>>(schema: T, request: TypeFromSchema<T>) {
952
953
  const encoded = schema.encode(request);
953
- if (encoded.length <= this.exchange.maxPayloadSize) {
954
+ if (encoded.byteLength <= this.exchange.maxPayloadSize) {
954
955
  return encoded;
955
956
  }
956
957
 
@@ -960,7 +961,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
960
961
  ...request,
961
962
  dataVersionFilters: [],
962
963
  });
963
- if (requestWithoutDataVersionFilters.length > this.exchange.maxPayloadSize) {
964
+ if (requestWithoutDataVersionFilters.byteLength > this.exchange.maxPayloadSize) {
964
965
  throw new MatterFlowError(
965
966
  `Request is too long to fit in a single chunk, This should not happen! Data: ${Diagnostic.json(request)}`,
966
967
  );
@@ -970,7 +971,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
970
971
  ...request,
971
972
  dataVersionFilters: this.#shortenDataVersionFilters(
972
973
  originalDataVersionFilters,
973
- this.exchange.maxPayloadSize - requestWithoutDataVersionFilters.length,
974
+ this.exchange.maxPayloadSize - requestWithoutDataVersionFilters.byteLength,
974
975
  ),
975
976
  });
976
977
  }
@@ -987,7 +988,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
987
988
  break;
988
989
  }
989
990
  const encodedDataVersionFilter = TlvDataVersionFilter.encode(dataVersionFilter);
990
- const encodedDataVersionFilterLength = encodedDataVersionFilter.length;
991
+ const encodedDataVersionFilterLength = encodedDataVersionFilter.byteLength;
991
992
  if (encodedDataVersionFilterLength > availableBytes) {
992
993
  originalDataVersionFilters.unshift(dataVersionFilter);
993
994
  break;
@@ -104,7 +104,7 @@ export interface MdnsScannerTargetCriteria {
104
104
 
105
105
  /** List of operational targets. */
106
106
  operationalTargets: {
107
- operationalId: Uint8Array;
107
+ operationalId: Bytes;
108
108
  nodeId?: NodeId;
109
109
  }[];
110
110
  }
@@ -470,7 +470,7 @@ export class MdnsClient implements Scanner {
470
470
  return this.#recordWaiters.has(queryId);
471
471
  }
472
472
 
473
- #createOperationalMatterQName(operationalId: Uint8Array, nodeId: NodeId) {
473
+ #createOperationalMatterQName(operationalId: Bytes, nodeId: NodeId) {
474
474
  const operationalIdString = Bytes.toHex(operationalId).toUpperCase();
475
475
  return getOperationalDeviceQname(operationalIdString, NodeId.toHexString(nodeId));
476
476
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  import {
8
8
  BasicObservable,
9
+ Bytes,
9
10
  Diagnostic,
10
11
  DnsCodec,
11
12
  DnsMessage,
@@ -83,13 +84,13 @@ export class MdnsSocket {
83
84
 
84
85
  // Note - for size calculations we assume queries are relatively small. We only split answers across messages
85
86
  let encodedChunkWithoutAnswers = DnsCodec.encode(chunk);
86
- let chunkSize = encodedChunkWithoutAnswers.length;
87
+ let chunkSize = encodedChunkWithoutAnswers.byteLength;
87
88
 
88
89
  // Add answers, splitting message as necessary
89
90
  for (const answer of message.answers ?? []) {
90
91
  const answerEncoded = DnsCodec.encodeRecord(answer);
91
92
 
92
- if (chunkSize + answerEncoded.length > MAX_MDNS_MESSAGE_SIZE) {
93
+ if (chunkSize + answerEncoded.byteLength > MAX_MDNS_MESSAGE_SIZE) {
93
94
  if (chunk.answers.length === 0) {
94
95
  // The first answer is already too big, log at least a warning
95
96
  logger.warn(
@@ -108,9 +109,9 @@ export class MdnsSocket {
108
109
  encodedChunkWithoutAnswers = DnsCodec.encode(chunk);
109
110
  }
110
111
  chunk.answers.length = 0;
111
- chunkSize = encodedChunkWithoutAnswers.length + answerEncoded.length;
112
+ chunkSize = encodedChunkWithoutAnswers.byteLength + answerEncoded.byteLength;
112
113
  } else {
113
- chunkSize += answerEncoded.length;
114
+ chunkSize += answerEncoded.byteLength;
114
115
  }
115
116
 
116
117
  chunk.answers.push(answerEncoded);
@@ -120,7 +121,7 @@ export class MdnsSocket {
120
121
  const additionalRecords = message.additionalRecords ?? [];
121
122
  for (const additionalRecord of additionalRecords) {
122
123
  const additionalRecordEncoded = DnsCodec.encodeRecord(additionalRecord);
123
- chunkSize += additionalRecordEncoded.length;
124
+ chunkSize += additionalRecordEncoded.byteLength;
124
125
  if (chunkSize > MAX_MDNS_MESSAGE_SIZE) {
125
126
  break;
126
127
  }
@@ -142,7 +143,7 @@ export class MdnsSocket {
142
143
  }
143
144
  }
144
145
 
145
- #handleMessage(bytes: Uint8Array, sourceIp: string, sourceIntf: string) {
146
+ #handleMessage(bytes: Bytes, sourceIp: string, sourceIntf: string) {
146
147
  // Ignore if closed
147
148
  if (this.#isClosed) {
148
149
  return;
@@ -9,6 +9,7 @@ import { GeneralCommissioning } from "#clusters/general-commissioning";
9
9
  import { CommissionableDevice, CommissionableDeviceIdentifiers, DiscoveryData, ScannerSet } from "#common/Scanner.js";
10
10
  import { Fabric } from "#fabric/Fabric.js";
11
11
  import {
12
+ Bytes,
12
13
  Channel,
13
14
  ChannelType,
14
15
  ClassExtends,
@@ -304,7 +305,7 @@ export class ControllerCommissioner {
304
305
  passcode: number,
305
306
  device?: DiscoveryData,
306
307
  ): Promise<MessageChannel> {
307
- let paseChannel: Channel<Uint8Array>;
308
+ let paseChannel: Channel<Bytes>;
308
309
  if (device !== undefined) {
309
310
  logger.info(`Establish PASE to device`, MdnsClient.discoveryDataDiagnostics(device));
310
311
  }
@@ -781,10 +781,10 @@ export class ControllerCommissioningFlow {
781
781
  );
782
782
  // TODO: validate attestationSignature using device public key
783
783
  if (
784
- deviceAttestation.length === 0 ||
785
- productAttestation.length === 0 ||
786
- attestationElements.length === 0 ||
787
- attestationSignature.length === 0
784
+ deviceAttestation.byteLength === 0 ||
785
+ productAttestation.byteLength === 0 ||
786
+ attestationElements.byteLength === 0 ||
787
+ attestationSignature.byteLength === 0
788
788
  ) {
789
789
  // TODO: validate the data really
790
790
  throw new CommissioningError("Device Attestation data missing from device");
@@ -820,7 +820,7 @@ export class ControllerCommissioningFlow {
820
820
  { csrNonce: this.fabric.crypto.randomBytes(32) },
821
821
  { useExtendedFailSafeMessageResponseTimeout: true },
822
822
  );
823
- if (nocsrElements.length === 0 || csrSignature.length === 0) {
823
+ if (nocsrElements.byteLength === 0 || csrSignature.byteLength === 0) {
824
824
  // TODO: validate the data really
825
825
  throw new UnexpectedDataError("Invalid response from device");
826
826
  }
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { AsyncObservable, Channel, Environment, Environmental, Logger } from "#general";
7
+ import { AsyncObservable, Bytes, Channel, Environment, Environmental, Logger } from "#general";
8
8
  import { PeerAddress, PeerAddressMap } from "#peer/PeerAddress.js";
9
9
  import { MessageChannel } from "#protocol/MessageChannel.js";
10
10
  import { NoChannelError, NodeSession } from "#session/NodeSession.js";
@@ -124,7 +124,7 @@ export class ChannelManager {
124
124
  this.#channels.set(address, fabricChannels);
125
125
  }
126
126
 
127
- private getOrCreateAsPaseChannel(byteArrayChannel: Channel<Uint8Array>, session: Session) {
127
+ private getOrCreateAsPaseChannel(byteArrayChannel: Channel<Bytes>, session: Session) {
128
128
  const msgChannel = new MessageChannel(
129
129
  byteArrayChannel,
130
130
  session,
@@ -138,7 +138,7 @@ export class ChannelManager {
138
138
  return msgChannel;
139
139
  }
140
140
 
141
- async getOrCreateChannel(byteArrayChannel: Channel<Uint8Array>, session: Session) {
141
+ async getOrCreateChannel(byteArrayChannel: Channel<Bytes>, session: Session) {
142
142
  if (!NodeSession.is(session)) {
143
143
  return this.getOrCreateAsPaseChannel(byteArrayChannel, session);
144
144
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { DecodedMessage, MessageCodec, SessionType } from "#codec/MessageCodec.js";
8
8
  import {
9
+ Bytes,
9
10
  Channel,
10
11
  Crypto,
11
12
  Diagnostic,
@@ -146,9 +147,10 @@ export class ExchangeManager {
146
147
  this.#exchanges.clear();
147
148
  }
148
149
 
149
- private async onMessage(channel: Channel<Uint8Array>, messageBytes: Uint8Array) {
150
+ private async onMessage(channel: Channel<Bytes>, messageBytes: Bytes) {
150
151
  const packet = MessageCodec.decodePacket(messageBytes);
151
- const aad = messageBytes.slice(0, messageBytes.length - packet.applicationPayload.length); // Header+Extensions
152
+ const bytes = Bytes.of(messageBytes);
153
+ const aad = bytes.slice(0, bytes.length - packet.applicationPayload.byteLength); // Header+Extensions
152
154
 
153
155
  const messageId = packet.header.messageId;
154
156
 
@@ -193,7 +195,7 @@ export class ExchangeManager {
193
195
  throw new UnexpectedDataError("Group session message must include a source NodeId");
194
196
  }
195
197
 
196
- let key: Uint8Array;
198
+ let key: Bytes;
197
199
  ({ session, message, key } = this.#sessionManager.groupSessionFromPacket(packet, aad));
198
200
 
199
201
  try {
@@ -431,9 +433,9 @@ export class ExchangeManager {
431
433
  this.#listeners.set(
432
434
  transportInterface,
433
435
  transportInterface.onData((socket, data) => {
434
- if (udpInterface && data.length > socket.maxPayloadSize) {
436
+ if (udpInterface && data.byteLength > socket.maxPayloadSize) {
435
437
  logger.warn(
436
- `Ignoring UDP message on channel ${socket.name} with size ${data.length} from ${socket.name}, which is larger than the maximum allowed size of ${socket.maxPayloadSize}.`,
438
+ `Ignoring UDP message on channel ${socket.name} with size ${data.byteLength} from ${socket.name}, which is larger than the maximum allowed size of ${socket.maxPayloadSize}.`,
437
439
  );
438
440
  return;
439
441
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import { Message, MessageCodec } from "#codec/MessageCodec.js";
8
- import { Channel, Logger, MatterError, MatterFlowError } from "#general";
8
+ import { Bytes, Channel, Logger, MatterError, MatterFlowError } from "#general";
9
9
  import type { ExchangeLogContext } from "#protocol/MessageExchange.js";
10
10
  import { Session, SessionParameters } from "#session/Session.js";
11
11
 
@@ -55,7 +55,7 @@ export class MessageChannel implements Channel<Message> {
55
55
  // When the session is supporting MRP and the channel is not reliable, use MRP handling
56
56
 
57
57
  constructor(
58
- readonly channel: Channel<Uint8Array>,
58
+ readonly channel: Channel<Bytes>,
59
59
  readonly session: Session,
60
60
  closeCallback?: () => Promise<void>,
61
61
  ) {
@@ -91,9 +91,9 @@ export class MessageChannel implements Channel<Message> {
91
91
  logger.debug("Message »", MessageCodec.messageDiagnostics(message, logContext));
92
92
  const packet = this.session.encode(message);
93
93
  const bytes = MessageCodec.encodePacket(packet);
94
- if (bytes.length > this.maxPayloadSize) {
94
+ if (bytes.byteLength > this.maxPayloadSize) {
95
95
  logger.warn(
96
- `Matter message to send to ${this.name} is ${bytes.length}bytes long, which is larger than the maximum allowed size of ${this.maxPayloadSize}. This only works if both nodes support it.`,
96
+ `Matter message to send to ${this.name} is ${bytes.byteLength}bytes long, which is larger than the maximum allowed size of ${this.maxPayloadSize}. This only works if both nodes support it.`,
97
97
  );
98
98
  }
99
99