@matter/protocol 0.16.0-alpha.0-20251217-038f88085 → 0.16.0-alpha.0-20251221-21acf226d

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 (472) hide show
  1. package/dist/cjs/action/client/ClientBdx.d.ts +17 -0
  2. package/dist/cjs/action/client/ClientBdx.d.ts.map +1 -0
  3. package/dist/cjs/action/client/ClientBdx.js +22 -0
  4. package/dist/cjs/action/client/ClientBdx.js.map +6 -0
  5. package/dist/cjs/action/client/ClientInteraction.d.ts +10 -1
  6. package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
  7. package/dist/cjs/action/client/ClientInteraction.js +25 -2
  8. package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
  9. package/dist/cjs/action/client/QueuedClientInteraction.d.ts +11 -3
  10. package/dist/cjs/action/client/QueuedClientInteraction.d.ts.map +1 -1
  11. package/dist/cjs/action/client/QueuedClientInteraction.js +6 -2
  12. package/dist/cjs/action/client/QueuedClientInteraction.js.map +1 -1
  13. package/dist/cjs/action/client/index.d.ts +1 -0
  14. package/dist/cjs/action/client/index.d.ts.map +1 -1
  15. package/dist/cjs/action/client/index.js +1 -0
  16. package/dist/cjs/action/client/index.js.map +1 -1
  17. package/dist/cjs/action/request/Read.d.ts.map +1 -1
  18. package/dist/cjs/action/request/Read.js +2 -2
  19. package/dist/cjs/action/request/Read.js.map +1 -1
  20. package/dist/cjs/action/request/Write.js +4 -3
  21. package/dist/cjs/action/request/Write.js.map +1 -1
  22. package/dist/cjs/advertisement/ble/BleAdvertisement.d.ts +1 -1
  23. package/dist/cjs/advertisement/ble/BleAdvertisement.d.ts.map +1 -1
  24. package/dist/cjs/advertisement/ble/BleAdvertisement.js +2 -2
  25. package/dist/cjs/advertisement/ble/BleAdvertisement.js.map +1 -1
  26. package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.d.ts +1 -1
  27. package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.js +1 -1
  28. package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.js.map +1 -1
  29. package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.d.ts.map +1 -1
  30. package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.js +3 -5
  31. package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.js.map +1 -1
  32. package/dist/cjs/bdx/BdxClient.d.ts +2 -0
  33. package/dist/cjs/bdx/BdxClient.d.ts.map +1 -1
  34. package/dist/cjs/bdx/BdxClient.js +6 -0
  35. package/dist/cjs/bdx/BdxClient.js.map +1 -1
  36. package/dist/cjs/bdx/BdxError.d.ts +2 -0
  37. package/dist/cjs/bdx/BdxError.d.ts.map +1 -1
  38. package/dist/cjs/bdx/BdxError.js +2 -0
  39. package/dist/cjs/bdx/BdxError.js.map +1 -1
  40. package/dist/cjs/bdx/BdxMessenger.d.ts +5 -1
  41. package/dist/cjs/bdx/BdxMessenger.d.ts.map +1 -1
  42. package/dist/cjs/bdx/BdxMessenger.js +12 -4
  43. package/dist/cjs/bdx/BdxMessenger.js.map +1 -1
  44. package/dist/cjs/bdx/BdxProtocol.d.ts +14 -7
  45. package/dist/cjs/bdx/BdxProtocol.d.ts.map +1 -1
  46. package/dist/cjs/bdx/BdxProtocol.js +81 -19
  47. package/dist/cjs/bdx/BdxProtocol.js.map +1 -1
  48. package/dist/cjs/bdx/BdxSession.d.ts +10 -3
  49. package/dist/cjs/bdx/BdxSession.d.ts.map +1 -1
  50. package/dist/cjs/bdx/BdxSession.js +33 -8
  51. package/dist/cjs/bdx/BdxSession.js.map +1 -1
  52. package/dist/cjs/bdx/BdxSessionConfiguration.d.ts +16 -1
  53. package/dist/cjs/bdx/BdxSessionConfiguration.d.ts.map +1 -1
  54. package/dist/cjs/bdx/BdxSessionConfiguration.js +6 -1
  55. package/dist/cjs/bdx/BdxSessionConfiguration.js.map +1 -1
  56. package/dist/cjs/bdx/FileDesignator.d.ts +15 -1
  57. package/dist/cjs/bdx/FileDesignator.d.ts.map +1 -1
  58. package/dist/cjs/bdx/FileDesignator.js +28 -2
  59. package/dist/cjs/bdx/FileDesignator.js.map +1 -1
  60. package/dist/cjs/bdx/PersistedFileDesignator.d.ts +10 -2
  61. package/dist/cjs/bdx/PersistedFileDesignator.d.ts.map +1 -1
  62. package/dist/cjs/bdx/PersistedFileDesignator.js +23 -5
  63. package/dist/cjs/bdx/PersistedFileDesignator.js.map +1 -1
  64. package/dist/cjs/bdx/ScopedStorage.d.ts +18 -0
  65. package/dist/cjs/bdx/ScopedStorage.d.ts.map +1 -0
  66. package/dist/cjs/bdx/ScopedStorage.js +36 -0
  67. package/dist/cjs/bdx/ScopedStorage.js.map +6 -0
  68. package/dist/cjs/bdx/bdx-session-initiator.d.ts.map +1 -1
  69. package/dist/cjs/bdx/bdx-session-initiator.js +10 -2
  70. package/dist/cjs/bdx/bdx-session-initiator.js.map +1 -1
  71. package/dist/cjs/bdx/flow/DrivenSendingFlow.d.ts.map +1 -1
  72. package/dist/cjs/bdx/flow/DrivenSendingFlow.js +2 -0
  73. package/dist/cjs/bdx/flow/DrivenSendingFlow.js.map +1 -1
  74. package/dist/cjs/bdx/flow/DrivingReceivingFlow.d.ts.map +1 -1
  75. package/dist/cjs/bdx/flow/DrivingReceivingFlow.js +1 -0
  76. package/dist/cjs/bdx/flow/DrivingReceivingFlow.js.map +1 -1
  77. package/dist/cjs/bdx/flow/Flow.d.ts +7 -0
  78. package/dist/cjs/bdx/flow/Flow.d.ts.map +1 -1
  79. package/dist/cjs/bdx/flow/Flow.js +22 -1
  80. package/dist/cjs/bdx/flow/Flow.js.map +1 -1
  81. package/dist/cjs/bdx/flow/FollowingReceivingFlow.d.ts.map +1 -1
  82. package/dist/cjs/bdx/flow/FollowingReceivingFlow.js +3 -0
  83. package/dist/cjs/bdx/flow/FollowingReceivingFlow.js.map +1 -1
  84. package/dist/cjs/bdx/flow/FollowingSendingFlow.d.ts.map +1 -1
  85. package/dist/cjs/bdx/flow/FollowingSendingFlow.js +1 -0
  86. package/dist/cjs/bdx/flow/FollowingSendingFlow.js.map +1 -1
  87. package/dist/cjs/bdx/flow/OutboundFlow.d.ts.map +1 -1
  88. package/dist/cjs/bdx/flow/OutboundFlow.js +1 -0
  89. package/dist/cjs/bdx/flow/OutboundFlow.js.map +1 -1
  90. package/dist/cjs/bdx/index.d.ts +1 -0
  91. package/dist/cjs/bdx/index.d.ts.map +1 -1
  92. package/dist/cjs/bdx/index.js +1 -0
  93. package/dist/cjs/bdx/index.js.map +1 -1
  94. package/dist/cjs/certificate/kinds/Icac.d.ts.map +1 -1
  95. package/dist/cjs/certificate/kinds/Icac.js +1 -7
  96. package/dist/cjs/certificate/kinds/Icac.js.map +1 -1
  97. package/dist/cjs/certificate/kinds/Rcac.d.ts +1 -0
  98. package/dist/cjs/certificate/kinds/Rcac.d.ts.map +1 -1
  99. package/dist/cjs/certificate/kinds/Rcac.js +3 -0
  100. package/dist/cjs/certificate/kinds/Rcac.js.map +1 -1
  101. package/dist/cjs/certificate/kinds/definitions/operational.d.ts +1 -1
  102. package/dist/cjs/certificate/kinds/definitions/operational.js +1 -1
  103. package/dist/cjs/certificate/kinds/definitions/operational.js.map +1 -1
  104. package/dist/cjs/common/FailsafeContext.js +2 -2
  105. package/dist/cjs/common/FailsafeContext.js.map +1 -1
  106. package/dist/cjs/dcl/DclClient.d.ts.map +1 -1
  107. package/dist/cjs/dcl/DclClient.js +1 -2
  108. package/dist/cjs/dcl/DclClient.js.map +1 -1
  109. package/dist/cjs/dcl/DclOtaUpdateService.d.ts +30 -31
  110. package/dist/cjs/dcl/DclOtaUpdateService.d.ts.map +1 -1
  111. package/dist/cjs/dcl/DclOtaUpdateService.js +191 -92
  112. package/dist/cjs/dcl/DclOtaUpdateService.js.map +2 -2
  113. package/dist/cjs/dcl/index.d.ts +0 -3
  114. package/dist/cjs/dcl/index.d.ts.map +1 -1
  115. package/dist/cjs/dcl/index.js +0 -3
  116. package/dist/cjs/dcl/index.js.map +1 -1
  117. package/dist/cjs/fabric/Fabric.d.ts +53 -9
  118. package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
  119. package/dist/cjs/fabric/Fabric.js +59 -32
  120. package/dist/cjs/fabric/Fabric.js.map +1 -1
  121. package/dist/cjs/fabric/FabricAuthority.js +1 -1
  122. package/dist/cjs/fabric/FabricAuthority.js.map +1 -1
  123. package/dist/cjs/fabric/FabricManager.d.ts +14 -5
  124. package/dist/cjs/fabric/FabricManager.d.ts.map +1 -1
  125. package/dist/cjs/fabric/FabricManager.js +63 -42
  126. package/dist/cjs/fabric/FabricManager.js.map +1 -1
  127. package/dist/cjs/groups/FabricGroups.d.ts.map +1 -1
  128. package/dist/cjs/groups/FabricGroups.js +4 -8
  129. package/dist/cjs/groups/FabricGroups.js.map +1 -1
  130. package/dist/cjs/index.d.ts +1 -0
  131. package/dist/cjs/index.d.ts.map +1 -1
  132. package/dist/cjs/index.js +1 -0
  133. package/dist/cjs/index.js.map +1 -1
  134. package/dist/cjs/interaction/InteractionMessenger.d.ts +1 -106
  135. package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
  136. package/dist/cjs/interaction/InteractionMessenger.js +2 -143
  137. package/dist/cjs/interaction/InteractionMessenger.js.map +2 -2
  138. package/dist/cjs/interaction/index.d.ts +0 -1
  139. package/dist/cjs/interaction/index.d.ts.map +1 -1
  140. package/dist/cjs/interaction/index.js +0 -1
  141. package/dist/cjs/interaction/index.js.map +1 -1
  142. package/dist/cjs/mdns/MdnsClient.d.ts +4 -4
  143. package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -1
  144. package/dist/cjs/mdns/MdnsClient.js +12 -15
  145. package/dist/cjs/mdns/MdnsClient.js.map +1 -1
  146. package/dist/cjs/mdns/MdnsConsts.d.ts +3 -3
  147. package/dist/cjs/mdns/MdnsConsts.d.ts.map +1 -1
  148. package/dist/cjs/mdns/MdnsConsts.js +3 -2
  149. package/dist/cjs/mdns/MdnsConsts.js.map +1 -1
  150. package/dist/{esm/dcl → cjs/ota}/OtaImageHeader.d.ts.map +1 -1
  151. package/dist/cjs/{dcl → ota}/OtaImageHeader.js.map +1 -1
  152. package/dist/cjs/{dcl → ota}/OtaImageReader.d.ts.map +1 -1
  153. package/dist/cjs/{dcl → ota}/OtaImageReader.js +0 -2
  154. package/dist/cjs/ota/OtaImageReader.js.map +6 -0
  155. package/dist/{esm/dcl → cjs/ota}/OtaImageWriter.d.ts +1 -1
  156. package/dist/cjs/{dcl → ota}/OtaImageWriter.d.ts.map +1 -1
  157. package/dist/cjs/{dcl → ota}/OtaImageWriter.js.map +1 -1
  158. package/dist/cjs/ota/index.d.ts +9 -0
  159. package/dist/cjs/ota/index.d.ts.map +1 -0
  160. package/dist/cjs/ota/index.js +26 -0
  161. package/dist/cjs/ota/index.js.map +6 -0
  162. package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
  163. package/dist/cjs/peer/ControllerCommissioner.js +5 -0
  164. package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
  165. package/dist/cjs/peer/ControllerCommissioningFlow.d.ts +11 -3
  166. package/dist/cjs/peer/ControllerCommissioningFlow.d.ts.map +1 -1
  167. package/dist/cjs/peer/ControllerCommissioningFlow.js +119 -40
  168. package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
  169. package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
  170. package/dist/cjs/peer/PeerSet.js +17 -10
  171. package/dist/cjs/peer/PeerSet.js.map +1 -1
  172. package/dist/cjs/protocol/DeviceAdvertiser.js +3 -3
  173. package/dist/cjs/protocol/DeviceAdvertiser.js.map +1 -1
  174. package/dist/cjs/protocol/ExchangeProvider.d.ts +2 -2
  175. package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
  176. package/dist/cjs/protocol/ExchangeProvider.js +2 -2
  177. package/dist/cjs/protocol/ExchangeProvider.js.map +1 -1
  178. package/dist/cjs/protocol/MessageExchange.js +3 -3
  179. package/dist/cjs/protocol/MessageExchange.js.map +1 -1
  180. package/dist/cjs/protocol/ProtocolMocks.d.ts +2 -2
  181. package/dist/cjs/protocol/ProtocolMocks.d.ts.map +1 -1
  182. package/dist/cjs/protocol/ProtocolMocks.js +1 -1
  183. package/dist/cjs/protocol/ProtocolMocks.js.map +1 -1
  184. package/dist/cjs/session/NodeSession.d.ts.map +1 -1
  185. package/dist/cjs/session/NodeSession.js +2 -2
  186. package/dist/cjs/session/NodeSession.js.map +1 -1
  187. package/dist/cjs/session/Session.d.ts.map +1 -1
  188. package/dist/cjs/session/Session.js +1 -0
  189. package/dist/cjs/session/Session.js.map +1 -1
  190. package/dist/cjs/session/SessionManager.js +2 -2
  191. package/dist/cjs/session/SessionManager.js.map +1 -1
  192. package/dist/cjs/session/SessionParameters.d.ts.map +1 -1
  193. package/dist/cjs/session/SessionParameters.js +7 -1
  194. package/dist/cjs/session/SessionParameters.js.map +1 -1
  195. package/dist/cjs/session/pase/PaseServer.d.ts.map +1 -1
  196. package/dist/cjs/session/pase/PaseServer.js +1 -0
  197. package/dist/cjs/session/pase/PaseServer.js.map +1 -1
  198. package/dist/esm/action/client/ClientBdx.d.ts +17 -0
  199. package/dist/esm/action/client/ClientBdx.d.ts.map +1 -0
  200. package/dist/esm/action/client/ClientBdx.js +6 -0
  201. package/dist/esm/action/client/ClientBdx.js.map +6 -0
  202. package/dist/esm/action/client/ClientInteraction.d.ts +10 -1
  203. package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
  204. package/dist/esm/action/client/ClientInteraction.js +24 -1
  205. package/dist/esm/action/client/ClientInteraction.js.map +1 -1
  206. package/dist/esm/action/client/QueuedClientInteraction.d.ts +11 -3
  207. package/dist/esm/action/client/QueuedClientInteraction.d.ts.map +1 -1
  208. package/dist/esm/action/client/QueuedClientInteraction.js +5 -1
  209. package/dist/esm/action/client/QueuedClientInteraction.js.map +1 -1
  210. package/dist/esm/action/client/index.d.ts +1 -0
  211. package/dist/esm/action/client/index.d.ts.map +1 -1
  212. package/dist/esm/action/client/index.js +1 -0
  213. package/dist/esm/action/client/index.js.map +1 -1
  214. package/dist/esm/action/request/Read.d.ts.map +1 -1
  215. package/dist/esm/action/request/Read.js +2 -2
  216. package/dist/esm/action/request/Read.js.map +1 -1
  217. package/dist/esm/action/request/Write.js +4 -3
  218. package/dist/esm/action/request/Write.js.map +1 -1
  219. package/dist/esm/advertisement/ble/BleAdvertisement.d.ts +1 -1
  220. package/dist/esm/advertisement/ble/BleAdvertisement.d.ts.map +1 -1
  221. package/dist/esm/advertisement/ble/BleAdvertisement.js +2 -2
  222. package/dist/esm/advertisement/ble/BleAdvertisement.js.map +1 -1
  223. package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.d.ts +1 -1
  224. package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.js +1 -1
  225. package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.js.map +1 -1
  226. package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.d.ts.map +1 -1
  227. package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.js +4 -6
  228. package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.js.map +1 -1
  229. package/dist/esm/bdx/BdxClient.d.ts +2 -0
  230. package/dist/esm/bdx/BdxClient.d.ts.map +1 -1
  231. package/dist/esm/bdx/BdxClient.js +6 -0
  232. package/dist/esm/bdx/BdxClient.js.map +1 -1
  233. package/dist/esm/bdx/BdxError.d.ts +2 -0
  234. package/dist/esm/bdx/BdxError.d.ts.map +1 -1
  235. package/dist/esm/bdx/BdxError.js +2 -0
  236. package/dist/esm/bdx/BdxError.js.map +1 -1
  237. package/dist/esm/bdx/BdxMessenger.d.ts +5 -1
  238. package/dist/esm/bdx/BdxMessenger.d.ts.map +1 -1
  239. package/dist/esm/bdx/BdxMessenger.js +14 -5
  240. package/dist/esm/bdx/BdxMessenger.js.map +1 -1
  241. package/dist/esm/bdx/BdxProtocol.d.ts +14 -7
  242. package/dist/esm/bdx/BdxProtocol.d.ts.map +1 -1
  243. package/dist/esm/bdx/BdxProtocol.js +82 -20
  244. package/dist/esm/bdx/BdxProtocol.js.map +1 -1
  245. package/dist/esm/bdx/BdxSession.d.ts +10 -3
  246. package/dist/esm/bdx/BdxSession.d.ts.map +1 -1
  247. package/dist/esm/bdx/BdxSession.js +34 -9
  248. package/dist/esm/bdx/BdxSession.js.map +1 -1
  249. package/dist/esm/bdx/BdxSessionConfiguration.d.ts +16 -1
  250. package/dist/esm/bdx/BdxSessionConfiguration.d.ts.map +1 -1
  251. package/dist/esm/bdx/BdxSessionConfiguration.js +6 -1
  252. package/dist/esm/bdx/BdxSessionConfiguration.js.map +1 -1
  253. package/dist/esm/bdx/FileDesignator.d.ts +15 -1
  254. package/dist/esm/bdx/FileDesignator.d.ts.map +1 -1
  255. package/dist/esm/bdx/FileDesignator.js +29 -3
  256. package/dist/esm/bdx/FileDesignator.js.map +1 -1
  257. package/dist/esm/bdx/PersistedFileDesignator.d.ts +10 -2
  258. package/dist/esm/bdx/PersistedFileDesignator.d.ts.map +1 -1
  259. package/dist/esm/bdx/PersistedFileDesignator.js +24 -6
  260. package/dist/esm/bdx/PersistedFileDesignator.js.map +1 -1
  261. package/dist/esm/bdx/ScopedStorage.d.ts +18 -0
  262. package/dist/esm/bdx/ScopedStorage.d.ts.map +1 -0
  263. package/dist/esm/bdx/ScopedStorage.js +16 -0
  264. package/dist/esm/bdx/ScopedStorage.js.map +6 -0
  265. package/dist/esm/bdx/bdx-session-initiator.d.ts.map +1 -1
  266. package/dist/esm/bdx/bdx-session-initiator.js +10 -2
  267. package/dist/esm/bdx/bdx-session-initiator.js.map +1 -1
  268. package/dist/esm/bdx/flow/DrivenSendingFlow.d.ts.map +1 -1
  269. package/dist/esm/bdx/flow/DrivenSendingFlow.js +2 -0
  270. package/dist/esm/bdx/flow/DrivenSendingFlow.js.map +1 -1
  271. package/dist/esm/bdx/flow/DrivingReceivingFlow.d.ts.map +1 -1
  272. package/dist/esm/bdx/flow/DrivingReceivingFlow.js +1 -0
  273. package/dist/esm/bdx/flow/DrivingReceivingFlow.js.map +1 -1
  274. package/dist/esm/bdx/flow/Flow.d.ts +7 -0
  275. package/dist/esm/bdx/flow/Flow.d.ts.map +1 -1
  276. package/dist/esm/bdx/flow/Flow.js +23 -2
  277. package/dist/esm/bdx/flow/Flow.js.map +1 -1
  278. package/dist/esm/bdx/flow/FollowingReceivingFlow.d.ts.map +1 -1
  279. package/dist/esm/bdx/flow/FollowingReceivingFlow.js +3 -0
  280. package/dist/esm/bdx/flow/FollowingReceivingFlow.js.map +1 -1
  281. package/dist/esm/bdx/flow/FollowingSendingFlow.d.ts.map +1 -1
  282. package/dist/esm/bdx/flow/FollowingSendingFlow.js +1 -0
  283. package/dist/esm/bdx/flow/FollowingSendingFlow.js.map +1 -1
  284. package/dist/esm/bdx/flow/OutboundFlow.d.ts.map +1 -1
  285. package/dist/esm/bdx/flow/OutboundFlow.js +1 -0
  286. package/dist/esm/bdx/flow/OutboundFlow.js.map +1 -1
  287. package/dist/esm/bdx/index.d.ts +1 -0
  288. package/dist/esm/bdx/index.d.ts.map +1 -1
  289. package/dist/esm/bdx/index.js +1 -0
  290. package/dist/esm/bdx/index.js.map +1 -1
  291. package/dist/esm/certificate/kinds/Icac.d.ts.map +1 -1
  292. package/dist/esm/certificate/kinds/Icac.js +1 -7
  293. package/dist/esm/certificate/kinds/Icac.js.map +1 -1
  294. package/dist/esm/certificate/kinds/Rcac.d.ts +1 -0
  295. package/dist/esm/certificate/kinds/Rcac.d.ts.map +1 -1
  296. package/dist/esm/certificate/kinds/Rcac.js +3 -0
  297. package/dist/esm/certificate/kinds/Rcac.js.map +1 -1
  298. package/dist/esm/certificate/kinds/definitions/operational.d.ts +1 -1
  299. package/dist/esm/certificate/kinds/definitions/operational.js +1 -1
  300. package/dist/esm/certificate/kinds/definitions/operational.js.map +1 -1
  301. package/dist/esm/common/FailsafeContext.js +2 -2
  302. package/dist/esm/common/FailsafeContext.js.map +1 -1
  303. package/dist/esm/dcl/DclClient.d.ts.map +1 -1
  304. package/dist/esm/dcl/DclClient.js +1 -2
  305. package/dist/esm/dcl/DclClient.js.map +1 -1
  306. package/dist/esm/dcl/DclOtaUpdateService.d.ts +30 -31
  307. package/dist/esm/dcl/DclOtaUpdateService.d.ts.map +1 -1
  308. package/dist/esm/dcl/DclOtaUpdateService.js +191 -93
  309. package/dist/esm/dcl/DclOtaUpdateService.js.map +2 -2
  310. package/dist/esm/dcl/index.d.ts +0 -3
  311. package/dist/esm/dcl/index.d.ts.map +1 -1
  312. package/dist/esm/dcl/index.js +0 -3
  313. package/dist/esm/dcl/index.js.map +1 -1
  314. package/dist/esm/fabric/Fabric.d.ts +53 -9
  315. package/dist/esm/fabric/Fabric.d.ts.map +1 -1
  316. package/dist/esm/fabric/Fabric.js +67 -33
  317. package/dist/esm/fabric/Fabric.js.map +1 -1
  318. package/dist/esm/fabric/FabricAuthority.js +1 -1
  319. package/dist/esm/fabric/FabricAuthority.js.map +1 -1
  320. package/dist/esm/fabric/FabricManager.d.ts +14 -5
  321. package/dist/esm/fabric/FabricManager.d.ts.map +1 -1
  322. package/dist/esm/fabric/FabricManager.js +66 -43
  323. package/dist/esm/fabric/FabricManager.js.map +1 -1
  324. package/dist/esm/groups/FabricGroups.d.ts.map +1 -1
  325. package/dist/esm/groups/FabricGroups.js +5 -9
  326. package/dist/esm/groups/FabricGroups.js.map +1 -1
  327. package/dist/esm/index.d.ts +1 -0
  328. package/dist/esm/index.d.ts.map +1 -1
  329. package/dist/esm/index.js +1 -0
  330. package/dist/esm/index.js.map +1 -1
  331. package/dist/esm/interaction/InteractionMessenger.d.ts +1 -106
  332. package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
  333. package/dist/esm/interaction/InteractionMessenger.js +2 -144
  334. package/dist/esm/interaction/InteractionMessenger.js.map +2 -2
  335. package/dist/esm/interaction/index.d.ts +0 -1
  336. package/dist/esm/interaction/index.d.ts.map +1 -1
  337. package/dist/esm/interaction/index.js +0 -1
  338. package/dist/esm/interaction/index.js.map +1 -1
  339. package/dist/esm/mdns/MdnsClient.d.ts +4 -4
  340. package/dist/esm/mdns/MdnsClient.d.ts.map +1 -1
  341. package/dist/esm/mdns/MdnsClient.js +13 -17
  342. package/dist/esm/mdns/MdnsClient.js.map +1 -1
  343. package/dist/esm/mdns/MdnsConsts.d.ts +3 -3
  344. package/dist/esm/mdns/MdnsConsts.d.ts.map +1 -1
  345. package/dist/esm/mdns/MdnsConsts.js +3 -2
  346. package/dist/esm/mdns/MdnsConsts.js.map +1 -1
  347. package/dist/{cjs/dcl → esm/ota}/OtaImageHeader.d.ts.map +1 -1
  348. package/dist/esm/{dcl → ota}/OtaImageHeader.js.map +1 -1
  349. package/dist/esm/{dcl → ota}/OtaImageReader.d.ts.map +1 -1
  350. package/dist/esm/{dcl → ota}/OtaImageReader.js +0 -3
  351. package/dist/esm/ota/OtaImageReader.js.map +6 -0
  352. package/dist/{cjs/dcl → esm/ota}/OtaImageWriter.d.ts +1 -1
  353. package/dist/esm/{dcl → ota}/OtaImageWriter.d.ts.map +1 -1
  354. package/dist/esm/{dcl → ota}/OtaImageWriter.js.map +1 -1
  355. package/dist/esm/ota/index.d.ts +9 -0
  356. package/dist/esm/ota/index.d.ts.map +1 -0
  357. package/dist/esm/ota/index.js +9 -0
  358. package/dist/esm/ota/index.js.map +6 -0
  359. package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
  360. package/dist/esm/peer/ControllerCommissioner.js +5 -0
  361. package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
  362. package/dist/esm/peer/ControllerCommissioningFlow.d.ts +11 -3
  363. package/dist/esm/peer/ControllerCommissioningFlow.d.ts.map +1 -1
  364. package/dist/esm/peer/ControllerCommissioningFlow.js +119 -41
  365. package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
  366. package/dist/esm/peer/PeerSet.d.ts.map +1 -1
  367. package/dist/esm/peer/PeerSet.js +17 -10
  368. package/dist/esm/peer/PeerSet.js.map +1 -1
  369. package/dist/esm/protocol/DeviceAdvertiser.js +3 -3
  370. package/dist/esm/protocol/DeviceAdvertiser.js.map +1 -1
  371. package/dist/esm/protocol/ExchangeProvider.d.ts +2 -2
  372. package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
  373. package/dist/esm/protocol/ExchangeProvider.js +2 -2
  374. package/dist/esm/protocol/ExchangeProvider.js.map +1 -1
  375. package/dist/esm/protocol/MessageExchange.js +3 -3
  376. package/dist/esm/protocol/MessageExchange.js.map +1 -1
  377. package/dist/esm/protocol/ProtocolMocks.d.ts +2 -2
  378. package/dist/esm/protocol/ProtocolMocks.d.ts.map +1 -1
  379. package/dist/esm/protocol/ProtocolMocks.js +11 -2
  380. package/dist/esm/protocol/ProtocolMocks.js.map +1 -1
  381. package/dist/esm/session/NodeSession.d.ts.map +1 -1
  382. package/dist/esm/session/NodeSession.js +3 -3
  383. package/dist/esm/session/NodeSession.js.map +1 -1
  384. package/dist/esm/session/Session.d.ts.map +1 -1
  385. package/dist/esm/session/Session.js +1 -0
  386. package/dist/esm/session/Session.js.map +1 -1
  387. package/dist/esm/session/SessionManager.js +2 -2
  388. package/dist/esm/session/SessionManager.js.map +1 -1
  389. package/dist/esm/session/SessionParameters.d.ts.map +1 -1
  390. package/dist/esm/session/SessionParameters.js +7 -1
  391. package/dist/esm/session/SessionParameters.js.map +1 -1
  392. package/dist/esm/session/pase/PaseServer.d.ts.map +1 -1
  393. package/dist/esm/session/pase/PaseServer.js +1 -0
  394. package/dist/esm/session/pase/PaseServer.js.map +1 -1
  395. package/package.json +6 -6
  396. package/src/action/client/ClientBdx.ts +19 -0
  397. package/src/action/client/ClientInteraction.ts +34 -4
  398. package/src/action/client/QueuedClientInteraction.ts +16 -12
  399. package/src/action/client/index.ts +1 -0
  400. package/src/action/request/Read.ts +8 -2
  401. package/src/action/request/Write.ts +3 -3
  402. package/src/advertisement/ble/BleAdvertisement.ts +4 -4
  403. package/src/advertisement/mdns/CommissionableMdnsAdvertisement.ts +1 -1
  404. package/src/advertisement/mdns/OperationalMdnsAdvertisement.ts +4 -6
  405. package/src/bdx/BdxClient.ts +8 -0
  406. package/src/bdx/BdxError.ts +2 -0
  407. package/src/bdx/BdxMessenger.ts +16 -5
  408. package/src/bdx/BdxProtocol.ts +104 -22
  409. package/src/bdx/BdxSession.ts +38 -16
  410. package/src/bdx/BdxSessionConfiguration.ts +24 -2
  411. package/src/bdx/FileDesignator.ts +31 -2
  412. package/src/bdx/PersistedFileDesignator.ts +35 -8
  413. package/src/bdx/ScopedStorage.ts +25 -0
  414. package/src/bdx/bdx-session-initiator.ts +11 -2
  415. package/src/bdx/flow/DrivenSendingFlow.ts +3 -0
  416. package/src/bdx/flow/DrivingReceivingFlow.ts +1 -0
  417. package/src/bdx/flow/Flow.ts +29 -2
  418. package/src/bdx/flow/FollowingReceivingFlow.ts +3 -0
  419. package/src/bdx/flow/FollowingSendingFlow.ts +2 -0
  420. package/src/bdx/flow/OutboundFlow.ts +1 -0
  421. package/src/bdx/index.ts +1 -0
  422. package/src/certificate/kinds/Icac.ts +4 -1
  423. package/src/certificate/kinds/Rcac.ts +4 -0
  424. package/src/certificate/kinds/definitions/operational.ts +1 -1
  425. package/src/common/FailsafeContext.ts +2 -2
  426. package/src/dcl/DclClient.ts +1 -2
  427. package/src/dcl/DclOtaUpdateService.ts +266 -125
  428. package/src/dcl/index.ts +0 -3
  429. package/src/fabric/Fabric.ts +118 -39
  430. package/src/fabric/FabricAuthority.ts +1 -1
  431. package/src/fabric/FabricManager.ts +76 -49
  432. package/src/groups/FabricGroups.ts +5 -9
  433. package/src/index.ts +1 -0
  434. package/src/interaction/InteractionMessenger.ts +2 -186
  435. package/src/interaction/index.ts +0 -1
  436. package/src/mdns/MdnsClient.ts +14 -19
  437. package/src/mdns/MdnsConsts.ts +5 -4
  438. package/src/{dcl → ota}/OtaImageReader.ts +1 -5
  439. package/src/{dcl → ota}/OtaImageWriter.ts +1 -1
  440. package/src/ota/index.ts +9 -0
  441. package/src/peer/ControllerCommissioner.ts +7 -0
  442. package/src/peer/ControllerCommissioningFlow.ts +161 -54
  443. package/src/peer/PeerSet.ts +25 -12
  444. package/src/protocol/DeviceAdvertiser.ts +5 -5
  445. package/src/protocol/ExchangeProvider.ts +3 -3
  446. package/src/protocol/MessageExchange.ts +3 -3
  447. package/src/protocol/ProtocolMocks.ts +13 -4
  448. package/src/session/NodeSession.ts +3 -3
  449. package/src/session/Session.ts +1 -0
  450. package/src/session/SessionManager.ts +2 -2
  451. package/src/session/SessionParameters.ts +10 -2
  452. package/src/session/pase/PaseServer.ts +2 -1
  453. package/dist/cjs/dcl/OtaImageReader.js.map +0 -6
  454. package/dist/cjs/interaction/SubscriptionClient.d.ts +0 -39
  455. package/dist/cjs/interaction/SubscriptionClient.d.ts.map +0 -1
  456. package/dist/cjs/interaction/SubscriptionClient.js +0 -93
  457. package/dist/cjs/interaction/SubscriptionClient.js.map +0 -6
  458. package/dist/esm/dcl/OtaImageReader.js.map +0 -6
  459. package/dist/esm/interaction/SubscriptionClient.d.ts +0 -39
  460. package/dist/esm/interaction/SubscriptionClient.d.ts.map +0 -1
  461. package/dist/esm/interaction/SubscriptionClient.js +0 -73
  462. package/dist/esm/interaction/SubscriptionClient.js.map +0 -6
  463. package/src/interaction/SubscriptionClient.ts +0 -104
  464. /package/dist/cjs/{dcl → ota}/OtaImageHeader.d.ts +0 -0
  465. /package/dist/cjs/{dcl → ota}/OtaImageHeader.js +0 -0
  466. /package/dist/cjs/{dcl → ota}/OtaImageReader.d.ts +0 -0
  467. /package/dist/cjs/{dcl → ota}/OtaImageWriter.js +0 -0
  468. /package/dist/esm/{dcl → ota}/OtaImageHeader.d.ts +0 -0
  469. /package/dist/esm/{dcl → ota}/OtaImageHeader.js +0 -0
  470. /package/dist/esm/{dcl → ota}/OtaImageReader.d.ts +0 -0
  471. /package/dist/esm/{dcl → ota}/OtaImageWriter.js +0 -0
  472. /package/src/{dcl → ota}/OtaImageHeader.ts +0 -0
