@matter/protocol 0.18.0 → 0.18.1-alpha.0-20261111-b89790712

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 (527) hide show
  1. package/dist/cjs/action/Val.d.ts +8 -0
  2. package/dist/cjs/action/Val.d.ts.map +1 -1
  3. package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
  4. package/dist/cjs/action/client/ClientInteraction.js +19 -20
  5. package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
  6. package/dist/cjs/action/client/ClientRequest.d.ts +14 -0
  7. package/dist/cjs/action/client/ClientRequest.d.ts.map +1 -1
  8. package/dist/cjs/action/client/InputChunk.js +39 -2
  9. package/dist/cjs/action/client/InputChunk.js.map +1 -1
  10. package/dist/cjs/action/errors.d.ts +3 -1
  11. package/dist/cjs/action/errors.d.ts.map +1 -1
  12. package/dist/cjs/action/errors.js +7 -2
  13. package/dist/cjs/action/errors.js.map +1 -1
  14. package/dist/cjs/action/protocols.d.ts +6 -1
  15. package/dist/cjs/action/protocols.d.ts.map +1 -1
  16. package/dist/cjs/action/request/Invoke.d.ts +24 -1
  17. package/dist/cjs/action/request/Invoke.d.ts.map +1 -1
  18. package/dist/cjs/action/request/Invoke.js +40 -12
  19. package/dist/cjs/action/request/Invoke.js.map +1 -1
  20. package/dist/cjs/action/request/Write.d.ts.map +1 -1
  21. package/dist/cjs/action/request/Write.js +6 -5
  22. package/dist/cjs/action/request/Write.js.map +1 -1
  23. package/dist/cjs/action/response/ReadResult.d.ts +14 -5
  24. package/dist/cjs/action/response/ReadResult.d.ts.map +1 -1
  25. package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
  26. package/dist/cjs/action/server/AttributeReadResponse.js +1 -1
  27. package/dist/cjs/action/server/AttributeReadResponse.js.map +1 -1
  28. package/dist/cjs/action/server/AttributeWriteResponse.d.ts.map +1 -1
  29. package/dist/cjs/action/server/AttributeWriteResponse.js +4 -2
  30. package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
  31. package/dist/cjs/action/server/EventReadResponse.d.ts.map +1 -1
  32. package/dist/cjs/action/server/EventReadResponse.js +1 -0
  33. package/dist/cjs/action/server/EventReadResponse.js.map +1 -1
  34. package/dist/cjs/advertisement/mdns/MdnsAdvertisement.d.ts +1 -1
  35. package/dist/cjs/advertisement/mdns/MdnsAdvertisement.d.ts.map +1 -1
  36. package/dist/cjs/advertisement/mdns/MdnsAdvertisement.js +7 -7
  37. package/dist/cjs/advertisement/mdns/MdnsAdvertisement.js.map +1 -1
  38. package/dist/cjs/ble/Ble.d.ts +2 -0
  39. package/dist/cjs/ble/Ble.d.ts.map +1 -1
  40. package/dist/cjs/ble/Ble.js +4 -0
  41. package/dist/cjs/ble/Ble.js.map +1 -1
  42. package/dist/cjs/certificate/CdSigners.d.ts +52 -0
  43. package/dist/cjs/certificate/CdSigners.d.ts.map +1 -0
  44. package/dist/cjs/certificate/CdSigners.js +111 -0
  45. package/dist/cjs/certificate/CdSigners.js.map +6 -0
  46. package/dist/cjs/certificate/CertificateAuthority.d.ts +1 -1
  47. package/dist/cjs/certificate/CertificateAuthority.d.ts.map +1 -1
  48. package/dist/cjs/certificate/DeviceAttestationValidator.d.ts +53 -7
  49. package/dist/cjs/certificate/DeviceAttestationValidator.d.ts.map +1 -1
  50. package/dist/cjs/certificate/DeviceAttestationValidator.js +114 -42
  51. package/dist/cjs/certificate/DeviceAttestationValidator.js.map +1 -1
  52. package/dist/cjs/certificate/DeviceCertification.d.ts.map +1 -1
  53. package/dist/cjs/certificate/DeviceCertification.js +5 -2
  54. package/dist/cjs/certificate/DeviceCertification.js.map +1 -1
  55. package/dist/cjs/certificate/index.d.ts +1 -0
  56. package/dist/cjs/certificate/index.d.ts.map +1 -1
  57. package/dist/cjs/certificate/index.js +1 -0
  58. package/dist/cjs/certificate/index.js.map +1 -1
  59. package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts +42 -6
  60. package/dist/cjs/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
  61. package/dist/cjs/certificate/kinds/AttestationCertificates.js +110 -13
  62. package/dist/cjs/certificate/kinds/AttestationCertificates.js.map +1 -1
  63. package/dist/cjs/certificate/kinds/Certificate.d.ts +13 -7
  64. package/dist/cjs/certificate/kinds/Certificate.d.ts.map +1 -1
  65. package/dist/cjs/certificate/kinds/Certificate.js +146 -240
  66. package/dist/cjs/certificate/kinds/Certificate.js.map +2 -2
  67. package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts +21 -3
  68. package/dist/cjs/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
  69. package/dist/cjs/certificate/kinds/CertificationDeclaration.js +76 -20
  70. package/dist/cjs/certificate/kinds/CertificationDeclaration.js.map +1 -1
  71. package/dist/cjs/certificate/kinds/DistinguishedName.d.ts +190 -0
  72. package/dist/cjs/certificate/kinds/DistinguishedName.d.ts.map +1 -0
  73. package/dist/cjs/certificate/kinds/DistinguishedName.js +417 -0
  74. package/dist/cjs/certificate/kinds/DistinguishedName.js.map +6 -0
  75. package/dist/cjs/certificate/kinds/Icac.d.ts.map +1 -1
  76. package/dist/cjs/certificate/kinds/Icac.js +5 -10
  77. package/dist/cjs/certificate/kinds/Icac.js.map +1 -1
  78. package/dist/cjs/certificate/kinds/Noc.d.ts.map +1 -1
  79. package/dist/cjs/certificate/kinds/Noc.js +5 -4
  80. package/dist/cjs/certificate/kinds/Noc.js.map +1 -1
  81. package/dist/cjs/certificate/kinds/OperationalBase.d.ts.map +1 -1
  82. package/dist/cjs/certificate/kinds/OperationalBase.js +4 -2
  83. package/dist/cjs/certificate/kinds/OperationalBase.js.map +1 -1
  84. package/dist/cjs/certificate/kinds/Rcac.d.ts.map +1 -1
  85. package/dist/cjs/certificate/kinds/Rcac.js +5 -10
  86. package/dist/cjs/certificate/kinds/Rcac.js.map +1 -1
  87. package/dist/cjs/certificate/kinds/Vvsc.d.ts +3 -3
  88. package/dist/cjs/certificate/kinds/Vvsc.d.ts.map +1 -1
  89. package/dist/cjs/certificate/kinds/Vvsc.js +19 -14
  90. package/dist/cjs/certificate/kinds/Vvsc.js.map +1 -1
  91. package/dist/cjs/certificate/kinds/definitions/asn.d.ts +1 -1
  92. package/dist/cjs/certificate/kinds/definitions/asn.d.ts.map +1 -1
  93. package/dist/cjs/certificate/kinds/definitions/asn.js.map +1 -1
  94. package/dist/cjs/certificate/kinds/definitions/attestation.d.ts +15 -15
  95. package/dist/cjs/certificate/kinds/definitions/attestation.d.ts.map +1 -1
  96. package/dist/cjs/certificate/kinds/definitions/base.d.ts +33 -0
  97. package/dist/cjs/certificate/kinds/definitions/base.d.ts.map +1 -1
  98. package/dist/cjs/certificate/kinds/definitions/base.js +8 -1
  99. package/dist/cjs/certificate/kinds/definitions/base.js.map +1 -1
  100. package/dist/cjs/certificate/kinds/definitions/operational.d.ts +24 -20
  101. package/dist/cjs/certificate/kinds/definitions/operational.d.ts.map +1 -1
  102. package/dist/cjs/certificate/kinds/definitions/operational.js +5 -3
  103. package/dist/cjs/certificate/kinds/definitions/operational.js.map +1 -1
  104. package/dist/cjs/codec/MessageCodec.d.ts +27 -2
  105. package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
  106. package/dist/cjs/codec/MessageCodec.js +81 -74
  107. package/dist/cjs/codec/MessageCodec.js.map +1 -1
  108. package/dist/cjs/dcl/DclCertificateService.d.ts +28 -7
  109. package/dist/cjs/dcl/DclCertificateService.d.ts.map +1 -1
  110. package/dist/cjs/dcl/DclCertificateService.js +103 -30
  111. package/dist/cjs/dcl/DclCertificateService.js.map +1 -1
  112. package/dist/cjs/fabric/Fabric.d.ts +10 -5
  113. package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
  114. package/dist/cjs/fabric/Fabric.js +12 -5
  115. package/dist/cjs/fabric/Fabric.js.map +1 -1
  116. package/dist/cjs/fabric/FabricManager.d.ts +2 -2
  117. package/dist/cjs/fabric/FabricManager.js +2 -2
  118. package/dist/cjs/groups/FabricGroups.d.ts +2 -0
  119. package/dist/cjs/groups/FabricGroups.d.ts.map +1 -1
  120. package/dist/cjs/groups/FabricGroups.js +4 -0
  121. package/dist/cjs/groups/FabricGroups.js.map +1 -1
  122. package/dist/cjs/groups/Groups.d.ts +7 -0
  123. package/dist/cjs/groups/Groups.d.ts.map +1 -1
  124. package/dist/cjs/groups/Groups.js +11 -2
  125. package/dist/cjs/groups/Groups.js.map +1 -1
  126. package/dist/cjs/groups/KeySets.d.ts +3 -3
  127. package/dist/cjs/groups/KeySets.js +3 -3
  128. package/dist/cjs/mdns/InterfaceResponder.d.ts +137 -0
  129. package/dist/cjs/mdns/InterfaceResponder.d.ts.map +1 -0
  130. package/dist/cjs/mdns/InterfaceResponder.js +799 -0
  131. package/dist/cjs/mdns/InterfaceResponder.js.map +6 -0
  132. package/dist/cjs/mdns/MdnsServer.d.ts +82 -9
  133. package/dist/cjs/mdns/MdnsServer.d.ts.map +1 -1
  134. package/dist/cjs/mdns/MdnsServer.js +337 -267
  135. package/dist/cjs/mdns/MdnsServer.js.map +2 -2
  136. package/dist/cjs/peer/CommissioningConnection.d.ts.map +1 -1
  137. package/dist/cjs/peer/CommissioningConnection.js +4 -2
  138. package/dist/cjs/peer/CommissioningConnection.js.map +1 -1
  139. package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
  140. package/dist/cjs/peer/ControllerCommissioner.js +48 -13
  141. package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
  142. package/dist/cjs/peer/ControllerCommissioningFlow.d.ts +7 -7
  143. package/dist/cjs/peer/ControllerCommissioningFlow.d.ts.map +1 -1
  144. package/dist/cjs/peer/ControllerCommissioningFlow.js +109 -32
  145. package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
  146. package/dist/cjs/peer/Peer.d.ts +5 -0
  147. package/dist/cjs/peer/Peer.d.ts.map +1 -1
  148. package/dist/cjs/peer/Peer.js +29 -1
  149. package/dist/cjs/peer/Peer.js.map +1 -1
  150. package/dist/cjs/peer/PeerAddressStore.d.ts +37 -0
  151. package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -0
  152. package/dist/cjs/peer/PeerAddressStore.js +114 -0
  153. package/dist/cjs/peer/PeerAddressStore.js.map +6 -0
  154. package/dist/cjs/peer/PeerConnection.d.ts.map +1 -1
  155. package/dist/cjs/peer/PeerConnection.js +0 -1
  156. package/dist/cjs/peer/PeerConnection.js.map +1 -1
  157. package/dist/cjs/peer/PeerDescriptor.d.ts +3 -4
  158. package/dist/cjs/peer/PeerDescriptor.d.ts.map +1 -1
  159. package/dist/cjs/peer/PeerDescriptor.js.map +1 -1
  160. package/dist/cjs/peer/PeerExchangeProvider.d.ts.map +1 -1
  161. package/dist/cjs/peer/PeerExchangeProvider.js +2 -1
  162. package/dist/cjs/peer/PeerExchangeProvider.js.map +1 -1
  163. package/dist/cjs/peer/PeerLossContext.d.ts +10 -2
  164. package/dist/cjs/peer/PeerLossContext.d.ts.map +1 -1
  165. package/dist/cjs/peer/PhysicalDeviceProperties.d.ts +13 -0
  166. package/dist/cjs/peer/PhysicalDeviceProperties.d.ts.map +1 -1
  167. package/dist/cjs/peer/PhysicalDeviceProperties.js +3 -2
  168. package/dist/cjs/peer/PhysicalDeviceProperties.js.map +1 -1
  169. package/dist/cjs/peer/RebootResubscribeArmer.d.ts +3 -3
  170. package/dist/cjs/peer/RebootResubscribeArmer.d.ts.map +1 -1
  171. package/dist/cjs/peer/RebootResubscribeArmer.js +21 -9
  172. package/dist/cjs/peer/RebootResubscribeArmer.js.map +1 -1
  173. package/dist/cjs/peer/index.d.ts +1 -0
  174. package/dist/cjs/peer/index.d.ts.map +1 -1
  175. package/dist/cjs/peer/index.js +1 -0
  176. package/dist/cjs/peer/index.js.map +1 -1
  177. package/dist/cjs/protocol/DeviceAdvertiser.d.ts.map +1 -1
  178. package/dist/cjs/protocol/DeviceAdvertiser.js +1 -1
  179. package/dist/cjs/protocol/DeviceAdvertiser.js.map +1 -1
  180. package/dist/cjs/protocol/ExchangeManager.d.ts +0 -1
  181. package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
  182. package/dist/cjs/protocol/ExchangeManager.js +136 -64
  183. package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
  184. package/dist/cjs/protocol/ExchangeProvider.d.ts +3 -2
  185. package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
  186. package/dist/cjs/protocol/ExchangeProvider.js.map +1 -1
  187. package/dist/cjs/protocol/MessageExchange.d.ts +13 -0
  188. package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
  189. package/dist/cjs/protocol/MessageExchange.js +16 -6
  190. package/dist/cjs/protocol/MessageExchange.js.map +1 -1
  191. package/dist/cjs/protocol/MessageReceptionState.d.ts +1 -1
  192. package/dist/cjs/protocol/errors.d.ts +7 -1
  193. package/dist/cjs/protocol/errors.d.ts.map +1 -1
  194. package/dist/cjs/protocol/errors.js +3 -0
  195. package/dist/cjs/protocol/errors.js.map +1 -1
  196. package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +6 -1
  197. package/dist/cjs/securechannel/SecureChannelMessenger.d.ts.map +1 -1
  198. package/dist/cjs/securechannel/SecureChannelMessenger.js +27 -12
  199. package/dist/cjs/securechannel/SecureChannelMessenger.js.map +1 -1
  200. package/dist/cjs/session/GroupSession.d.ts +58 -15
  201. package/dist/cjs/session/GroupSession.d.ts.map +1 -1
  202. package/dist/cjs/session/GroupSession.js +97 -102
  203. package/dist/cjs/session/GroupSession.js.map +2 -2
  204. package/dist/cjs/session/NodeSession.d.ts +50 -1
  205. package/dist/cjs/session/NodeSession.d.ts.map +1 -1
  206. package/dist/cjs/session/NodeSession.js +80 -4
  207. package/dist/cjs/session/NodeSession.js.map +1 -1
  208. package/dist/cjs/session/SecureSession.d.ts +9 -0
  209. package/dist/cjs/session/SecureSession.d.ts.map +1 -1
  210. package/dist/cjs/session/SecureSession.js +12 -0
  211. package/dist/cjs/session/SecureSession.js.map +1 -1
  212. package/dist/cjs/session/Session.d.ts +2 -2
  213. package/dist/cjs/session/Session.d.ts.map +1 -1
  214. package/dist/cjs/session/Session.js +1 -1
  215. package/dist/cjs/session/SessionManager.d.ts +76 -28
  216. package/dist/cjs/session/SessionManager.d.ts.map +1 -1
  217. package/dist/cjs/session/SessionManager.js +316 -153
  218. package/dist/cjs/session/SessionManager.js.map +2 -2
  219. package/dist/cjs/session/UnsecuredSession.d.ts +0 -1
  220. package/dist/cjs/session/UnsecuredSession.d.ts.map +1 -1
  221. package/dist/cjs/session/UnsecuredSession.js +2 -4
  222. package/dist/cjs/session/UnsecuredSession.js.map +1 -1
  223. package/dist/cjs/session/case/CaseClient.d.ts +5 -0
  224. package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
  225. package/dist/cjs/session/case/CaseClient.js +12 -11
  226. package/dist/cjs/session/case/CaseClient.js.map +2 -2
  227. package/dist/cjs/session/case/CaseServer.d.ts.map +1 -1
  228. package/dist/cjs/session/case/CaseServer.js +31 -11
  229. package/dist/cjs/session/case/CaseServer.js.map +1 -1
  230. package/dist/esm/action/Val.d.ts +8 -0
  231. package/dist/esm/action/Val.d.ts.map +1 -1
  232. package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
  233. package/dist/esm/action/client/ClientInteraction.js +19 -20
  234. package/dist/esm/action/client/ClientInteraction.js.map +1 -1
  235. package/dist/esm/action/client/ClientRequest.d.ts +14 -0
  236. package/dist/esm/action/client/ClientRequest.d.ts.map +1 -1
  237. package/dist/esm/action/client/InputChunk.js +39 -2
  238. package/dist/esm/action/client/InputChunk.js.map +1 -1
  239. package/dist/esm/action/errors.d.ts +3 -1
  240. package/dist/esm/action/errors.d.ts.map +1 -1
  241. package/dist/esm/action/errors.js +7 -2
  242. package/dist/esm/action/errors.js.map +1 -1
  243. package/dist/esm/action/protocols.d.ts +6 -1
  244. package/dist/esm/action/protocols.d.ts.map +1 -1
  245. package/dist/esm/action/request/Invoke.d.ts +24 -1
  246. package/dist/esm/action/request/Invoke.d.ts.map +1 -1
  247. package/dist/esm/action/request/Invoke.js +41 -13
  248. package/dist/esm/action/request/Invoke.js.map +1 -1
  249. package/dist/esm/action/request/Write.d.ts.map +1 -1
  250. package/dist/esm/action/request/Write.js +7 -6
  251. package/dist/esm/action/request/Write.js.map +1 -1
  252. package/dist/esm/action/response/ReadResult.d.ts +14 -5
  253. package/dist/esm/action/response/ReadResult.d.ts.map +1 -1
  254. package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
  255. package/dist/esm/action/server/AttributeReadResponse.js +2 -2
  256. package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
  257. package/dist/esm/action/server/AttributeWriteResponse.d.ts.map +1 -1
  258. package/dist/esm/action/server/AttributeWriteResponse.js +11 -3
  259. package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
  260. package/dist/esm/action/server/EventReadResponse.d.ts.map +1 -1
  261. package/dist/esm/action/server/EventReadResponse.js +1 -0
  262. package/dist/esm/action/server/EventReadResponse.js.map +1 -1
  263. package/dist/esm/advertisement/mdns/MdnsAdvertisement.d.ts +1 -1
  264. package/dist/esm/advertisement/mdns/MdnsAdvertisement.d.ts.map +1 -1
  265. package/dist/esm/advertisement/mdns/MdnsAdvertisement.js +7 -7
  266. package/dist/esm/advertisement/mdns/MdnsAdvertisement.js.map +1 -1
  267. package/dist/esm/ble/Ble.d.ts +2 -0
  268. package/dist/esm/ble/Ble.d.ts.map +1 -1
  269. package/dist/esm/ble/Ble.js +4 -0
  270. package/dist/esm/ble/Ble.js.map +1 -1
  271. package/dist/esm/certificate/CdSigners.d.ts +52 -0
  272. package/dist/esm/certificate/CdSigners.d.ts.map +1 -0
  273. package/dist/esm/certificate/CdSigners.js +91 -0
  274. package/dist/esm/certificate/CdSigners.js.map +6 -0
  275. package/dist/esm/certificate/CertificateAuthority.d.ts +1 -1
  276. package/dist/esm/certificate/CertificateAuthority.d.ts.map +1 -1
  277. package/dist/esm/certificate/DeviceAttestationValidator.d.ts +53 -7
  278. package/dist/esm/certificate/DeviceAttestationValidator.d.ts.map +1 -1
  279. package/dist/esm/certificate/DeviceAttestationValidator.js +115 -43
  280. package/dist/esm/certificate/DeviceAttestationValidator.js.map +1 -1
  281. package/dist/esm/certificate/DeviceCertification.d.ts.map +1 -1
  282. package/dist/esm/certificate/DeviceCertification.js +5 -2
  283. package/dist/esm/certificate/DeviceCertification.js.map +1 -1
  284. package/dist/esm/certificate/index.d.ts +1 -0
  285. package/dist/esm/certificate/index.d.ts.map +1 -1
  286. package/dist/esm/certificate/index.js +1 -0
  287. package/dist/esm/certificate/index.js.map +1 -1
  288. package/dist/esm/certificate/kinds/AttestationCertificates.d.ts +42 -6
  289. package/dist/esm/certificate/kinds/AttestationCertificates.d.ts.map +1 -1
  290. package/dist/esm/certificate/kinds/AttestationCertificates.js +112 -15
  291. package/dist/esm/certificate/kinds/AttestationCertificates.js.map +1 -1
  292. package/dist/esm/certificate/kinds/Certificate.d.ts +13 -7
  293. package/dist/esm/certificate/kinds/Certificate.d.ts.map +1 -1
  294. package/dist/esm/certificate/kinds/Certificate.js +153 -256
  295. package/dist/esm/certificate/kinds/Certificate.js.map +2 -2
  296. package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts +21 -3
  297. package/dist/esm/certificate/kinds/CertificationDeclaration.d.ts.map +1 -1
  298. package/dist/esm/certificate/kinds/CertificationDeclaration.js +79 -20
  299. package/dist/esm/certificate/kinds/CertificationDeclaration.js.map +1 -1
  300. package/dist/esm/certificate/kinds/DistinguishedName.d.ts +190 -0
  301. package/dist/esm/certificate/kinds/DistinguishedName.d.ts.map +1 -0
  302. package/dist/esm/certificate/kinds/DistinguishedName.js +422 -0
  303. package/dist/esm/certificate/kinds/DistinguishedName.js.map +6 -0
  304. package/dist/esm/certificate/kinds/Icac.d.ts.map +1 -1
  305. package/dist/esm/certificate/kinds/Icac.js +6 -11
  306. package/dist/esm/certificate/kinds/Icac.js.map +1 -1
  307. package/dist/esm/certificate/kinds/Noc.d.ts.map +1 -1
  308. package/dist/esm/certificate/kinds/Noc.js +5 -4
  309. package/dist/esm/certificate/kinds/Noc.js.map +1 -1
  310. package/dist/esm/certificate/kinds/OperationalBase.d.ts.map +1 -1
  311. package/dist/esm/certificate/kinds/OperationalBase.js +4 -2
  312. package/dist/esm/certificate/kinds/OperationalBase.js.map +1 -1
  313. package/dist/esm/certificate/kinds/Rcac.d.ts.map +1 -1
  314. package/dist/esm/certificate/kinds/Rcac.js +6 -11
  315. package/dist/esm/certificate/kinds/Rcac.js.map +1 -1
  316. package/dist/esm/certificate/kinds/Vvsc.d.ts +3 -3
  317. package/dist/esm/certificate/kinds/Vvsc.d.ts.map +1 -1
  318. package/dist/esm/certificate/kinds/Vvsc.js +20 -15
  319. package/dist/esm/certificate/kinds/Vvsc.js.map +1 -1
  320. package/dist/esm/certificate/kinds/definitions/asn.d.ts +1 -1
  321. package/dist/esm/certificate/kinds/definitions/asn.d.ts.map +1 -1
  322. package/dist/esm/certificate/kinds/definitions/asn.js.map +1 -1
  323. package/dist/esm/certificate/kinds/definitions/attestation.d.ts +15 -15
  324. package/dist/esm/certificate/kinds/definitions/attestation.d.ts.map +1 -1
  325. package/dist/esm/certificate/kinds/definitions/base.d.ts +33 -0
  326. package/dist/esm/certificate/kinds/definitions/base.d.ts.map +1 -1
  327. package/dist/esm/certificate/kinds/definitions/base.js +9 -2
  328. package/dist/esm/certificate/kinds/definitions/base.js.map +1 -1
  329. package/dist/esm/certificate/kinds/definitions/operational.d.ts +24 -20
  330. package/dist/esm/certificate/kinds/definitions/operational.d.ts.map +1 -1
  331. package/dist/esm/certificate/kinds/definitions/operational.js +5 -3
  332. package/dist/esm/certificate/kinds/definitions/operational.js.map +1 -1
  333. package/dist/esm/codec/MessageCodec.d.ts +27 -2
  334. package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
  335. package/dist/esm/codec/MessageCodec.js +82 -75
  336. package/dist/esm/codec/MessageCodec.js.map +1 -1
  337. package/dist/esm/dcl/DclCertificateService.d.ts +28 -7
  338. package/dist/esm/dcl/DclCertificateService.d.ts.map +1 -1
  339. package/dist/esm/dcl/DclCertificateService.js +108 -31
  340. package/dist/esm/dcl/DclCertificateService.js.map +1 -1
  341. package/dist/esm/fabric/Fabric.d.ts +10 -5
  342. package/dist/esm/fabric/Fabric.d.ts.map +1 -1
  343. package/dist/esm/fabric/Fabric.js +12 -5
  344. package/dist/esm/fabric/Fabric.js.map +1 -1
  345. package/dist/esm/fabric/FabricManager.d.ts +2 -2
  346. package/dist/esm/fabric/FabricManager.js +2 -2
  347. package/dist/esm/groups/FabricGroups.d.ts +2 -0
  348. package/dist/esm/groups/FabricGroups.d.ts.map +1 -1
  349. package/dist/esm/groups/FabricGroups.js +4 -0
  350. package/dist/esm/groups/FabricGroups.js.map +1 -1
  351. package/dist/esm/groups/Groups.d.ts +7 -0
  352. package/dist/esm/groups/Groups.d.ts.map +1 -1
  353. package/dist/esm/groups/Groups.js +11 -2
  354. package/dist/esm/groups/Groups.js.map +1 -1
  355. package/dist/esm/groups/KeySets.d.ts +3 -3
  356. package/dist/esm/groups/KeySets.js +3 -3
  357. package/dist/esm/mdns/InterfaceResponder.d.ts +137 -0
  358. package/dist/esm/mdns/InterfaceResponder.d.ts.map +1 -0
  359. package/dist/esm/mdns/InterfaceResponder.js +794 -0
  360. package/dist/esm/mdns/InterfaceResponder.js.map +6 -0
  361. package/dist/esm/mdns/MdnsServer.d.ts +82 -9
  362. package/dist/esm/mdns/MdnsServer.d.ts.map +1 -1
  363. package/dist/esm/mdns/MdnsServer.js +341 -273
  364. package/dist/esm/mdns/MdnsServer.js.map +2 -2
  365. package/dist/esm/peer/CommissioningConnection.d.ts.map +1 -1
  366. package/dist/esm/peer/CommissioningConnection.js +4 -2
  367. package/dist/esm/peer/CommissioningConnection.js.map +1 -1
  368. package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
  369. package/dist/esm/peer/ControllerCommissioner.js +48 -13
  370. package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
  371. package/dist/esm/peer/ControllerCommissioningFlow.d.ts +7 -7
  372. package/dist/esm/peer/ControllerCommissioningFlow.d.ts.map +1 -1
  373. package/dist/esm/peer/ControllerCommissioningFlow.js +109 -32
  374. package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
  375. package/dist/esm/peer/Peer.d.ts +5 -0
  376. package/dist/esm/peer/Peer.d.ts.map +1 -1
  377. package/dist/esm/peer/Peer.js +29 -1
  378. package/dist/esm/peer/Peer.js.map +1 -1
  379. package/dist/esm/peer/PeerAddressStore.d.ts +37 -0
  380. package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -0
  381. package/dist/esm/peer/PeerAddressStore.js +94 -0
  382. package/dist/esm/peer/PeerAddressStore.js.map +6 -0
  383. package/dist/esm/peer/PeerConnection.d.ts.map +1 -1
  384. package/dist/esm/peer/PeerConnection.js +0 -1
  385. package/dist/esm/peer/PeerConnection.js.map +1 -1
  386. package/dist/esm/peer/PeerDescriptor.d.ts +3 -4
  387. package/dist/esm/peer/PeerDescriptor.d.ts.map +1 -1
  388. package/dist/esm/peer/PeerDescriptor.js.map +1 -1
  389. package/dist/esm/peer/PeerExchangeProvider.d.ts.map +1 -1
  390. package/dist/esm/peer/PeerExchangeProvider.js +3 -2
  391. package/dist/esm/peer/PeerExchangeProvider.js.map +1 -1
  392. package/dist/esm/peer/PeerLossContext.d.ts +10 -2
  393. package/dist/esm/peer/PeerLossContext.d.ts.map +1 -1
  394. package/dist/esm/peer/PhysicalDeviceProperties.d.ts +13 -0
  395. package/dist/esm/peer/PhysicalDeviceProperties.d.ts.map +1 -1
  396. package/dist/esm/peer/PhysicalDeviceProperties.js +3 -2
  397. package/dist/esm/peer/PhysicalDeviceProperties.js.map +1 -1
  398. package/dist/esm/peer/RebootResubscribeArmer.d.ts +3 -3
  399. package/dist/esm/peer/RebootResubscribeArmer.d.ts.map +1 -1
  400. package/dist/esm/peer/RebootResubscribeArmer.js +21 -9
  401. package/dist/esm/peer/RebootResubscribeArmer.js.map +1 -1
  402. package/dist/esm/peer/index.d.ts +1 -0
  403. package/dist/esm/peer/index.d.ts.map +1 -1
  404. package/dist/esm/peer/index.js +1 -0
  405. package/dist/esm/peer/index.js.map +1 -1
  406. package/dist/esm/protocol/DeviceAdvertiser.d.ts.map +1 -1
  407. package/dist/esm/protocol/DeviceAdvertiser.js +1 -1
  408. package/dist/esm/protocol/DeviceAdvertiser.js.map +1 -1
  409. package/dist/esm/protocol/ExchangeManager.d.ts +0 -1
  410. package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
  411. package/dist/esm/protocol/ExchangeManager.js +145 -67
  412. package/dist/esm/protocol/ExchangeManager.js.map +1 -1
  413. package/dist/esm/protocol/ExchangeProvider.d.ts +3 -2
  414. package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
  415. package/dist/esm/protocol/ExchangeProvider.js.map +1 -1
  416. package/dist/esm/protocol/MessageExchange.d.ts +13 -0
  417. package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
  418. package/dist/esm/protocol/MessageExchange.js +16 -6
  419. package/dist/esm/protocol/MessageExchange.js.map +1 -1
  420. package/dist/esm/protocol/MessageReceptionState.d.ts +1 -1
  421. package/dist/esm/protocol/errors.d.ts +7 -1
  422. package/dist/esm/protocol/errors.d.ts.map +1 -1
  423. package/dist/esm/protocol/errors.js +4 -1
  424. package/dist/esm/protocol/errors.js.map +1 -1
  425. package/dist/esm/securechannel/SecureChannelMessenger.d.ts +6 -1
  426. package/dist/esm/securechannel/SecureChannelMessenger.d.ts.map +1 -1
  427. package/dist/esm/securechannel/SecureChannelMessenger.js +27 -12
  428. package/dist/esm/securechannel/SecureChannelMessenger.js.map +1 -1
  429. package/dist/esm/session/GroupSession.d.ts +58 -15
  430. package/dist/esm/session/GroupSession.d.ts.map +1 -1
  431. package/dist/esm/session/GroupSession.js +97 -102
  432. package/dist/esm/session/GroupSession.js.map +2 -2
  433. package/dist/esm/session/NodeSession.d.ts +50 -1
  434. package/dist/esm/session/NodeSession.d.ts.map +1 -1
  435. package/dist/esm/session/NodeSession.js +83 -5
  436. package/dist/esm/session/NodeSession.js.map +1 -1
  437. package/dist/esm/session/SecureSession.d.ts +9 -0
  438. package/dist/esm/session/SecureSession.d.ts.map +1 -1
  439. package/dist/esm/session/SecureSession.js +18 -1
  440. package/dist/esm/session/SecureSession.js.map +1 -1
  441. package/dist/esm/session/Session.d.ts +2 -2
  442. package/dist/esm/session/Session.d.ts.map +1 -1
  443. package/dist/esm/session/Session.js +1 -1
  444. package/dist/esm/session/SessionManager.d.ts +76 -28
  445. package/dist/esm/session/SessionManager.d.ts.map +1 -1
  446. package/dist/esm/session/SessionManager.js +319 -156
  447. package/dist/esm/session/SessionManager.js.map +2 -2
  448. package/dist/esm/session/UnsecuredSession.d.ts +0 -1
  449. package/dist/esm/session/UnsecuredSession.d.ts.map +1 -1
  450. package/dist/esm/session/UnsecuredSession.js +5 -3
  451. package/dist/esm/session/UnsecuredSession.js.map +1 -1
  452. package/dist/esm/session/case/CaseClient.d.ts +5 -0
  453. package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
  454. package/dist/esm/session/case/CaseClient.js +12 -11
  455. package/dist/esm/session/case/CaseClient.js.map +2 -2
  456. package/dist/esm/session/case/CaseServer.d.ts.map +1 -1
  457. package/dist/esm/session/case/CaseServer.js +31 -11
  458. package/dist/esm/session/case/CaseServer.js.map +1 -1
  459. package/package.json +5 -5
  460. package/src/action/Val.ts +8 -0
  461. package/src/action/client/ClientInteraction.ts +19 -21
  462. package/src/action/client/ClientRequest.ts +15 -0
  463. package/src/action/client/InputChunk.ts +57 -2
  464. package/src/action/errors.ts +10 -3
  465. package/src/action/protocols.ts +7 -1
  466. package/src/action/request/Invoke.ts +60 -15
  467. package/src/action/request/Write.ts +7 -6
  468. package/src/action/response/ReadResult.ts +15 -5
  469. package/src/action/server/AttributeReadResponse.ts +3 -2
  470. package/src/action/server/AttributeWriteResponse.ts +14 -3
  471. package/src/action/server/EventReadResponse.ts +1 -0
  472. package/src/advertisement/mdns/MdnsAdvertisement.ts +9 -9
  473. package/src/ble/Ble.ts +5 -0
  474. package/src/certificate/CdSigners.ts +137 -0
  475. package/src/certificate/CertificateAuthority.ts +1 -1
  476. package/src/certificate/DeviceAttestationValidator.ts +202 -54
  477. package/src/certificate/DeviceCertification.ts +6 -2
  478. package/src/certificate/index.ts +1 -0
  479. package/src/certificate/kinds/AttestationCertificates.ts +183 -15
  480. package/src/certificate/kinds/Certificate.ts +203 -308
  481. package/src/certificate/kinds/CertificationDeclaration.ts +100 -46
  482. package/src/certificate/kinds/DistinguishedName.ts +677 -0
  483. package/src/certificate/kinds/Icac.ts +7 -12
  484. package/src/certificate/kinds/Noc.ts +12 -8
  485. package/src/certificate/kinds/OperationalBase.ts +5 -2
  486. package/src/certificate/kinds/Rcac.ts +7 -12
  487. package/src/certificate/kinds/Vvsc.ts +24 -15
  488. package/src/certificate/kinds/definitions/asn.ts +1 -1
  489. package/src/certificate/kinds/definitions/attestation.ts +15 -15
  490. package/src/certificate/kinds/definitions/base.ts +43 -1
  491. package/src/certificate/kinds/definitions/operational.ts +4 -3
  492. package/src/codec/MessageCodec.ts +92 -81
  493. package/src/dcl/DclCertificateService.ts +135 -36
  494. package/src/fabric/Fabric.ts +13 -6
  495. package/src/fabric/FabricManager.ts +2 -2
  496. package/src/groups/FabricGroups.ts +5 -0
  497. package/src/groups/Groups.ts +12 -3
  498. package/src/groups/KeySets.ts +3 -3
  499. package/src/mdns/InterfaceResponder.ts +1031 -0
  500. package/src/mdns/MdnsServer.ts +400 -360
  501. package/src/peer/CommissioningConnection.ts +5 -1
  502. package/src/peer/ControllerCommissioner.ts +57 -19
  503. package/src/peer/ControllerCommissioningFlow.ts +132 -56
  504. package/src/peer/Peer.ts +31 -16
  505. package/src/peer/PeerAddressStore.ts +119 -0
  506. package/src/peer/PeerConnection.ts +0 -1
  507. package/src/peer/PeerDescriptor.ts +3 -4
  508. package/src/peer/PeerExchangeProvider.ts +4 -6
  509. package/src/peer/PeerLossContext.ts +11 -2
  510. package/src/peer/PhysicalDeviceProperties.ts +25 -12
  511. package/src/peer/RebootResubscribeArmer.ts +37 -16
  512. package/src/peer/index.ts +1 -0
  513. package/src/protocol/DeviceAdvertiser.ts +5 -1
  514. package/src/protocol/ExchangeManager.ts +162 -88
  515. package/src/protocol/ExchangeProvider.ts +3 -2
  516. package/src/protocol/MessageExchange.ts +22 -6
  517. package/src/protocol/MessageReceptionState.ts +2 -2
  518. package/src/protocol/errors.ts +7 -1
  519. package/src/securechannel/SecureChannelMessenger.ts +26 -13
  520. package/src/session/GroupSession.ts +147 -111
  521. package/src/session/NodeSession.ts +89 -4
  522. package/src/session/SecureSession.ts +27 -1
  523. package/src/session/Session.ts +2 -2
  524. package/src/session/SessionManager.ts +429 -189
  525. package/src/session/UnsecuredSession.ts +9 -3
  526. package/src/session/case/CaseClient.ts +15 -10
  527. package/src/session/case/CaseServer.ts +41 -17
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import { BleError } from "#ble/Ble.js";
7
8
  import { CommissionableDevice } from "#common/Scanner.js";