@@ -31,12 +31,19 @@ import { FabricAccessControl } from "#interaction/FabricAccessControl.js";
31
31
  import { PeerAddress } from "#peer/PeerAddress.js";
32
32
  import { MessageExchange } from "#protocol/MessageExchange.js";
33
33
  import { SecureSession } from "#session/SecureSession.js";
34
- import { CaseAuthenticatedTag, FabricId, FabricIndex, GroupId, NodeId, StatusResponse, VendorId } from "#types";
34
+ import {
35
+ CaseAuthenticatedTag,
36
+ FabricId,
37
+ FabricIndex,
38
+ GlobalFabricId,
39
+ GroupId,
40
+ NodeId,
41
+ StatusResponse,
42
+ VendorId,
43
+ } from "#types";
35
44
 
36
45
  const logger = Logger.get("Fabric");
37
46
 
38
- const COMPRESSED_FABRIC_ID_INFO = Bytes.fromString("CompressedFabric");
39
-
40
47
  export class PublicKeyError extends MatterError {}
41
48
 
42
49
  export type ExposedFabricInformation = {
@@ -54,8 +61,8 @@ export class Fabric {
54
61
  readonly fabricId: FabricId;
55
62
  readonly nodeId: NodeId;
56
63
  readonly rootNodeId: NodeId;
57
- readonly operationalId: Bytes;
58
- readonly rootPublicKey: Bytes;
64
+ readonly globalId: GlobalFabricId;
65
+ #rootPublicKey?: Bytes;
59
66
  #rootVendorId: VendorId;
60
67
  readonly rootCert: Bytes;
61
68
  readonly identityProtectionKey: Bytes;
@@ -78,14 +85,24 @@ export class Fabric {
78
85
  #storage?: StorageContext;
79
86
  #isDeleting?: boolean;
80
87
 
81
- constructor(crypto: Crypto, config: Fabric.Config) {
88
+ /**
89
+ * Create a fabric synchronously.
90
+ *
91
+ * Certain derived fields that require async crypto operations to compute must be supplied here. Use {@link create}
92
+ * to populate these fields automatically.
93
+ */
94
+ constructor(crypto: Crypto, config: Fabric.ConstructorConfig) {
82
95
  this.#crypto = crypto;
83
96
  this.fabricIndex = config.fabricIndex;
84
97
  this.fabricId = config.fabricId;
85
98
  this.nodeId = config.nodeId;
86
99
  this.rootNodeId = config.rootNodeId;
87
- this.operationalId = config.operationalId;
88
- this.rootPublicKey = config.rootPublicKey;
100
+ if ("operationalId" in config) {
101
+ this.globalId = GlobalFabricId(config.operationalId);
102
+ } else {
103
+ this.globalId = config.globalId;
104
+ }
105
+ this.#rootPublicKey = config.rootPublicKey;
89
106
  this.#rootVendorId = config.rootVendorId;
90
107
  this.rootCert = config.rootCert;
91
108
  this.identityProtectionKey = config.identityProtectionKey;
@@ -100,17 +117,52 @@ export class Fabric {
100
117
  this.#groups = new FabricGroups(this);
101
118
  }
102
119
 
120
+ /**
121
+ * Create a fabric.
122
+ *
123
+ * This async creation path populates derived fields that require async crypto operations to compute.
124
+ */
125
+ static async create(crypto: Crypto, config: Fabric.Config) {
126
+ let { globalId, operationalIdentityProtectionKey } = config;
127
+
128
+ // Compute global ID if not passed as config
129
+ if (globalId === undefined) {
130
+ const caKey = config.rootPublicKey ?? Rcac.publicKeyOfTlv(config.rootCert);
131
+ globalId = await GlobalFabricId.compute(crypto, config.fabricId, caKey);
132
+ }
133
+
134
+ // Compute operational IPK if not passed as config
135
+ if (operationalIdentityProtectionKey === undefined) {
136
+ operationalIdentityProtectionKey = await crypto.createHkdfKey(
137
+ config.identityProtectionKey,
138
+ Bytes.fromBigInt(globalId, 8),
139
+ GROUP_SECURITY_INFO,
140
+ );
141
+ }
142
+
143
+ return new Fabric(crypto, {
144
+ ...config,
145
+ globalId,
146
+ operationalIdentityProtectionKey,
147
+ });
148
+ }
149
+
103
150
  get crypto() {
104
151
  return this.#crypto;
105
152
  }
106
153
 
107
- get config(): Fabric.Config {
108
- return {
154
+ /**
155
+ * Obtain configuration required to recreate fabric.
156
+ *
157
+ * TODO - we currently use this for persistence; remove when we move to OperationalCredentials as "source of truth"
158
+ */
159
+ get config(): Fabric.SyncConfig {
160
+ const config = {
109
161
  fabricIndex: this.fabricIndex,
110
162
  fabricId: this.fabricId,
111
163
  nodeId: this.nodeId,
112
164
  rootNodeId: this.rootNodeId,
113
- operationalId: this.operationalId,
165
+ globalId: this.globalId,
114
166
  rootPublicKey: this.rootPublicKey,
115
167
  keyPair: this.#keyPair.keyPair,
116
168
  rootVendorId: this.rootVendorId,
@@ -122,6 +174,11 @@ export class Fabric {
122
174
  vidVerificationStatement: this.vidVerificationStatement,
123
175
  label: this.#label,
124
176
  };
177
+
178
+ // Backwards compatibility
179
+ (config as unknown as { operationalId: Bytes }).operationalId = Bytes.fromBigInt(this.globalId, 8);
180
+
181
+ return config;
125
182
  }
126
183
 
127
184
  get label() {
@@ -185,6 +242,13 @@ export class Fabric {
185
242
  return this.#vvsc;
186
243
  }
187
244
 
245
+ get rootPublicKey() {
246
+ if (this.#rootPublicKey === undefined) {
247
+ this.#rootPublicKey = Rcac.publicKeyOfTlv(this.rootCert);
248
+ }
249
+ return this.#rootPublicKey;
250
+ }
251
+
188
252
  get rootVendorId() {
189
253
  return this.#rootVendorId;
190
254
  }
@@ -373,7 +437,6 @@ export class FabricBuilder {
373
437
  #fabricId?: FabricId;
374
438
  #nodeId?: NodeId;
375
439
  #rootNodeId?: NodeId;
376
- #rootPublicKey?: Bytes;
377
440
  #identityProtectionKey?: Bytes;
378
441
  #vidVerificationStatement?: Bytes;
379
442
  #vvsc?: Bytes;
@@ -405,7 +468,6 @@ export class FabricBuilder {
405
468
  const root = Rcac.fromTlv(rootCert);
406
469
  await root.verify(this.#crypto);
407
470
  this.#rootCert = rootCert;
408
- this.#rootPublicKey = root.cert.ellipticCurvePublicKey;
409
471
  return this;
410
472
  }
411
473
 
@@ -423,7 +485,7 @@ export class FabricBuilder {
423
485
  } = Noc.fromTlv(operationalCert).cert;
424
486
  logger.debug(
425
487
  "Installing operational certificate",
426
- Diagnostic.dict({ nodeId, fabricId, caseAuthenticatedTags }),
488
+ Diagnostic.dict({ nodeId: NodeId.strOf(nodeId), fabricId, caseAuthenticatedTags }),
427
489
  );
428
490
  if (caseAuthenticatedTags !== undefined) {
429
491
  CaseAuthenticatedTag.validateNocTagList(caseAuthenticatedTags);
@@ -481,17 +543,16 @@ export class FabricBuilder {
481
543
  this.#rootNodeId = fabric.rootNodeId;
482
544
  this.#identityProtectionKey = fabric.identityProtectionKey;
483
545
  this.#rootCert = fabric.rootCert;
484
- this.#rootPublicKey = fabric.rootPublicKey;
485
546
  this.#vidVerificationStatement = fabric.vidVerificationStatement;
486
547
  this.#vvsc = fabric.vvsc;
487
548
  this.#label = fabric.label;
488
549
  }
489
550
 
490
- matchesToFabric(fabric: Fabric) {
491
- if (this.#fabricId === undefined || this.#rootPublicKey === undefined) {
551
+ get globalId() {
552
+ if (this.#fabricId === undefined || this.#rootCert === undefined) {
492
553
  throw new MatterFlowError("Node Operational Data needs to be set first.");
493
554
  }
494
- return fabric.matchesFabricIdAndRootPublicKey(this.#fabricId, this.#rootPublicKey);
555
+ return GlobalFabricId.compute(this.#crypto, this.#fabricId, Rcac.publicKeyOfTlv(this.#rootCert));
495
556
  }
496
557
 
497
558
  get nodeId() {
@@ -510,38 +571,22 @@ export class FabricBuilder {
510
571
  if (this.#fabricIndex !== undefined) throw new InternalError("FabricBuilder can only be built once");
511
572
  if (this.#rootNodeId === undefined) throw new InternalError("rootNodeId needs to be set");
512
573
  if (this.#rootVendorId === undefined) throw new InternalError("vendorId needs to be set");
513
- if (this.#rootCert === undefined || this.#rootPublicKey === undefined)
514
- throw new InternalError("rootCert needs to be set");
574
+ if (this.#rootCert === undefined) throw new InternalError("rootCert needs to be set");
515
575
  if (this.#identityProtectionKey === undefined) throw new InternalError("identityProtectionKey needs to be set");
516
576
  if (this.#operationalCert === undefined || this.#fabricId === undefined || this.#nodeId === undefined)
517
577
  throw new InternalError("operationalCert needs to be set");
518
578
 
519
579
  this.#fabricIndex = fabricIndex;
520
- const saltWriter = new DataWriter();
521
- saltWriter.writeUInt64(this.#fabricId);
522
- const operationalId = await this.#crypto.createHkdfKey(
523
- Bytes.of(this.#rootPublicKey).slice(1),
524
- saltWriter.toByteArray(),
525
- COMPRESSED_FABRIC_ID_INFO,
526
- 8,
527
- );
528
580
 
529
- return new Fabric(this.#crypto, {
581
+ return await Fabric.create(this.#crypto, {
530
582
  fabricIndex: this.#fabricIndex,
531
583
  fabricId: this.#fabricId,
532
584
  nodeId: this.#nodeId,
533
585
  rootNodeId: this.#rootNodeId,
534
- operationalId: operationalId,
535
- rootPublicKey: this.#rootPublicKey,
536
586
  keyPair: this.#keyPair,
537
587
  rootVendorId: this.#rootVendorId,
538
588
  rootCert: this.#rootCert,
539
589
  identityProtectionKey: this.#identityProtectionKey, // Epoch Key
540
- operationalIdentityProtectionKey: await this.#crypto.createHkdfKey(
541
- this.#identityProtectionKey,
542
- operationalId,
543
- GROUP_SECURITY_INFO,
544
- ),
545
590
  intermediateCACert: this.#intermediateCACert,
546
591
  operationalCert: this.#operationalCert,
547
592
  vidVerificationStatement: this.#vidVerificationStatement,
@@ -552,22 +597,56 @@ export class FabricBuilder {
552
597
  }
553
598
 
554
599
  export namespace Fabric {
600
+ /**
601
+ * Configuration required to initialize a fabric.
602
+ */
555
603
  export type Config = {
556
604
  fabricIndex: FabricIndex;
557
605
  fabricId: FabricId;
558
606
  nodeId: NodeId;
559
607
  rootNodeId: NodeId;
560
- operationalId: Bytes;
561
- rootPublicKey: Bytes;
562
608
  keyPair: BinaryKeyPair;
563
609
  rootVendorId: VendorId;
564
610
  rootCert: Bytes;
565
611
  identityProtectionKey: Bytes;
566
612
  vidVerificationStatement?: Bytes;
567
613
  vvsc?: Bytes;
568
- operationalIdentityProtectionKey: Bytes;
569
614
  intermediateCACert: Bytes | undefined;
570
615
  operationalCert: Bytes;
571
616
  label: string;
617
+
618
+ // These are derived; Fabric.create() will generate if necessary
619
+ rootPublicKey?: Bytes;
620
+ globalId?: GlobalFabricId;
621
+ operationalIdentityProtectionKey?: Bytes;
622
+ };
623
+
624
+ /**
625
+ * Configuration required to initialize a fabric without asynchronous crypto operations.
626
+ */
627
+ export type SyncConfig = Config & {
628
+ operationalIdentityProtectionKey: Bytes;
629
+ globalId: GlobalFabricId;
572
630
  };
631
+
632
+ /**
633
+ * Configuration passed to fabric constructor.
634
+ *
635
+ * Provides deprecated fields for backwards compatibility.
636
+ */
637
+ export type ConstructorConfig = Omit<SyncConfig, "globalId"> &
638
+ (
639
+ | {
640
+ globalId: GlobalFabricId;
641
+ }
642
+ | {
643
+ /** @deprecated */
644
+ operationalId: Bytes;
645
+ }
646
+ );
647
+
648
+ /**
649
+ * An object that may be used to identify a fabric.
650
+ */
651
+ export type Identifier = FabricIndex | GlobalFabricId | { fabricIndex: FabricIndex };
573
652
  }
@@ -147,7 +147,7 @@ export class FabricAuthority {
147
147
  let index = config.adminFabricIndex;
148
148
  if (index === undefined) {
149
149
  index = this.#fabrics.allocateFabricIndex();
150
- } else if (this.#fabrics.maybeForIndex(index) !== undefined) {
150
+ } else if (this.#fabrics.maybeFor(index) !== undefined) {
151
151
  throw new ImplementationError(`Cannot allocate controller fabric ${index} because index is in use`);
152
152
  }
153
153
 
@@ -6,9 +6,11 @@
6
6
 
7
7
  import {
8
8
  AsyncObservable,
9
+ BasicSet,
9
10
  Bytes,
10
11
  Construction,
11
12
  Crypto,
13
+ Diagnostic,
12
14
  Environment,
13
15
  Environmental,
14
16
  ImplementationError,
@@ -22,8 +24,7 @@ import {
22
24
  StorageContext,
23
25
  StorageManager,
24
26
  } from "#general";
25
- import { PeerAddress } from "#peer/PeerAddress.js";
26
- import { FabricId, FabricIndex } from "#types";
27
+ import { FabricId, FabricIndex, GlobalFabricId, NodeId } from "#types";
27
28
  import { Fabric } from "./Fabric.js";
28
29
 
29
30
  const logger = Logger.get("FabricManager");
@@ -35,7 +36,7 @@ export class FabricTableFullError extends MatterError {}
35
36
  export class FabricManager {
36
37
  #crypto: Crypto;
37
38
  #nextFabricIndex = 1;
38
- readonly #fabrics = new Map<FabricIndex, Fabric>();
39
+ readonly #fabrics = new BasicSet<Fabric>();
39
40
  #initializationDone = false;
40
41
  #storage?: StorageContext;
41
42
  #events = {
@@ -64,7 +65,7 @@ export class FabricManager {
64
65
 
65
66
  const fabrics = await this.#storage.get<Fabric.Config[]>("fabrics", []);
66
67
  for (const fabricConfig of fabrics) {
67
- this.#addNewFabric(new Fabric(crypto, fabricConfig));
68
+ this.#addNewFabric(await Fabric.create(crypto, fabricConfig));
68
69
  }
69
70
 
70
71
  this.#nextFabricIndex = await this.#storage.get("nextFabricIndex", this.#nextFabricIndex);
@@ -105,32 +106,63 @@ export class FabricManager {
105
106
  await this.#storage?.clear();
106
107
  }
107
108
 
108
- has(address: FabricIndex | PeerAddress) {
109
- if (typeof address === "object") {
110
- address = address.fabricIndex;
109
+ /**
110
+ * Test whether the fabric identified by {@link identifier} is present.
111
+ */
112
+ has(address: Fabric.Identifier) {
113
+ let fabric;
114
+ if (typeof address === "bigint") {
115
+ fabric = this.#fabrics.get("globalId", address);
116
+ } else {
117
+ if (typeof address === "object") {
118
+ address = address.fabricIndex;
119
+ }
120
+ fabric = this.#fabrics.get("fabricIndex", address);
111
121
  }
112
- const fabric = this.maybeForIndex(address);
113
- return fabric && !fabric.isDeleting;
122
+ return fabric !== undefined && !fabric.isDeleting;
114
123
  }
115
124
 
116
- for(address: FabricIndex | PeerAddress) {
117
- if (typeof address === "object") {
118
- address = address.fabricIndex;
125
+ /**
126
+ * Obtain the fabric identified by {@link identifier}.
127
+ *
128
+ * Throws if the fabric is not found.
129
+ */
130
+ for(identifier: Fabric.Identifier) {
131
+ let fabric;
132
+ if (typeof identifier === "bigint") {
133
+ fabric = this.#fabrics.get("globalId", identifier);
134
+ } else {
135
+ if (typeof identifier === "object") {
136
+ identifier = identifier.fabricIndex;
137
+ }
138
+ fabric = this.#fabrics.get("fabricIndex", identifier);
119
139
  }
120
- const fabric = this.#fabrics.get(address);
121
- if (fabric === undefined) {
122
- throw new FabricNotFoundError(`Cannot access fabric for unknown index ${address}`);
140
+
141
+ if (fabric === undefined || fabric.isDeleting) {
142
+ const str = typeof identifier === "bigint" ? GlobalFabricId.strOf(identifier) : `#${identifier}`;
143
+ throw new FabricNotFoundError(
144
+ `Fabric index ${str} ${fabric === undefined ? "does not exist" : "is deleted"}`,
145
+ );
123
146
  }
124
147
  return fabric;
125
148
  }
126
149
 
150
+ /**
151
+ * Get the fabric identified by {@link identifier} if present.
152
+ */
153
+ maybeFor(identifier: Fabric.Identifier) {
154
+ if (this.has(identifier)) {
155
+ return this.for(identifier);
156
+ }
157
+ }
158
+
127
159
  allocateFabricIndex() {
128
160
  this.#construction.assert();
129
161
 
130
162
  for (let i = 0; i < 254; i++) {
131
163
  const fabricIndex = this.#nextFabricIndex++;
132
164
  if (this.#nextFabricIndex > 254) this.#nextFabricIndex = 1;
133
- if (!this.#fabrics.has(FabricIndex(fabricIndex))) {
165
+ if (!this.#fabrics.get("fabricIndex", FabricIndex(fabricIndex))) {
134
166
  return FabricIndex(fabricIndex);
135
167
  }
136
168
  }
@@ -163,7 +195,7 @@ export class FabricManager {
163
195
 
164
196
  #addNewFabric(fabric: Fabric) {
165
197
  const { fabricIndex } = fabric;
166
- if (this.#fabrics.has(fabricIndex)) {
198
+ if (this.#fabrics.get("fabricIndex", fabricIndex)) {
167
199
  throw new MatterFlowError(`Fabric with index ${fabricIndex} already exists.`);
168
200
  }
169
201
 
@@ -176,8 +208,12 @@ export class FabricManager {
176
208
 
177
209
  /** Insert Fabric into the manager without emitting events */
178
210
  #addOrUpdateFabricEntry(fabric: Fabric) {
179
- const { fabricIndex } = fabric;
180
- this.#fabrics.set(fabricIndex, fabric);
211
+ const existing = this.#fabrics.get("fabricIndex", fabric.fabricIndex);
212
+ if (existing) {
213
+ this.#fabrics.delete(existing);
214
+ }
215
+
216
+ this.#fabrics.add(fabric);
181
217
 
182
218
  fabric.leaving.on(() => this.events.leaving.emit(fabric));
183
219
  fabric.deleting.on(() => this.events.deleting.emit(fabric));
@@ -186,7 +222,7 @@ export class FabricManager {
186
222
  fabric.persistCallback = (isUpdate = true) => {
187
223
  if (!this.#storage) {
188
224
  if (isUpdate) {
189
- logger.warn(`Fabric ${fabricIndex} cannot persist because FabricManager has no storage`);
225
+ logger.warn(`Fabric ${fabric.fabricIndex} cannot persist because FabricManager has no storage`);
190
226
  }
191
227
  return;
192
228
  }
@@ -198,14 +234,14 @@ export class FabricManager {
198
234
  });
199
235
  };
200
236
  if (this.#storage !== undefined && fabric.storage === undefined) {
201
- fabric.storage = this.#storage.createContext(`fabric-${fabricIndex}`);
237
+ fabric.storage = this.#storage.createContext(`fabric-${fabric.fabricIndex}`);
202
238
  }
203
239
  }
204
240
 
205
241
  async #handleFabricDeleted(fabric: Fabric) {
206
242
  await this.#construction;
207
243
 
208
- this.#fabrics.delete(fabric.fabricIndex);
244
+ this.#fabrics.delete(fabric);
209
245
  if (this.#storage) {
210
246
  await this.persistFabrics();
211
247
  }
@@ -221,7 +257,7 @@ export class FabricManager {
221
257
  get fabrics() {
222
258
  this.#construction.assert();
223
259
 
224
- return Array.from(this.#fabrics.values()).filter(fabric => !fabric.isDeleting);
260
+ return this.#fabrics.filter(fabric => !fabric.isDeleting);
225
261
  }
226
262
 
227
263
  get length() {
@@ -239,18 +275,31 @@ export class FabricManager {
239
275
  async findFabricFromDestinationId(destinationId: Bytes, initiatorRandom: Bytes) {
240
276
  this.#construction.assert();
241
277
 
242
- for (const fabric of this.#fabrics.values()) {
278
+ for (const fabric of this.#fabrics) {
243
279
  const candidateDestinationIds = await fabric.destinationIdsFor(fabric.nodeId, initiatorRandom);
244
280
  if (candidateDestinationIds.some(candidate => Bytes.areEqual(candidate, destinationId))) {
245
281
  if (fabric.isDeleting) {
246
- throw new FabricNotFoundError("Fabric is deleting");
282
+ throw new FabricNotFoundError("Fabric is deleting for CASE sigma2");
247
283
  }
248
284
 
249
285
  return fabric;
250
286
  }
251
287
  }
252
288
 
253
- throw new FabricNotFoundError("Fabric not found");
289
+ const fabrics = this.#fabrics.map(
290
+ fabric =>
291
+ `#${fabric.fabricIndex} (node ID ${NodeId.strOf(fabric.nodeId)}) keys ${fabric.groups.keySets
292
+ .allKeysForId(0)
293
+ .map(({ key }) => Bytes.toHex(key))
294
+ .join(" & ")}`,
295
+ );
296
+
297
+ logger.debug(
298
+ `No match for destination ID`,
299
+ Diagnostic.dict({ destId: destinationId, random: initiatorRandom, ...fabrics }),
300
+ );
301
+
302
+ throw new FabricNotFoundError("Fabric not found for CASE sigma2");
254
303
  }
255
304
 
256
305
  findByKeypair(keypair: Key) {
@@ -264,28 +313,6 @@ export class FabricManager {
264
313
  return undefined;
265
314
  }
266
315
 
267
- maybeForIndex(index: FabricIndex) {
268
- this.#construction.assert();
269
-
270
- const fabric = this.#fabrics.get(index);
271
- if (fabric && !fabric.isDeleting) {
272
- return fabric;
273
- }
274
- }
275
-
276
- forIndex(index: FabricIndex) {
277
- this.#construction.assert();
278
-
279
- const fabric = this.#fabrics.get(index);
280
- if (fabric === undefined) {
281
- throw new FabricNotFoundError(`Fabric index ${index} does not exist`);
282
- }
283
- if (fabric.isDeleting) {
284
- throw new FabricNotFoundError(`Fabric index ${index} is deleting`);
285
- }
286
- return fabric;
287
- }
288
-
289
316
  forDescriptor(descriptor: { rootPublicKey: Bytes; fabricId: FabricId }) {
290
317
  this.#construction.assert();
291
318
 
@@ -300,7 +327,7 @@ export class FabricManager {
300
327
  await this.#construction;
301
328
 
302
329
  const { fabricIndex } = fabric;
303
- const existingFabric = this.#fabrics.get(fabricIndex);
330
+ const existingFabric = this.for(fabricIndex);
304
331
  if (existingFabric === undefined) {
305
332
  throw new FabricNotFoundError(
306
333
  `Fabric with index ${fabricIndex} cannot be replaced because it does not exist.`,
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Fabric } from "#fabric/Fabric.js";
7
- import { BasicMap, Bytes, InternalError, MatterFlowError, StorageContext } from "#general";
7
+ import { BasicMap, Bytes, hex, InternalError, MatterFlowError, StorageContext } from "#general";
8
8
  import { GroupKeySet, KeySets, OperationalKeySet } from "#groups/KeySets.js";
9
9
  import { MessagingState } from "#groups/MessagingState.js";
10
10
  import { GroupId, MATTER_EPOCH_OFFSET_US } from "#types";
@@ -122,19 +122,15 @@ export class FabricGroups {
122
122
  await this.#cleanUpCounters(groupKeySetId);
123
123
 
124
124
  // Lets pre-calculate the operational keys
125
- const operationalId = this.#fabric.operationalId;
126
- const operationalEpochKey0 = await this.#fabric.crypto.createHkdfKey(
127
- epochKey0,
128
- operationalId,
129
- GROUP_SECURITY_INFO,
130
- );
125
+ const globalId = Bytes.fromHex(hex.fixed(this.#fabric.globalId, 16));
126
+ const operationalEpochKey0 = await this.#fabric.crypto.createHkdfKey(epochKey0, globalId, GROUP_SECURITY_INFO);
131
127
  const operationalEpochKey1 =
132
128
  epochKey1 !== null
133
- ? await this.#fabric.crypto.createHkdfKey(epochKey1, operationalId, GROUP_SECURITY_INFO)
129
+ ? await this.#fabric.crypto.createHkdfKey(epochKey1, globalId, GROUP_SECURITY_INFO)
134
130
  : null;
135
131
  const operationalEpochKey2 =
136
132
  epochKey2 !== null
137
- ? await this.#fabric.crypto.createHkdfKey(epochKey2, operationalId, GROUP_SECURITY_INFO)
133
+ ? await this.#fabric.crypto.createHkdfKey(epochKey2, globalId, GROUP_SECURITY_INFO)
138
134
  : null;
139
135
  this.#keySets.add({
140
136
  ...groupKeySet,
package/src/index.ts CHANGED
@@ -21,6 +21,7 @@ export * from "./fabric/index.js";
21
21
  export * from "./groups/index.js";
22
22
  export * from "./interaction/index.js";
23
23
  export * from "./mdns/index.js";
24
+ export * from "./ota/index.js";
24
25
  export * from "./peer/index.js";
25
26
  export * from "./protocol/index.js";
26
27
  export * from "./securechannel/index.js";