8
9
  import { CommissioningError, PairRetransmissionLimitReachedError } from "#peer/CommissioningError.js";
9
10
  import { NodeSession } from "#session/NodeSession.js";
@@ -175,7 +176,9 @@ export async function CommissioningConnection(
175
176
  asErr.message,
176
177
  );
177
178
  lastNonRetryableError = asErr;
178
- } else if (causedBy(asErr, NoResponseTimeoutError, TransientPeerCommunicationError, NetworkError)) {
179
+ } else if (
180
+ causedBy(asErr, NoResponseTimeoutError, TransientPeerCommunicationError, NetworkError, BleError)
181
+ ) {
179
182
  lastError = asErr;
180
183
  logger.warn(
181
184
  `Address ${ServerAddress.urlFor(candidate.address)} unreachable for ${candidate.device.deviceIdentifier}`,
@@ -234,6 +237,7 @@ export async function CommissioningConnection(
234
237
  if (lastError !== undefined) {
235
238
  throw new PairRetransmissionLimitReachedError(
236
239
  `Failed to connect on any discovered server: ${lastError.message}`,
240
+ { cause: lastError },
237
241
  );
238
242
  }
239
243
  throw new PairRetransmissionLimitReachedError("Failed to connect on any discovered server");
@@ -22,6 +22,7 @@ import { DedicatedChannelExchangeProvider } from "#protocol/ExchangeProvider.js"
22
22
  import { ChannelStatusResponseError } from "#securechannel/SecureChannelMessenger.js";
23
23
  import { NodeSession } from "#session/NodeSession.js";
24
24
  import { PaseClient } from "#session/pase/PaseClient.js";
25
+ import { Session } from "#session/Session.js";
25
26
  import { SessionManager } from "#session/SessionManager.js";
26
27
  import { SessionParameters } from "#session/SessionParameters.js";
27
28
  import {
@@ -403,7 +404,7 @@ export class ControllerCommissioner {
403
404
  options.retryFailureAsPeerCommunication !== undefined &&
404
405
  causedBy(error, PairRetransmissionLimitReachedError)
405
406
  ) {
406
- throw new PeerCommunicationError(options.retryFailureAsPeerCommunication);
407
+ throw new PeerCommunicationError(options.retryFailureAsPeerCommunication, { cause: error });
407
408
  }
408
409
  throw error;
409
410
  }
@@ -466,16 +467,23 @@ export class ControllerCommissioner {
466
467
  SECURE_CHANNEL_PROTOCOL_ID,
467
468
  );
468
469
 
470
+ const unsecuredBleClose =
471
+ paseChannel instanceof BleChannel ? this.#closeOnBleLoss(unsecuredSession, paseChannel) : undefined;
472
+
473
+ let paseSession: NodeSession;
474
+ let paseBleClose: (() => Promise<void> | undefined) | undefined;
469
475
  try {
470
- const caseSession = await this.#paseClient.pair(
476
+ paseSession = await this.#paseClient.pair(
471
477
  this.#context.sessions.sessionParameters,
472
478
  paseExchange,
473
479
  paseChannel,
474
480
  passcode,
475
481
  { abort: signal, suppressPeerLoss, onPbkdfParamResponse },
476
482
  );
483
+ if (paseChannel instanceof BleChannel) {
484
+ paseBleClose = this.#closeOnBleLoss(paseSession, paseChannel);
485
+ }
477
486
  await unsecuredSession.detachChannel()?.release();
478
- return caseSession;
479
487
  } catch (e) {
480
488
  // Close the exchange and rethrow
481
489
  if (causedBy(e, ChannelStatusResponseError)) {
@@ -485,10 +493,56 @@ export class ControllerCommissioner {
485
493
  }
486
494
  throw e;
487
495
  } finally {
496
+ await unsecuredBleClose?.();
488
497
  await unsecuredSession.initiateForceClose({
489
498
  cause: new CommissioningTransitionError("PASE session has transitioned to CASE"),
490
499
  });
491
500
  }
501
+
502
+ // Keep after the last await: a session the BLE watch closed must not win the candidate race
503
+ const bleClosing = paseBleClose?.();
504
+ if (bleClosing !== undefined) {
505
+ await bleClosing;
506
+ throw new BleChannelClosedError(`BLE transport closed while PASE completed on ${paseSession.via}`);
507
+ }
508
+ return paseSession;
509
+ }
510
+
511
+ /**
512
+ * Force-closes `session` with a {@link BleChannelClosedError} once `channel` closes, so its pending exchanges reject
513
+ * at once instead of waiting out PASE response or MRP timeouts. A channel that already closed closes the session
514
+ * immediately. The watch ends when the session starts closing.
515
+ *
516
+ * {@link ControllerCommissioningFlow} treats the resulting `BleDisconnectedError` as a commissioning-channel
517
+ * drop, so a non-concurrent device that leaves BLE after ConnectNetwork continues over its operational network.
518
+ *
519
+ * @returns a function returning the force-close a channel loss started, or `undefined`; that promise never rejects
520
+ */
521
+ #closeOnBleLoss(session: Session, channel: BleChannel) {
522
+ let forceClose: Promise<void> | undefined;
523
+ const stopWatching = () => {
524
+ channel.closed.off(onChannelClosed);
525
+ session.closing.off(onSessionClosing);
526
+ };
527
+ const onSessionClosing = (closing: boolean) => {
528
+ if (closing) {
529
+ stopWatching();
530
+ }
531
+ };
532
+ const onChannelClosed = () => {
533
+ stopWatching();
534
+ forceClose = session
535
+ .initiateForceClose({ cause: new BleChannelClosedError(`BLE transport closed on ${session.via}`) })
536
+ .catch(error => logger.warn(session.via, "Error while force-closing PASE session on BLE close", error));
537
+ };
538
+
539
+ if (channel.isClosed) {
540
+ onChannelClosed();
541
+ } else {
542
+ channel.closed.on(onChannelClosed);
543
+ session.closing.on(onSessionClosing);
544
+ }
545
+ return () => forceClose;
492
546
  }
493
547
 
494
548
  /** Validate if a Peer Address is already known and commissioned */
@@ -634,22 +688,6 @@ export class ControllerCommissioner {
634
688
  logger.info(`Start commissioning of node ${address.toString()} into fabric ${fabric.fabricId}`);
635
689
  const exchangeProvider = new DedicatedChannelExchangeProvider(this.#context.exchanges, ephemeralSession);
636
690
 
637
- // BLE-only: BTP MRP retrans blocks pending invokes for ~45s when a non-concurrent device
638
- // drops BLE after connectNetwork. Force-close on BLE-lost so the awaited invoke rejects
639
- // immediately and the commissioning flow can flip to the non-concurrent CASE path.
640
- if (!ephemeralSession.isClosed) {
641
- const paseChannel = ephemeralSession.channel.transportChannel;
642
- if (paseChannel instanceof BleChannel) {
643
- paseChannel.closed.once(() => {
644
- ephemeralSession
645
- .initiateForceClose({
646
- cause: new BleChannelClosedError(`BLE transport closed on ${ephemeralSession.via}`),
647
- })
648
- .catch(error => logger.warn("Error while force-closing PASE session on BLE close", error));
649
- });
650
- }
651
- }
652
-
653
691
  await using commissioner = new commissioningFlowImpl(
654
692
  new ClientInteraction({
655
693
  environment: this.#context.environment,
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { ClientInteraction } from "#action/client/ClientInteraction.js";
8
8
  import { ClientRead } from "#action/client/ClientRead.js";
9
+ import { ClientRequest } from "#action/client/ClientRequest.js";
9
10
  import { WriteResult } from "#action/index.js";
10
11
  import { Invoke } from "#action/request/Invoke.js";
11
12
  import { Read } from "#action/request/Read.js";
@@ -139,13 +140,13 @@ export type ControllerCommissioningFlowOptions = {
139
140
  * - throw any error to reject by rethrowing that error verbatim (no wrapping)
140
141
  * - `undefined`: accept with warning logging (backward compatibility)
141
142
  *
142
- * The callback receives either:
143
- * - A single error-level finding for hard failures (invalid chain, bad signature, revoked
144
- * certificate, untrusted PAA, DCL service unavailable). The commissioner must decide
145
- * whether to proceed despite the failure.
146
- * - One or more warning/info-level findings after successful validation (e.g. provisional
147
- * CD, test CD, skipped CD signer verification, no revocation data, test-cert-only PAA).
148
- * These are informational and the commissioner can inspect them for detailed decisions.
143
+ * The callback receives the findings collected during validation: warning/info-level findings
144
+ * (e.g. provisional CD, test CD, no revocation data) and the recoverable error-level findings
145
+ * `TrustedAsTestCertificate` and `CertificationDeclarationFieldMismatch` for the BasicInformation
146
+ * VendorID and ProductID, which the commissioner must decide on like a hard failure. When a hard
147
+ * failure (invalid chain, bad signature, revoked certificate, untrusted PAA, DCL service
148
+ * unavailable) stops validation, its error-level finding comes last, after the findings collected
149
+ * until then.
149
150
  *
150
151
  * TODO: Make required in next breaking version and remove undefined backward-compatible accept
151
152
  */
@@ -329,6 +330,7 @@ export class ControllerCommissioningFlow {
329
330
  protected collectedCommissioningData: CollectedCommissioningData = {};
330
331
  #defaultFailSafeTime = DEFAULT_FAILSAFE_TIME;
331
332
  #armFailsafeInterval?: Timer;
333
+ #periodicArm?: Promise<unknown>;
332
334
 
333
335
  constructor(
334
336
  /** ClientInteraction for the initiated PASE session */
@@ -354,7 +356,7 @@ export class ControllerCommissioningFlow {
354
356
  this.fabric = fabric;
355
357
  this.transitionToCase = transitionToCase;
356
358
  this.commissioningOptions = commissioningOptions;
357
- logger.debug(`Commissioning options: ${Diagnostic.json(commissioningOptions)}`);
359
+ logger.debug("Commissioning options", Diagnostic.dict(loggedOptionsOf(commissioningOptions)));
358
360
  this.#initializeCommissioningSteps();
359
361
  }
360
362
 
@@ -434,35 +436,25 @@ export class ControllerCommissioningFlow {
434
436
  Diagnostic.errorMessage(error),
435
437
  Diagnostic.weak("(continuing commissioning)"),
436
438
  );
437
- } else if (causedBy(error, CommissioningError, StatusResponseError)) {
438
- logger.error(
439
+ continue;
440
+ }
441
+
442
+ const isCommissioningFailure = causedBy(error, CommissioningError, StatusResponseError);
443
+ if (isCommissioningFailure) {
444
+ logger.warn(
439
445
  `Commissioning step ${step.stepNumber}.${step.subStepNumber}: ${step.name} failed with error:`,
440
446
  Diagnostic.errorMessage(error),
441
447
  Diagnostic.weak("(terminating commissioning)"),
442
448
  );
443
- // TODO In concurrent connection commissioning flow, the failure of any of the steps 2 through 10
444
- // SHALL result in the Commissioner and Commissionee returning to step 2 (device discovery and
445
- // commissioning channel establishment) and repeating each step. The failure of any of the steps
446
- // 11 through 15 in concurrent connection commissioning flow SHALL result in the Commissioner and
447
- // Commissionee returning to step 11 (configuration of operational network information). In the
448
- // case of failure of any of the steps 11 through 15 in concurrent connection commissioning flow,
449
- // the Commissioner and Commissionee SHALL reuse the existing PASE-derived encryption keys over
450
- // the commissioning channel and all steps up to and including step 10 are considered to have
451
- // been successfully completed.
452
-
453
- // Commissioners that need to restart from step 2 MAY immediately expire the fail-safe by invoking
454
- // the ArmFailSafe command with an ExpiryLengthSeconds field set to 0. Otherwise, Commissioners
455
- // will need to wait until the current fail-safe timer has expired for the Commissionee to begin
456
- // accepting PASE again.
457
- await this.#resetFailsafeTimer();
449
+ }
458
450
 
459
- StatusResponseError.accept(error);
451
+ await this.#expireFailsafe(error);
460
452
 
461
- // Convert error
453
+ if (isCommissioningFailure) {
454
+ StatusResponseError.accept(error);
462
455
  throw repackErrorAs(error, CommissioningError);
463
- } else {
464
- throw error;
465
456
  }
457
+ throw error;
466
458
  }
467
459
  }
468
460
  }
@@ -485,6 +477,10 @@ export class ControllerCommissioningFlow {
485
477
  }
486
478
  for await (const data of this.interaction.read(request)) {
487
479
  for await (const entry of data) {
480
+ if (entry.kind === "attr-status") {
481
+ logger.debug("Commissioning read returned status", entry.status, "for", entry.path);
482
+ continue;
483
+ }
488
484
  if (entry.kind !== "attr-value") {
489
485
  continue;
490
486
  }
@@ -506,13 +502,15 @@ export class ControllerCommissioningFlow {
506
502
  async #invokeCommand<const C extends ClusterType.Concrete>(
507
503
  request: Invoke.ConcreteCommandRequest<C>,
508
504
  options: Omit<Invoke.Definition, "commands"> = {},
505
+ transmission?: ClientRequest,
509
506
  ) {
510
- for await (const data of this.interaction.invoke(
511
- Invoke({
507
+ for await (const data of this.interaction.invoke({
508
+ ...Invoke({
512
509
  commands: [request],
513
510
  ...options,
514
511
  }),
515
- )) {
512
+ ...transmission,
513
+ })) {
516
514
  for (const entry of data) {
517
515
  // We send only one command, so we only get one response back
518
516
  switch (entry.kind) {
@@ -795,6 +793,10 @@ export class ControllerCommissioningFlow {
795
793
 
796
794
  for await (const data of networkData) {
797
795
  for await (const entry of data) {
796
+ if (entry.kind === "attr-status") {
797
+ logger.debug("Commissioning read returned status", entry.status, "for", entry.path);
798
+ continue;
799
+ }
798
800
  if (entry.kind !== "attr-value") {
799
801
  continue;
800
802
  }
@@ -937,13 +939,13 @@ export class ControllerCommissioningFlow {
937
939
  logger.debug(
938
940
  `Re-Arm Failsafe Timer during longer actions with device. Time left: ${Duration.format(Timespan(now, this.#commissioningExpiryTime).duration)}`,
939
941
  );
940
- this.#armFailsafe(Duration.max(this.#defaultFailSafeTime, this.#failSafeTimeLeft)).catch(
941
- error => {
942
- logger.warn("Error while re-arming failsafe during reconnect", error);
943
- this.#armFailsafeInterval?.stop();
944
- this.#armFailsafeInterval = undefined;
945
- },
946
- );
942
+ this.#periodicArm = this.#armFailsafe(
943
+ Duration.max(this.#defaultFailSafeTime, this.#failSafeTimeLeft),
944
+ ).catch(error => {
945
+ logger.warn("Error while re-arming failsafe during reconnect", error);
946
+ this.#armFailsafeInterval?.stop();
947
+ this.#armFailsafeInterval = undefined;
948
+ });
947
949
  } else {
948
950
  // Stop as soon as we are over the maximum commissioning time
949
951
  this.#armFailsafeInterval?.stop();
@@ -1011,6 +1013,15 @@ export class ControllerCommissioningFlow {
1011
1013
  );
1012
1014
  }
1013
1015
 
1016
+ /**
1017
+ * Whether {@link failure} reports that the device stopped answering on the channel commissioning runs on, so a
1018
+ * further command would only wait for its own timeout. A failed operational reconnect does not count: it reports
1019
+ * that CASE could not be established, while the commissioning channel may still work.
1020
+ */
1021
+ #deviceStoppedResponding(failure: Error) {
1022
+ return !(failure instanceof OperativeConnectionFailedError) && this.#isCommissioningChannelDrop(failure);
1023
+ }
1024
+
1014
1025
  /**
1015
1026
  * Respond to a commissioning-channel drop by treating the device as non-concurrent: stop the
1016
1027
  * periodic failsafe re-arm timer (BLE is gone anyway) and flip the flag so `#reconnectWithDevice`
@@ -1089,21 +1100,54 @@ export class ControllerCommissioningFlow {
1089
1100
  return { transportFailure: false, networkingStatus, debugText };
1090
1101
  }
1091
1102
 
1092
- async #resetFailsafeTimer() {
1103
+ /**
1104
+ * End the device's fail-safe after commissioning failed, so the device accepts a new PASE session right away.
1105
+ * Commissioning does not resume after a failure, so it always restarts from initial phase step 2, and the spec
1106
+ * allows this: "Commissioners that need to restart from initial phase step 2 MAY immediately expire the fail-safe
1107
+ * by invoking the ArmFailSafe command with an ExpiryLengthSeconds field set to 0."
1108
+ *
1109
+ * Stops the periodic re-arm, so it cannot arm the fail-safe again. Sends nothing when the device stopped
1110
+ * responding (see {@link #deviceStoppedResponding}). Otherwise it waits for a re-arm already sent, then sends over
1111
+ * the PASE session, or after the operational reconnect only over a session that exists now, so a device that
1112
+ * dropped the session is not reconnected only to end its fail-safe. A failure only logs: the device ends the
1113
+ * fail-safe itself when it expires.
1114
+ *
1115
+ * @see {@link MatterSpecification.v161.Core} § 5.5.1
1116
+ */
1117
+ async #expireFailsafe(failure: Error) {
1118
+ this.#armFailsafeInterval?.stop();
1119
+ this.#armFailsafeInterval = undefined;
1120
+
1093
1121
  if (this.#currentFailSafeEndTime === undefined) return;
1122
+ if (this.#deviceStoppedResponding(failure)) {
1123
+ logger.debug("Device stopped responding, leaving the failsafe to expire");
1124
+ return;
1125
+ }
1126
+
1127
+ await this.#periodicArm;
1094
1128
  try {
1095
- await this.#invokeCommand({
1096
- endpoint: RootEndpointNumber,
1097
- cluster: GeneralCommissioning,
1098
- command: "armFailSafe",
1099
- fields: {
1100
- breadcrumb: this.lastBreadcrumb,
1101
- expiryLengthSeconds: 0,
1102
- },
1103
- });
1104
- this.#currentFailSafeEndTime = undefined; // No failsafe active anymore
1129
+ this.#ensureGeneralCommissioningSuccess(
1130
+ "armFailSafe",
1131
+ await this.#invokeCommand(
1132
+ {
1133
+ endpoint: RootEndpointNumber,
1134
+ cluster: GeneralCommissioning,
1135
+ command: "armFailSafe",
1136
+ fields: {
1137
+ breadcrumb: this.lastBreadcrumb,
1138
+ expiryLengthSeconds: 0,
1139
+ },
1140
+ },
1141
+ {},
1142
+ { requireExistingSession: true },
1143
+ ),
1144
+ );
1145
+ this.#currentFailSafeEndTime = undefined;
1105
1146
  } catch (error) {
1106
- logger.error(`Error while resetting failsafe timer`, error);
1147
+ logger.info(
1148
+ "Could not end the failsafe, the device stays in commissioning until its failsafe expires:",
1149
+ Diagnostic.errorMessage(asError(error)),
1150
+ );
1107
1151
  }
1108
1152
  }
1109
1153
 
@@ -1292,8 +1336,8 @@ export class ControllerCommissioningFlow {
1292
1336
  attestationElements,
1293
1337
  attestationSignature,
1294
1338
  attestationNonce,
1295
- vendorId: this.collectedCommissioningData.vendorId!,
1296
- productId: this.collectedCommissioningData.productId!,
1339
+ vendorId: this.collectedCommissioningData.vendorId,
1340
+ productId: this.collectedCommissioningData.productId,
1297
1341
  },
1298
1342
  );
1299
1343
  findings = result.findings;
@@ -1306,7 +1350,10 @@ export class ControllerCommissioningFlow {
1306
1350
  }
1307
1351
  baseError = asError(error);
1308
1352
  if (error instanceof DeviceAttestationError) {
1309
- findings = [{ level: "error", type: error.failure, message: error.message }];
1353
+ findings = [
1354
+ ...error.precedingFindings,
1355
+ { level: "error", type: error.failure, message: error.message },
1356
+ ];
1310
1357
  } else {
1311
1358
  // Unexpected validation error (e.g. an unrecoverably corrupt trust-store certificate).
1312
1359
  // Surface it as an error finding so the onFailure policy can still judge it, instead of
@@ -1320,8 +1367,11 @@ export class ControllerCommissioningFlow {
1320
1367
  if (findings.length > 0) {
1321
1368
  const decision = await this.#resolveAttestationFindings(findings);
1322
1369
  if (!decision.proceed) {
1370
+ const errorMessages = findings.filter(({ level }) => level === "error").map(({ message }) => message);
1323
1371
  baseError ??= new CommissioningError(
1324
- `Device attestation produced ${findings.length} finding(s) and was rejected by policy`,
1372
+ errorMessages.length
1373
+ ? `Device attestation rejected by policy: ${errorMessages.join("; ")}`
1374
+ : `Device attestation produced ${findings.length} finding(s) and was rejected by policy`,
1325
1375
  );
1326
1376
  if (decision.reason !== undefined) {
1327
1377
  throw new CommissioningError(decision.reason, { cause: baseError });
@@ -1336,7 +1386,10 @@ export class ControllerCommissioningFlow {
1336
1386
  if (dacPublicKey === undefined) {
1337
1387
  // Attestation failed but policy accepted it, so the key the validator would have returned is missing
1338
1388
  try {
1339
- dacPublicKey = PublicKey(Dac.fromAsn1(deviceAttestation).cert.ellipticCurvePublicKey);
1389
+ dacPublicKey = PublicKey(
1390
+ Dac.fromAsn1(deviceAttestation, { acceptProfileViolation: true, acceptMalformedVidPid: true }).cert
1391
+ .ellipticCurvePublicKey,
1392
+ );
1340
1393
  } catch (cause) {
1341
1394
  throw new CommissioningError(
1342
1395
  "Device attestation was accepted but the DAC cannot be parsed, so the CSR signature cannot be verified",
@@ -2154,3 +2207,26 @@ export class ControllerCommissioningFlow {
2154
2207
  this.#armFailsafeInterval?.stop();
2155
2208
  }
2156
2209
  }
2210
+
2211
+ /**
2212
+ * The fields of {@link options} that hold no secret, for logging. The options the caller passes may carry more, such as
2213
+ * the fabric with its identity protection key or the passcode.
2214
+ */
2215
+ function loggedOptionsOf(options: ControllerCommissioningFlowOptions) {
2216
+ const {
2217
+ regulatoryLocation,
2218
+ regulatoryCountryCode,
2219
+ adminVendorId,
2220
+ wifiNetwork,
2221
+ threadNetwork,
2222
+ otaUpdateProviderLocation,
2223
+ } = options;
2224
+ return {
2225
+ regulatoryLocation,
2226
+ regulatoryCountryCode,
2227
+ adminVendorId,
2228
+ wifiSsid: wifiNetwork?.wifiSsid,
2229
+ threadNetwork: threadNetwork && (threadNetwork.networkName ?? "(dataset only)"),
2230
+ otaUpdateProviderLocation,
2231
+ };
2232
+ }
package/src/peer/Peer.ts CHANGED
@@ -256,13 +256,18 @@ export class Peer {
256
256
  return this.#descriptor;
257
257
  }
258
258
 
259
+ /**
260
+ * The open sessions with the peer. The set holds established sessions only, as it is filled from
261
+ * `SessionManager.sessions`. So {@link hasSession}, {@link newestSession} and observers of `peer.sessions.added`
262
+ * never see a session whose handshake still runs.
263
+ */
259
264
  get sessions() {
260
265
  return this.#sessions;
261
266
  }
262
267
 
263
268
  get subscriptions() {
264
269
  // TODO - this should just be #subscriptions
265
- return [...this.#sessions].flatMap(session => [...session.subscriptions]);
270
+ return this.#context.sessions.sessionsFor(this.address).flatMap(session => [...session.subscriptions]);
266
271
  }
267
272
 
268
273
  get exchangeProvider() {
@@ -422,21 +427,6 @@ export class Peer {
422
427
 
423
428
  while (true) {
424
429
  const { transports } = this.#transportDecision(options?.requiredTransport, options?.preferredTransport);
425
- /* Debug aid (one line per connect — noisy); uncomment to trace transport selection:
426
- {
427
- const { reason, diag } = this.#transportDecision(options?.requiredTransport, options?.preferredTransport);
428
- logger.debug(
429
- "Transport resolution",
430
- Diagnostic.dict({
431
- peer: this.address.toString(),
432
- result: transports === undefined ? "UDP (no constraint)" : transports.join("+"),
433
- reason,
434
- peerPreference: this.transportPreference ?? "none",
435
- ...diag,
436
- }),
437
- );
438
- }
439
- */
440
430
  let session: NodeSession | undefined;
441
431
  if (transports === undefined) {
442
432
  session = this.newestSession();
@@ -634,6 +624,8 @@ export class Peer {
634
624
  return;
635
625
  }
636
626
 
627
+ this.#logTransportDecision(options);
628
+
637
629
  const abort = new Abort({ abort: this.#abort });
638
630
 
639
631
  // Abort connection if a session is established from any source
@@ -672,6 +664,29 @@ export class Peer {
672
664
  };
673
665
  this.#workers.add(this.#connecting);
674
666
  }
667
+
668
+ /**
669
+ * Log the transport decision once per connection process, so a log shows why TCP or UDP was tried.
670
+ *
671
+ * {@link PeerConnection} resolves the transports again for each address, so a later mDNS update can still change
672
+ * them. The address URL in each "Connecting" line shows the transport actually used.
673
+ */
674
+ #logTransportDecision(options?: Peer.ConnectOptions) {
675
+ const { transports, reason, diag } = this.#transportDecision(
676
+ options?.requiredTransport,
677
+ options?.preferredTransport,
678
+ );
679
+ logger.debug(
680
+ Diagnostic.via(this.address.toString()),
681
+ "Transport decision",
682
+ Diagnostic.dict({
683
+ transports: transports === undefined ? "no constraint" : transports.join("+"),
684
+ reason,
685
+ peerPreference: this.transportPreference ?? "none",
686
+ ...diag,
687
+ }),
688
+ );
689
+ }
675
690
  }
676
691
 
677
692
  export namespace Peer {
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2026 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { Logger, Mutex, StorageContext, SupportedStorageTypes } from "@matter/general";
8
+ import { FabricIndex, NodeId } from "@matter/types";
9
+ import { PeerAddress, PeerAddressMap } from "./PeerAddress.js";
10
+
11
+ const logger = Logger.get("PeerAddressStore");
12
+
13
+ const FABRIC_CONTEXT_PATTERN = /^[1-9]\d*$/;
14
+ const NODE_KEY_PATTERN = /^[0-9a-f]+$/;
15
+
16
+ /**
17
+ * Persistent storage keyed by {@link PeerAddress}: one value per peer, so a change for one peer writes only that peer's
18
+ * key instead of the whole collection.
19
+ *
20
+ * Layout: one sub-context per fabric index (decimal), one key per node ID (lowercase hex). This class owns the format
21
+ * in both directions. It holds no values in memory; callers keep their own view and use {@link load} once at startup.
22
+ *
23
+ * Operations run one after another in call order, so after concurrent calls for one address the stored value is the
24
+ * one passed last.
25
+ */
26
+ export class PeerAddressStore<T extends SupportedStorageTypes> {
27
+ readonly #storage: StorageContext;
28
+ readonly #operations = new Mutex(this);
29
+
30
+ constructor(storage: StorageContext) {
31
+ this.#storage = storage;
32
+ }
33
+
34
+ set(address: PeerAddress, value: T) {
35
+ return this.#operations.produce(async () => this.#set(address, value));
36
+ }
37
+
38
+ delete(address: PeerAddress) {
39
+ return this.#operations.produce(async () => this.#fabricContext(address.fabricIndex).delete(keyOf(address)));
40
+ }
41
+
42
+ deleteFabric(fabricIndex: FabricIndex) {
43
+ return this.#operations.produce(async () => this.#fabricContext(fabricIndex).clearAll());
44
+ }
45
+
46
+ clear() {
47
+ return this.#operations.produce(async () => this.#storage.clearAll());
48
+ }
49
+
50
+ /**
51
+ * Replace all stored values with {@link entries}.
52
+ */
53
+ replaceAll(entries: Iterable<[PeerAddress, T]>) {
54
+ return this.#operations.produce(async () => {
55
+ await this.#storage.clearAll();
56
+ for (const [address, value] of entries) {
57
+ await this.#set(address, value);
58
+ }
59
+ });
60
+ }
61
+
62
+ /**
63
+ * Read all stored values. Entries {@link keep} rejects and entries the driver cannot read are deleted from storage
64
+ * and left out of the result.
65
+ */
66
+ load(keep?: (address: PeerAddress, value: T) => boolean) {
67
+ return this.#operations.produce(async () => {
68
+ const result = new PeerAddressMap<T>();
69
+
70
+ for (const fabricName of await this.#storage.contexts()) {
71
+ if (!FABRIC_CONTEXT_PATTERN.test(fabricName)) {
72
+ logger.info(`Ignoring stored context ${fabricName} in ${this}: not a fabric index`);
73
+ continue;
74
+ }
75
+ const fabricIndex = FabricIndex(Number.parseInt(fabricName, 10));
76
+ const fabricContext = this.#storage.createContext(fabricName);
77
+
78
+ // keys() and has() list a value the driver cannot decode, but values() has no value for it
79
+ const stored = await fabricContext.values();
80
+ for (const key of await fabricContext.keys()) {
81
+ if (!NODE_KEY_PATTERN.test(key)) {
82
+ logger.info(`Ignoring stored key ${key} in ${this}: not a node ID`);
83
+ continue;
84
+ }
85
+ const address = PeerAddress({ fabricIndex, nodeId: NodeId(BigInt(`0x${key}`)) });
86
+ const value = stored[key] as T | undefined;
87
+ if (value === undefined) {
88
+ logger.warn(`Deleting stored value of ${address} in ${this}: not readable`);
89
+ await fabricContext.delete(key);
90
+ continue;
91
+ }
92
+ if (keep !== undefined && !keep(address, value)) {
93
+ await fabricContext.delete(key);
94
+ continue;
95
+ }
96
+ result.set(address, value);
97
+ }
98
+ }
99
+
100
+ return result;
101
+ });
102
+ }
103
+
104
+ toString() {
105
+ return `storage:${this.#storage.thisContexts.join(".")}`;
106
+ }
107
+
108
+ #set(address: PeerAddress, value: T) {
109
+ return this.#fabricContext(address.fabricIndex).set(keyOf(address), value);
110
+ }
111
+
112
+ #fabricContext(fabricIndex: FabricIndex) {
113
+ return this.#storage.createContext(fabricIndex.toString());
114
+ }
115
+ }
116
+
117
+ function keyOf({ nodeId }: PeerAddress) {
118
+ return nodeId.toString(16);
119
+ }
@@ -608,7 +608,6 @@ export async function PeerConnection(
608
608
  const { session } = await caseClient.pair(exchange, fabric, peer.address.nodeId, {
609
609
  ...options,
610
610
  abort: localAbort,
611
- caseAuthenticatedTags: peer.descriptor.caseAuthenticatedTags,
612
611
  ...attempt.sendOptions,
613
612
  validateSessionParameters: isTcp
614
613
  ? params => {