@matter/node 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 (353) hide show
  1. package/dist/cjs/behavior/Behavior.d.ts.map +1 -1
  2. package/dist/cjs/behavior/Behavior.js +2 -0
  3. package/dist/cjs/behavior/Behavior.js.map +1 -1
  4. package/dist/cjs/behavior/Events.d.ts.map +1 -1
  5. package/dist/cjs/behavior/Events.js +4 -2
  6. package/dist/cjs/behavior/Events.js.map +1 -1
  7. package/dist/cjs/behavior/cluster/ClusterBehavior.d.ts +17 -3
  8. package/dist/cjs/behavior/cluster/ClusterBehavior.d.ts.map +1 -1
  9. package/dist/cjs/behavior/cluster/ClusterBehavior.js +2 -20
  10. package/dist/cjs/behavior/cluster/ClusterBehavior.js.map +1 -1
  11. package/dist/cjs/behavior/cluster/ClusterBehaviorType.d.ts.map +1 -1
  12. package/dist/cjs/behavior/cluster/ClusterBehaviorType.js +8 -150
  13. package/dist/cjs/behavior/cluster/ClusterBehaviorType.js.map +1 -1
  14. package/dist/cjs/behavior/internal/BehaviorBacking.d.ts.map +1 -1
  15. package/dist/cjs/behavior/internal/BehaviorBacking.js +2 -0
  16. package/dist/cjs/behavior/internal/BehaviorBacking.js.map +1 -1
  17. package/dist/cjs/behavior/internal/ClusterDerivation.d.ts +45 -0
  18. package/dist/cjs/behavior/internal/ClusterDerivation.d.ts.map +1 -0
  19. package/dist/cjs/behavior/internal/ClusterDerivation.js +192 -0
  20. package/dist/cjs/behavior/internal/ClusterDerivation.js.map +6 -0
  21. package/dist/cjs/behavior/internal/ClusterStatics.d.ts +16 -0
  22. package/dist/cjs/behavior/internal/ClusterStatics.d.ts.map +1 -0
  23. package/dist/cjs/behavior/internal/ClusterStatics.js +138 -0
  24. package/dist/cjs/behavior/internal/ClusterStatics.js.map +6 -0
  25. package/dist/cjs/behavior/internal/ModeledState.d.ts +18 -0
  26. package/dist/cjs/behavior/internal/ModeledState.d.ts.map +1 -0
  27. package/dist/cjs/behavior/internal/ModeledState.js +54 -0
  28. package/dist/cjs/behavior/internal/ModeledState.js.map +6 -0
  29. package/dist/cjs/behavior/internal/ServerBehaviorBacking.d.ts.map +1 -1
  30. package/dist/cjs/behavior/internal/ServerBehaviorBacking.js +3 -12
  31. package/dist/cjs/behavior/internal/ServerBehaviorBacking.js.map +1 -1
  32. package/dist/cjs/behavior/state/managed/Datasource.js +28 -17
  33. package/dist/cjs/behavior/state/managed/Datasource.js.map +1 -1
  34. package/dist/cjs/behavior/state/managed/Internal.d.ts +16 -5
  35. package/dist/cjs/behavior/state/managed/Internal.d.ts.map +1 -1
  36. package/dist/cjs/behavior/state/managed/Internal.js +23 -25
  37. package/dist/cjs/behavior/state/managed/Internal.js.map +1 -1
  38. package/dist/cjs/behavior/state/managed/ManagedReference.d.ts +45 -12
  39. package/dist/cjs/behavior/state/managed/ManagedReference.d.ts.map +1 -1
  40. package/dist/cjs/behavior/state/managed/ManagedReference.js +74 -44
  41. package/dist/cjs/behavior/state/managed/ManagedReference.js.map +1 -1
  42. package/dist/cjs/behavior/state/managed/ReadOnlyReference.d.ts +31 -0
  43. package/dist/cjs/behavior/state/managed/ReadOnlyReference.d.ts.map +1 -0
  44. package/dist/cjs/behavior/state/managed/ReadOnlyReference.js +60 -0
  45. package/dist/cjs/behavior/state/managed/ReadOnlyReference.js.map +6 -0
  46. package/dist/cjs/behavior/state/managed/ValReference.d.ts +47 -10
  47. package/dist/cjs/behavior/state/managed/ValReference.d.ts.map +1 -1
  48. package/dist/cjs/behavior/state/managed/ValReference.js +29 -0
  49. package/dist/cjs/behavior/state/managed/ValReference.js.map +2 -2
  50. package/dist/cjs/behavior/state/managed/values/BitmapManager.js +5 -20
  51. package/dist/cjs/behavior/state/managed/values/BitmapManager.js.map +1 -1
  52. package/dist/cjs/behavior/state/managed/values/ListManager.d.ts.map +1 -1
  53. package/dist/cjs/behavior/state/managed/values/ListManager.js +262 -119
  54. package/dist/cjs/behavior/state/managed/values/ListManager.js.map +2 -2
  55. package/dist/cjs/behavior/state/managed/values/StructManager.js +14 -23
  56. package/dist/cjs/behavior/state/managed/values/StructManager.js.map +2 -2
  57. package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts +13 -3
  58. package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
  59. package/dist/cjs/behavior/system/commissioning/CommissioningClient.js +12 -0
  60. package/dist/cjs/behavior/system/commissioning/CommissioningClient.js.map +1 -1
  61. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts +9 -1
  62. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
  63. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js +9 -0
  64. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
  65. package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts +2 -1
  66. package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
  67. package/dist/cjs/behavior/system/controller/ControllerBehavior.js +2 -1
  68. package/dist/cjs/behavior/system/controller/ControllerBehavior.js.map +1 -1
  69. package/dist/cjs/behavior/system/dcl/DclBehavior.d.ts +3 -3
  70. package/dist/cjs/behavior/system/network/ServerGroupNetworking.d.ts +2 -1
  71. package/dist/cjs/behavior/system/network/ServerGroupNetworking.d.ts.map +1 -1
  72. package/dist/cjs/behavior/system/network/ServerGroupNetworking.js.map +1 -1
  73. package/dist/cjs/behavior/system/sessions/SessionsBehavior.d.ts +4 -0
  74. package/dist/cjs/behavior/system/sessions/SessionsBehavior.d.ts.map +1 -1
  75. package/dist/cjs/behavior/system/sessions/SessionsBehavior.js +6 -1
  76. package/dist/cjs/behavior/system/sessions/SessionsBehavior.js.map +1 -1
  77. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.d.ts +28 -0
  78. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.d.ts.map +1 -0
  79. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.js +74 -0
  80. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.js.map +6 -0
  81. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.d.ts +8 -3
  82. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.d.ts.map +1 -1
  83. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js +61 -30
  84. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
  85. package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts +2 -2
  86. package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
  87. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
  88. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +43 -21
  89. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
  90. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +29 -23
  91. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
  92. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +104 -60
  93. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
  94. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts +9 -1
  95. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
  96. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js +11 -7
  97. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
  98. package/dist/cjs/behaviors/groupcast/GroupcastServer.d.ts.map +1 -1
  99. package/dist/cjs/behaviors/groupcast/GroupcastServer.js +41 -25
  100. package/dist/cjs/behaviors/groupcast/GroupcastServer.js.map +2 -2
  101. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts +1 -1
  102. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts.map +1 -1
  103. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.d.ts +2 -0
  104. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.d.ts.map +1 -1
  105. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.js +27 -23
  106. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.js.map +1 -1
  107. package/dist/cjs/behaviors/thermostat/ThermostatServer.d.ts +15 -4
  108. package/dist/cjs/behaviors/thermostat/ThermostatServer.d.ts.map +1 -1
  109. package/dist/cjs/behaviors/thermostat/ThermostatServer.js +66 -49
  110. package/dist/cjs/behaviors/thermostat/ThermostatServer.js.map +1 -1
  111. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts +4 -4
  112. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts.map +1 -1
  113. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.js.map +1 -1
  114. package/dist/cjs/endpoint/properties/Behaviors.d.ts.map +1 -1
  115. package/dist/cjs/endpoint/properties/Behaviors.js +5 -1
  116. package/dist/cjs/endpoint/properties/Behaviors.js.map +1 -1
  117. package/dist/cjs/node/ClientNode.d.ts +6 -0
  118. package/dist/cjs/node/ClientNode.d.ts.map +1 -1
  119. package/dist/cjs/node/ClientNode.js +6 -0
  120. package/dist/cjs/node/ClientNode.js.map +1 -1
  121. package/dist/cjs/node/ServerNode.d.ts.map +1 -1
  122. package/dist/cjs/node/ServerNode.js +2 -0
  123. package/dist/cjs/node/ServerNode.js.map +1 -1
  124. package/dist/cjs/node/client/ClientEventEmitter.d.ts.map +1 -1
  125. package/dist/cjs/node/client/ClientEventEmitter.js +6 -2
  126. package/dist/cjs/node/client/ClientEventEmitter.js.map +1 -1
  127. package/dist/cjs/node/client/ClientStructure.d.ts.map +1 -1
  128. package/dist/cjs/node/client/ClientStructure.js +181 -108
  129. package/dist/cjs/node/client/ClientStructure.js.map +2 -2
  130. package/dist/cjs/node/client/Peers.d.ts +3 -2
  131. package/dist/cjs/node/client/Peers.d.ts.map +1 -1
  132. package/dist/cjs/node/client/Peers.js +8 -9
  133. package/dist/cjs/node/client/Peers.js.map +1 -1
  134. package/dist/cjs/node/integration/ChangeNotificationService.d.ts +14 -3
  135. package/dist/cjs/node/integration/ChangeNotificationService.d.ts.map +1 -1
  136. package/dist/cjs/node/integration/ProtocolService.d.ts.map +1 -1
  137. package/dist/cjs/node/integration/ProtocolService.js +38 -56
  138. package/dist/cjs/node/integration/ProtocolService.js.map +1 -1
  139. package/dist/cjs/node/server/InteractionServer.d.ts.map +1 -1
  140. package/dist/cjs/node/server/InteractionServer.js +28 -24
  141. package/dist/cjs/node/server/InteractionServer.js.map +2 -2
  142. package/dist/cjs/node/server/ServerSubscription.d.ts +7 -2
  143. package/dist/cjs/node/server/ServerSubscription.d.ts.map +1 -1
  144. package/dist/cjs/node/server/ServerSubscription.js +83 -47
  145. package/dist/cjs/node/server/ServerSubscription.js.map +1 -1
  146. package/dist/cjs/testing/mock-server-node.d.ts +2 -1
  147. package/dist/cjs/testing/mock-server-node.d.ts.map +1 -1
  148. package/dist/cjs/testing/mock-server-node.js +8 -5
  149. package/dist/cjs/testing/mock-server-node.js.map +2 -2
  150. package/dist/cjs/testing/node-helpers.d.ts +5 -0
  151. package/dist/cjs/testing/node-helpers.d.ts.map +1 -1
  152. package/dist/cjs/testing/node-helpers.js +4 -4
  153. package/dist/cjs/testing/node-helpers.js.map +1 -1
  154. package/dist/esm/behavior/Behavior.d.ts.map +1 -1
  155. package/dist/esm/behavior/Behavior.js +2 -0
  156. package/dist/esm/behavior/Behavior.js.map +1 -1
  157. package/dist/esm/behavior/Events.d.ts.map +1 -1
  158. package/dist/esm/behavior/Events.js +4 -2
  159. package/dist/esm/behavior/Events.js.map +1 -1
  160. package/dist/esm/behavior/cluster/ClusterBehavior.d.ts +17 -3
  161. package/dist/esm/behavior/cluster/ClusterBehavior.d.ts.map +1 -1
  162. package/dist/esm/behavior/cluster/ClusterBehavior.js +2 -20
  163. package/dist/esm/behavior/cluster/ClusterBehavior.js.map +1 -1
  164. package/dist/esm/behavior/cluster/ClusterBehaviorType.d.ts.map +1 -1
  165. package/dist/esm/behavior/cluster/ClusterBehaviorType.js +10 -159
  166. package/dist/esm/behavior/cluster/ClusterBehaviorType.js.map +1 -1
  167. package/dist/esm/behavior/internal/BehaviorBacking.d.ts.map +1 -1
  168. package/dist/esm/behavior/internal/BehaviorBacking.js +2 -0
  169. package/dist/esm/behavior/internal/BehaviorBacking.js.map +1 -1
  170. package/dist/esm/behavior/internal/ClusterDerivation.d.ts +45 -0
  171. package/dist/esm/behavior/internal/ClusterDerivation.d.ts.map +1 -0
  172. package/dist/esm/behavior/internal/ClusterDerivation.js +172 -0
  173. package/dist/esm/behavior/internal/ClusterDerivation.js.map +6 -0
  174. package/dist/esm/behavior/internal/ClusterStatics.d.ts +16 -0
  175. package/dist/esm/behavior/internal/ClusterStatics.d.ts.map +1 -0
  176. package/dist/esm/behavior/internal/ClusterStatics.js +118 -0
  177. package/dist/esm/behavior/internal/ClusterStatics.js.map +6 -0
  178. package/dist/esm/behavior/internal/ModeledState.d.ts +18 -0
  179. package/dist/esm/behavior/internal/ModeledState.d.ts.map +1 -0
  180. package/dist/esm/behavior/internal/ModeledState.js +34 -0
  181. package/dist/esm/behavior/internal/ModeledState.js.map +6 -0
  182. package/dist/esm/behavior/internal/ServerBehaviorBacking.d.ts.map +1 -1
  183. package/dist/esm/behavior/internal/ServerBehaviorBacking.js +3 -12
  184. package/dist/esm/behavior/internal/ServerBehaviorBacking.js.map +1 -1
  185. package/dist/esm/behavior/state/managed/Datasource.js +28 -17
  186. package/dist/esm/behavior/state/managed/Datasource.js.map +1 -1
  187. package/dist/esm/behavior/state/managed/Internal.d.ts +16 -5
  188. package/dist/esm/behavior/state/managed/Internal.d.ts.map +1 -1
  189. package/dist/esm/behavior/state/managed/Internal.js +23 -25
  190. package/dist/esm/behavior/state/managed/Internal.js.map +1 -1
  191. package/dist/esm/behavior/state/managed/ManagedReference.d.ts +45 -12
  192. package/dist/esm/behavior/state/managed/ManagedReference.d.ts.map +1 -1
  193. package/dist/esm/behavior/state/managed/ManagedReference.js +75 -45
  194. package/dist/esm/behavior/state/managed/ManagedReference.js.map +1 -1
  195. package/dist/esm/behavior/state/managed/ReadOnlyReference.d.ts +31 -0
  196. package/dist/esm/behavior/state/managed/ReadOnlyReference.d.ts.map +1 -0
  197. package/dist/esm/behavior/state/managed/ReadOnlyReference.js +40 -0
  198. package/dist/esm/behavior/state/managed/ReadOnlyReference.js.map +6 -0
  199. package/dist/esm/behavior/state/managed/ValReference.d.ts +47 -10
  200. package/dist/esm/behavior/state/managed/ValReference.d.ts.map +1 -1
  201. package/dist/esm/behavior/state/managed/ValReference.js +25 -0
  202. package/dist/esm/behavior/state/managed/ValReference.js.map +2 -2
  203. package/dist/esm/behavior/state/managed/values/BitmapManager.js +6 -21
  204. package/dist/esm/behavior/state/managed/values/BitmapManager.js.map +1 -1
  205. package/dist/esm/behavior/state/managed/values/ListManager.d.ts.map +1 -1
  206. package/dist/esm/behavior/state/managed/values/ListManager.js +264 -129
  207. package/dist/esm/behavior/state/managed/values/ListManager.js.map +2 -2
  208. package/dist/esm/behavior/state/managed/values/StructManager.js +15 -24
  209. package/dist/esm/behavior/state/managed/values/StructManager.js.map +2 -2
  210. package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts +13 -3
  211. package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
  212. package/dist/esm/behavior/system/commissioning/CommissioningClient.js +12 -0
  213. package/dist/esm/behavior/system/commissioning/CommissioningClient.js.map +1 -1
  214. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts +9 -1
  215. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
  216. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js +10 -1
  217. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
  218. package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts +2 -1
  219. package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
  220. package/dist/esm/behavior/system/controller/ControllerBehavior.js +2 -1
  221. package/dist/esm/behavior/system/controller/ControllerBehavior.js.map +1 -1
  222. package/dist/esm/behavior/system/dcl/DclBehavior.d.ts +3 -3
  223. package/dist/esm/behavior/system/network/ServerGroupNetworking.d.ts +2 -1
  224. package/dist/esm/behavior/system/network/ServerGroupNetworking.d.ts.map +1 -1
  225. package/dist/esm/behavior/system/network/ServerGroupNetworking.js.map +1 -1
  226. package/dist/esm/behavior/system/sessions/SessionsBehavior.d.ts +4 -0
  227. package/dist/esm/behavior/system/sessions/SessionsBehavior.d.ts.map +1 -1
  228. package/dist/esm/behavior/system/sessions/SessionsBehavior.js +6 -1
  229. package/dist/esm/behavior/system/sessions/SessionsBehavior.js.map +1 -1
  230. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.d.ts +28 -0
  231. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.d.ts.map +1 -0
  232. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.js +54 -0
  233. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.js.map +6 -0
  234. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.d.ts +8 -3
  235. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.d.ts.map +1 -1
  236. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js +61 -30
  237. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
  238. package/dist/esm/behaviors/access-control/AccessControlServer.d.ts +2 -2
  239. package/dist/esm/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
  240. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
  241. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +43 -21
  242. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
  243. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +29 -23
  244. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
  245. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +105 -60
  246. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
  247. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts +9 -1
  248. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
  249. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js +11 -7
  250. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
  251. package/dist/esm/behaviors/groupcast/GroupcastServer.d.ts.map +1 -1
  252. package/dist/esm/behaviors/groupcast/GroupcastServer.js +42 -25
  253. package/dist/esm/behaviors/groupcast/GroupcastServer.js.map +2 -2
  254. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts +1 -1
  255. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts.map +1 -1
  256. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.d.ts +2 -0
  257. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.d.ts.map +1 -1
  258. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.js +32 -24
  259. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.js.map +1 -1
  260. package/dist/esm/behaviors/thermostat/ThermostatServer.d.ts +15 -4
  261. package/dist/esm/behaviors/thermostat/ThermostatServer.d.ts.map +1 -1
  262. package/dist/esm/behaviors/thermostat/ThermostatServer.js +66 -49
  263. package/dist/esm/behaviors/thermostat/ThermostatServer.js.map +1 -1
  264. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts +4 -4
  265. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts.map +1 -1
  266. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.js.map +1 -1
  267. package/dist/esm/endpoint/properties/Behaviors.d.ts.map +1 -1
  268. package/dist/esm/endpoint/properties/Behaviors.js +6 -2
  269. package/dist/esm/endpoint/properties/Behaviors.js.map +1 -1
  270. package/dist/esm/node/ClientNode.d.ts +6 -0
  271. package/dist/esm/node/ClientNode.d.ts.map +1 -1
  272. package/dist/esm/node/ClientNode.js +6 -0
  273. package/dist/esm/node/ClientNode.js.map +1 -1
  274. package/dist/esm/node/ServerNode.d.ts.map +1 -1
  275. package/dist/esm/node/ServerNode.js +2 -0
  276. package/dist/esm/node/ServerNode.js.map +1 -1
  277. package/dist/esm/node/client/ClientEventEmitter.d.ts.map +1 -1
  278. package/dist/esm/node/client/ClientEventEmitter.js +6 -2
  279. package/dist/esm/node/client/ClientEventEmitter.js.map +1 -1
  280. package/dist/esm/node/client/ClientStructure.d.ts.map +1 -1
  281. package/dist/esm/node/client/ClientStructure.js +181 -108
  282. package/dist/esm/node/client/ClientStructure.js.map +2 -2
  283. package/dist/esm/node/client/Peers.d.ts +3 -2
  284. package/dist/esm/node/client/Peers.d.ts.map +1 -1
  285. package/dist/esm/node/client/Peers.js +8 -10
  286. package/dist/esm/node/client/Peers.js.map +1 -1
  287. package/dist/esm/node/integration/ChangeNotificationService.d.ts +14 -3
  288. package/dist/esm/node/integration/ChangeNotificationService.d.ts.map +1 -1
  289. package/dist/esm/node/integration/ProtocolService.d.ts.map +1 -1
  290. package/dist/esm/node/integration/ProtocolService.js +40 -57
  291. package/dist/esm/node/integration/ProtocolService.js.map +1 -1
  292. package/dist/esm/node/server/InteractionServer.d.ts.map +1 -1
  293. package/dist/esm/node/server/InteractionServer.js +28 -25
  294. package/dist/esm/node/server/InteractionServer.js.map +2 -2
  295. package/dist/esm/node/server/ServerSubscription.d.ts +7 -2
  296. package/dist/esm/node/server/ServerSubscription.d.ts.map +1 -1
  297. package/dist/esm/node/server/ServerSubscription.js +83 -47
  298. package/dist/esm/node/server/ServerSubscription.js.map +1 -1
  299. package/dist/esm/testing/mock-server-node.d.ts +2 -1
  300. package/dist/esm/testing/mock-server-node.d.ts.map +1 -1
  301. package/dist/esm/testing/mock-server-node.js +16 -7
  302. package/dist/esm/testing/mock-server-node.js.map +2 -2
  303. package/dist/esm/testing/node-helpers.d.ts +5 -0
  304. package/dist/esm/testing/node-helpers.d.ts.map +1 -1
  305. package/dist/esm/testing/node-helpers.js +4 -4
  306. package/dist/esm/testing/node-helpers.js.map +1 -1
  307. package/package.json +6 -6
  308. package/src/behavior/Behavior.ts +2 -0
  309. package/src/behavior/Events.ts +6 -3
  310. package/src/behavior/cluster/ClusterBehavior.ts +22 -13
  311. package/src/behavior/cluster/ClusterBehaviorType.ts +9 -270
  312. package/src/behavior/internal/BehaviorBacking.ts +3 -0
  313. package/src/behavior/internal/ClusterDerivation.ts +295 -0
  314. package/src/behavior/internal/ClusterStatics.ts +180 -0
  315. package/src/behavior/internal/ModeledState.ts +58 -0
  316. package/src/behavior/internal/ServerBehaviorBacking.ts +3 -15
  317. package/src/behavior/state/managed/Datasource.ts +36 -21
  318. package/src/behavior/state/managed/Internal.ts +36 -33
  319. package/src/behavior/state/managed/ManagedReference.ts +120 -68
  320. package/src/behavior/state/managed/ReadOnlyReference.ts +54 -0
  321. package/src/behavior/state/managed/ValReference.ts +67 -11
  322. package/src/behavior/state/managed/values/BitmapManager.ts +6 -22
  323. package/src/behavior/state/managed/values/ListManager.ts +301 -146
  324. package/src/behavior/state/managed/values/StructManager.ts +20 -29
  325. package/src/behavior/system/commissioning/CommissioningClient.ts +22 -3
  326. package/src/behavior/system/commissioning/RemoteDescriptor.ts +17 -1
  327. package/src/behavior/system/controller/ControllerBehavior.ts +2 -1
  328. package/src/behavior/system/dcl/DclBehavior.ts +3 -3
  329. package/src/behavior/system/network/ServerGroupNetworking.ts +3 -2
  330. package/src/behavior/system/sessions/SessionsBehavior.ts +8 -2
  331. package/src/behavior/system/subscriptions/SubscriptionStore.ts +66 -0
  332. package/src/behavior/system/subscriptions/SubscriptionsServer.ts +73 -33
  333. package/src/behaviors/access-control/AccessControlServer.ts +3 -3
  334. package/src/behaviors/administrator-commissioning/AdministratorCommissioningServer.ts +47 -24
  335. package/src/behaviors/general-diagnostics/GeneralDiagnosticsServer.ts +138 -84
  336. package/src/behaviors/group-key-management/GroupKeyManagementServer.ts +12 -8
  337. package/src/behaviors/groupcast/GroupcastServer.ts +50 -34
  338. package/src/behaviors/localization-configuration/LocalizationConfigurationServer.ts +1 -1
  339. package/src/behaviors/operational-credentials/VendorIdVerification.ts +50 -35
  340. package/src/behaviors/thermostat/ThermostatServer.ts +93 -70
  341. package/src/behaviors/time-format-localization/TimeFormatLocalizationServer.ts +4 -4
  342. package/src/endpoint/properties/Behaviors.ts +6 -2
  343. package/src/node/ClientNode.ts +6 -0
  344. package/src/node/ServerNode.ts +2 -0
  345. package/src/node/client/ClientEventEmitter.ts +7 -3
  346. package/src/node/client/ClientStructure.ts +208 -135
  347. package/src/node/client/Peers.ts +10 -14
  348. package/src/node/integration/ChangeNotificationService.ts +18 -3
  349. package/src/node/integration/ProtocolService.ts +45 -57
  350. package/src/node/server/InteractionServer.ts +33 -35
  351. package/src/node/server/ServerSubscription.ts +88 -50
  352. package/src/testing/mock-server-node.ts +22 -9
  353. package/src/testing/node-helpers.ts +5 -1
@@ -27,6 +27,7 @@ import {
27
27
  Fabric,
28
28
  FabricManager,
29
29
  GroupMessageEventInfo,
30
+ GroupMessageRejection,
30
31
  IANA_GROUPCAST_MULTICAST_ADDRESS,
31
32
  SessionManager,
32
33
  } from "@matter/protocol";
@@ -262,7 +263,7 @@ export class GroupcastServer extends GroupcastBase {
262
263
  const existing = gkm.state.groupTable.find(g => g.fabricIndex === fabricIndex && g.groupId === groupId);
263
264
  // Snapshot: removeEndpoint mutates the live groupTable endpoints array, which would corrupt this loop.
264
265
  const existingEndpoints = [...(existing?.endpoints ?? [])];
265
- const groupName = existing?.groupName ?? "";
266
+ const groupName = existing?.groupName;
266
267
  const target = replaceEndpoints ? endpoints : [...new Set([...existingEndpoints, ...endpoints])];
267
268
  keepsSenderOnly = target.length === 0 && existingEndpoints.length > 0;
268
269
  for (const ep of existingEndpoints) {
@@ -459,50 +460,65 @@ export class GroupcastServer extends GroupcastBase {
459
460
  return;
460
461
  }
461
462
 
462
- // Messages that name a fabric (authenticated, or authenticated by an unmapped key set) report only for the
463
- // fabric under test. Other decode failures are unauthenticated and are reported on the fabric under test per
464
- // the GroupcastTesting spec.
465
- if (info.fabric !== undefined && info.fabric.fabricIndex !== fabricUnderTest) {
463
+ if (info.kind === "authenticated") {
464
+ if (info.fabric.fabricIndex !== fabricUnderTest) {
465
+ return;
466
+ }
467
+ const { result, groupId, endpointId, clusterId, elementId, accessAllowed, sourceIp } = info;
468
+ this.#emitGroupcastTesting(fabricUnderTest, sourceIp, this.#arrivalAddress(fabricUnderTest, groupId), {
469
+ groupcastTestResult: result,
470
+ groupId,
471
+ endpointId,
472
+ clusterId,
473
+ elementId,
474
+ accessAllowed,
475
+ });
466
476
  return;
467
477
  }
468
478
 
469
- // The datagram destination is not available from the socket, so derive the multicast group address the
470
- // message was received on from the group id (the header group id for unauthenticated failures). An unknown
471
- // group's datagram can only have arrived via the shared IANA address, since per-group addresses are joined
472
- // per known group.
473
- let destIp: string | undefined;
474
- const groupIdForAddress = info.groupId ?? info.headerGroupId;
475
- if (groupIdForAddress !== undefined) {
476
- const known = this.state.membership.some(
477
- m => m.fabricIndex === fabricUnderTest && m.groupId === groupIdForAddress,
478
- );
479
- const fabrics = this.env.get(FabricManager);
480
- if (known && fabrics.has(fabricUnderTest)) {
481
- destIp = fabrics.for(fabricUnderTest).groups.multicastAddressFor(groupIdForAddress);
482
- } else {
483
- destIp = IANA_GROUPCAST_MULTICAST_ADDRESS;
484
- }
485
- }
486
- // Without any group knowledge (privacy-obfuscated header and no authenticating key set) the IANA address
487
- // remains the only plausible arrival address
488
- destIp ??= IANA_GROUPCAST_MULTICAST_ADDRESS;
479
+ // As in the CHIP SDK, a message for which no candidate key passed is reported on the fabric under test, without
480
+ // its group id
481
+ const { group, sourceIp } = info;
482
+ this.#emitGroupcastTesting(
483
+ fabricUnderTest,
484
+ sourceIp,
485
+ this.#arrivalAddress(group?.fabricIndex ?? fabricUnderTest, group?.groupId),
486
+ { groupcastTestResult: GroupMessageRejection.resultFor(info, fabricUnderTest) },
487
+ );
488
+ }
489
489
 
490
+ #emitGroupcastTesting(
491
+ fabricIndex: FabricIndex,
492
+ sourceIp: string | undefined,
493
+ destinationIp: string,
494
+ details: Omit<Groupcast.GroupcastTestingEvent, "sourceIpAddress" | "destinationIpAddress" | "fabricIndex">,
495
+ ) {
490
496
  this.events.groupcastTesting?.emit(
491
497
  {
492
- sourceIpAddress: toIpv6EventAddress(info.sourceIp),
493
- destinationIpAddress: toIpv6EventAddress(destIp),
494
- groupId: info.groupId,
495
- endpointId: info.endpointId,
496
- clusterId: info.clusterId,
497
- elementId: info.elementId,
498
- accessAllowed: info.accessAllowed,
499
- groupcastTestResult: info.result,
500
- fabricIndex: fabricUnderTest,
498
+ ...details,
499
+ sourceIpAddress: toIpv6EventAddress(sourceIp),
500
+ destinationIpAddress: toIpv6EventAddress(destinationIp),
501
+ fabricIndex,
501
502
  },
502
503
  this.context,
503
504
  );
504
505
  }
505
506
 
507
+ /**
508
+ * The multicast address a message for the group of the owning fabric most likely arrived on. The datagram
509
+ * destination is not available from the socket, so it is derived. {@link ServerGroupNetworking} joins
510
+ * {@link FabricGroups.multicastAddressFor} of each group with an entry in {@link FabricGroups.endpoints}, so a
511
+ * message for any other group, for an unknown group or for a fabric that is gone, most likely arrived on the
512
+ * shared IANA address.
513
+ */
514
+ #arrivalAddress(owner: FabricIndex, groupId: GroupId | undefined) {
515
+ const groups = this.env.get(FabricManager).maybeFor(owner)?.groups;
516
+ if (groupId === undefined || groups === undefined || !groups.endpoints.has(groupId)) {
517
+ return IANA_GROUPCAST_MULTICAST_ADDRESS;
518
+ }
519
+ return groups.multicastAddressFor(groupId);
520
+ }
521
+
506
522
  #handleFabricDeleted(fabric: Fabric) {
507
523
  this.internal.pendingFabricCleanups.add(fabric.fabricIndex);
508
524
  this.#deriveNow();
@@ -28,6 +28,6 @@ export class LocalizationConfigurationServer extends LocalizationConfigurationBe
28
28
 
29
29
  export namespace LocalizationConfigurationServer {
30
30
  export declare const ExtensionInterface: {
31
- detectedLocale: string;
31
+ get detectedLocale(): string;
32
32
  };
33
33
  }
@@ -20,7 +20,14 @@ import {
20
20
  UnexpectedDataError,
21
21
  } from "@matter/general";
22
22
  import { Icac, Noc, PeerSet, Rcac, Vvsc } from "@matter/protocol";
23
- import { FabricId, FabricIndex, ReceivedStatusResponseError, StatusResponse, VendorId } from "@matter/types";
23
+ import {
24
+ FabricId,
25
+ FabricIndex,
26
+ ReceivedStatusResponseError,
27
+ StatusResponse,
28
+ ValidationError,
29
+ VendorId,
30
+ } from "@matter/types";
24
31
  import type { OperationalCredentials } from "@matter/types/clusters/operational-credentials";
25
32
  import { OperationalCredentialsClient } from "../operational-credentials/OperationalCredentialsClient.js";
26
33
 
@@ -163,6 +170,8 @@ export namespace VendorIdVerification {
163
170
  /**
164
171
  * Verify VendorId ownership using VID Verification protocol on pure data level
165
172
  *
173
+ * Returns `false` when a certificate the peer sent does not decode or its chain does not verify.
174
+ *
166
175
  * @see {@link MatterSpecification.v161.Core} § 6.4.10.1.
167
176
  */
168
177
  export async function verifyData(
@@ -184,38 +193,58 @@ export namespace VendorIdVerification {
184
193
  rcac,
185
194
  fabric: { vendorId: rootVendorId, vidVerificationStatement, fabricIndex },
186
195
  } = options;
187
- const {
188
- subject: { fabricId },
189
- ellipticCurvePublicKey: rootPublicKey,
190
- } = Noc.fromTlv(noc).cert;
191
-
192
- const tbs = dataToSign({
193
- fabricBindingVersion,
194
- clientChallenge,
195
- attChallenge,
196
- fabricIndex,
197
- fabric: {
198
- rootPublicKey,
199
- fabricId,
200
- rootVendorId,
201
- vidVerificationStatement,
202
- },
203
- }).signatureData;
204
196
 
197
+ let tbs: Bytes;
198
+ let vvscCert: Vvsc | undefined;
205
199
  try {
200
+ const nocCert = Noc.fromTlv(noc);
201
+ const {
202
+ subject: { fabricId },
203
+ ellipticCurvePublicKey: rootPublicKey,
204
+ } = nocCert.cert;
205
+
206
+ tbs = dataToSign({
207
+ fabricBindingVersion,
208
+ clientChallenge,
209
+ attChallenge,
210
+ fabricIndex,
211
+ fabric: {
212
+ rootPublicKey,
213
+ fabricId,
214
+ rootVendorId,
215
+ vidVerificationStatement,
216
+ },
217
+ }).signatureData;
218
+
206
219
  // Validate signature over TBS data
207
220
  await crypto.verifyEcdsa(PublicKey(rootPublicKey), tbs, new EcdsaSignature(signature));
208
221
 
209
222
  // Verify Noc cert chain using trusted root
210
223
  const rootCert = Rcac.fromTlv(rcac);
211
- const nocCert = Noc.fromTlv(noc);
212
224
  const icaCert = icac ? Icac.fromTlv(icac) : undefined;
213
225
  if (icaCert !== undefined) {
214
226
  await icaCert.verify(crypto, rootCert);
215
227
  }
216
228
  await nocCert.verify(crypto, rootCert, icaCert);
229
+
230
+ if (vidVerificationStatement && vvsc !== undefined) {
231
+ vvscCert = Vvsc.fromTlv(vvsc);
232
+ // TODO Gather and Verify the VVSC cert chain using trusted root
233
+ // Validate the path of VIDVerificationSignerCertificate using the certificates in the Operational
234
+ // Trust Anchors Schema under the expected VendorID (VID field) being verified. If
235
+ // the path is invalid (e.g. any element of the chain missing, any certificate malformed, any
236
+ // signature verification fails, etc), then the procedure terminates as failed. Only the self-
237
+ // signed certificates among the set SHALL be considered as trust anchors during certificate
238
+ // path validation. The path length SHALL NOT be longer than 3. The verifier MAY
239
+ // apply knowledge of revoked entities obtained from outside the Distributed Compliance
240
+ // Ledger.
241
+ await vvscCert.verify(crypto);
242
+ }
217
243
  } catch (error) {
218
- CryptoError.accept(error);
244
+ // TLV the peer sent that does not decode, such as a repeated or missing field, fails the verification
245
+ if (!(error instanceof UnexpectedDataError || error instanceof ValidationError)) {
246
+ CryptoError.accept(error);
247
+ }
219
248
  logger.warn("Could not verify VendorId: certificate chain verification failed", error);
220
249
  return false;
221
250
  }
@@ -231,10 +260,7 @@ export namespace VendorIdVerification {
231
260
  throw new UnexpectedDataError("VID Verification Statement is missing signature");
232
261
  }
233
262
 
234
- let vvscCert: Vvsc;
235
- if (vvsc !== undefined) {
236
- vvscCert = Vvsc.fromTlv(vvsc);
237
- } else {
263
+ if (vvscCert === undefined) {
238
264
  // TODO Fetch VVSC from DCL if needed
239
265
  // Otherwise, look up the entry in the Operational Trust Anchors Schema
240
266
  // under the expected VendorID (VID field) being verified whose IsVIDVerificationSigner
@@ -253,17 +279,6 @@ export namespace VendorIdVerification {
253
279
  );
254
280
  }
255
281
 
256
- // TODO Gather and Verify the VVSC cert chain using trusted root
257
- // Validate the path of VIDVerificationSignerCertificate using the certificates in the Operational
258
- // Trust Anchors Schema under the expected VendorID (VID field) being verified. If
259
- // the path is invalid (e.g. any element of the chain missing, any certificate malformed, any
260
- // signature verification fails, etc), then the procedure terminates as failed. Only the self-
261
- // signed certificates among the set SHALL be considered as trust anchors during certificate
262
- // path validation. The path length SHALL NOT be longer than 3. The verifier MAY
263
- // apply knowledge of revoked entities obtained from outside the Distributed Compliance
264
- // Ledger.
265
- await vvscCert.verify(crypto);
266
-
267
282
  const ourStatement = createStatementBytes({
268
283
  version: vidStatementVersion,
269
284
  fabricBindingMessage: tbs,
@@ -1292,16 +1292,32 @@ export class ThermostatBaseServer extends ThermostatBehaviorLogicBase {
1292
1292
 
1293
1293
  /**
1294
1294
  * A stored write is already applied when validation runs, so the presets it replaces are the baseline.
1295
+ *
1296
+ * Pre-commit announces the presets again after any change in flight, with the previous announcement as
1297
+ * `oldPresets`. Every announcement is therefore validated against the presets the first announcement of the
1298
+ * transaction replaces.
1299
+ *
1300
+ * Once initialized, the presets stay stored: a transaction that leaves `persistedPresets` undefined fails with an
1301
+ * {@link ImplementationError}.
1295
1302
  */
1296
1303
  #handlePersistedPresetsChanging(
1297
- newPresets: Thermostat.Preset[],
1304
+ newPresets: Thermostat.Preset[] | undefined,
1298
1305
  oldPresets: Thermostat.Preset[] | undefined,
1299
1306
  context: ActionContext,
1300
1307
  ) {
1308
+ if (newPresets === undefined) {
1309
+ throw new ImplementationError(
1310
+ `Cannot clear persistedPresets of ${this.endpoint}; store an empty list to remove all presets`,
1311
+ );
1312
+ }
1313
+
1301
1314
  const presets = this.#presetsIn(context);
1315
+ presets.stored ??= { presets: oldPresets };
1316
+ const storedPresets = presets.stored.presets;
1302
1317
 
1303
- this.#validatePresetWriteRequest(newPresets, oldPresets, presets.handles);
1304
- this.#normalizeAndValidatePresetCommit(newPresets, oldPresets, presets.handles);
1318
+ this.#validatePresetWriteRequest(newPresets, storedPresets, presets.handles);
1319
+ this.#normalizePresets(newPresets, storedPresets, presets.handles);
1320
+ this.#validatePresetCommit(newPresets, storedPresets);
1305
1321
 
1306
1322
  if (!presets.validatesOnceSettled) {
1307
1323
  context.transaction.addParticipants({
@@ -1329,8 +1345,12 @@ export class ThermostatBaseServer extends ThermostatBehaviorLogicBase {
1329
1345
  * What this behavior did to the presets of the transaction in context.
1330
1346
  *
1331
1347
  * `handles` are the ones this device issued. Normalization mutates the value in flight, so pre-commit announces
1332
- * the presets again, and an atomic write stores what it staged; both carry handles the baseline predates. Every
1333
- * announcement is still validated - the handles are what the client did not supply.
1348
+ * the presets again, and an atomic write stores what it staged; both carry handles the stored presets do not carry.
1349
+ * Every announcement is still validated - the handles are what the client did not supply.
1350
+ *
1351
+ * `stored` holds the presets the transaction replaces, as the first announcement reports them. Later announcements
1352
+ * report the value in flight as the old value instead. `stored` wraps the presets because they are undefined
1353
+ * while the behavior seeds them, and that first announcement still counts as recorded.
1334
1354
  *
1335
1355
  * `validatesOnceSettled` records that the transaction will check the settled presets. An observer that puts back
1336
1356
  * exactly the value it was handed leaves pre-commit nothing to announce, so a revert of the handle this device
@@ -1367,8 +1387,6 @@ export class ThermostatBaseServer extends ThermostatBehaviorLogicBase {
1367
1387
  const oldPresetsMap = new Map<string, Thermostat.Preset>();
1368
1388
  if (oldPresets !== undefined) {
1369
1389
  for (const preset of oldPresets) {
1370
- // Pre-commit announces the presets again after normalization, so the value this one replaces is the
1371
- // one a client wrote, where a preset it is adding carries no handle yet
1372
1390
  if (preset.presetHandle !== null) {
1373
1391
  oldPresetsMap.set(Bytes.toHex(preset.presetHandle), preset);
1374
1392
  }
@@ -1484,14 +1502,12 @@ export class ThermostatBaseServer extends ThermostatBehaviorLogicBase {
1484
1502
  }
1485
1503
 
1486
1504
  /**
1487
- * Handles additional validation of preset changes when all chunks were written in an atomic write operation.
1505
+ * Refuses a commit that removes a built-in preset or the active preset, once every attribute of the atomic write is
1506
+ * staged, so the failure names the presets attribute. The staged value is a copy the store does not keep, so it is
1507
+ * checked, not normalized; pre-commit normalizes the stored value.
1488
1508
  */
1489
- #handlePresetsAtomicChanged(
1490
- newPresets: Thermostat.Preset[],
1491
- oldPresets: Thermostat.Preset[] | undefined,
1492
- context: ActionContext,
1493
- ) {
1494
- this.#normalizeAndValidatePresetCommit(newPresets, oldPresets, this.#presetsIn(context).handles);
1509
+ #handlePresetsAtomicChanged(newPresets: Thermostat.Preset[], oldPresets: Thermostat.Preset[] | undefined) {
1510
+ this.#validatePresetCommit(newPresets, oldPresets);
1495
1511
  }
1496
1512
 
1497
1513
  /**
@@ -1503,71 +1519,49 @@ export class ThermostatBaseServer extends ThermostatBehaviorLogicBase {
1503
1519
  }
1504
1520
 
1505
1521
  /**
1506
- * Assigns a handle to any preset lacking one and validates the set, for both the atomic and the stored path.
1522
+ * Assigns a handle to any preset lacking one and resolves a null `builtIn` from the stored preset with that handle.
1523
+ * Normalizes in place: the report that follows reads the presets back through the attribute's accessor.
1507
1524
  */
1508
- #normalizeAndValidatePresetCommit(
1525
+ #normalizePresets(
1509
1526
  newPresets: Thermostat.Preset[],
1510
1527
  oldPresets: Thermostat.Preset[] | undefined,
1511
1528
  issuedHandles: Set<string>,
1512
1529
  ) {
1513
- if (oldPresets === undefined) {
1514
- logger.debug(
1515
- "Old presets is undefined, skipping some checks. This should only happen on setup of the behavior.",
1516
- );
1517
- }
1518
-
1519
1530
  const entropy = this.endpoint.env.get(Entropy);
1520
- const newPresetHandles = new Set<string>();
1521
1531
 
1522
- // Normalized in place: the report that follows reads these back through the attribute's accessor
1523
1532
  for (const preset of newPresets) {
1524
1533
  if (preset.presetHandle == null) {
1525
1534
  logger.debug("Preset is missing presetHandle, generating a new one");
1526
1535
  preset.presetHandle = entropy.randomBytes(16);
1527
1536
  issuedHandles.add(Bytes.toHex(preset.presetHandle));
1528
1537
  }
1529
- newPresetHandles.add(Bytes.toHex(preset.presetHandle));
1530
- if (oldPresets === undefined) {
1531
- if (preset.builtIn === null) {
1532
- preset.builtIn = false;
1533
- }
1534
- } else {
1535
- if (preset.builtIn === null) {
1536
- const oldPreset = oldPresets.find(
1537
- p =>
1538
- p.presetHandle &&
1539
- preset.presetHandle &&
1540
- Bytes.areEqual(p.presetHandle, preset.presetHandle),
1541
- );
1542
- if (oldPreset !== undefined) {
1543
- preset.builtIn = oldPreset.builtIn;
1544
- } else {
1545
- preset.builtIn = false;
1546
- }
1547
- }
1538
+ if (preset.builtIn === null) {
1539
+ const { presetHandle } = preset;
1540
+ const oldPreset = oldPresets?.find(
1541
+ p => p.presetHandle !== null && Bytes.areEqual(p.presetHandle, presetHandle),
1542
+ );
1543
+ preset.builtIn = oldPreset?.builtIn ?? false;
1548
1544
  }
1549
1545
  }
1546
+ }
1550
1547
 
1551
- const newBuildInPresets = new Set<string>();
1552
- for (const preset of newPresets) {
1553
- if (preset.builtIn) {
1554
- newBuildInPresets.add(Bytes.toHex(preset.presetHandle!));
1555
- }
1556
- }
1557
- const oldBuildInPresets = new Set<string>();
1558
- if (oldPresets !== undefined) {
1559
- for (const preset of oldPresets) {
1560
- if (preset.builtIn && preset.presetHandle !== null) {
1561
- oldBuildInPresets.add(Bytes.toHex(preset.presetHandle));
1562
- }
1548
+ /**
1549
+ * Refuses presets that drop a built-in preset or the active preset. Checks handles only, so it needs no
1550
+ * normalization: {@link #validatePresetWriteRequest} already refused a preset whose `builtIn` differs from the
1551
+ * stored one, and a preset without a handle is new.
1552
+ */
1553
+ #validatePresetCommit(newPresets: Thermostat.Preset[], oldPresets: Thermostat.Preset[] | undefined) {
1554
+ const newPresetHandles = new Set<string>();
1555
+ for (const { presetHandle } of newPresets) {
1556
+ if (presetHandle != null) {
1557
+ newPresetHandles.add(Bytes.toHex(presetHandle));
1563
1558
  }
1564
1559
  }
1565
1560
 
1566
- // Ensure built-in presets are not removed
1567
- for (const oldBuiltInPreset of oldBuildInPresets) {
1568
- if (!newBuildInPresets.has(oldBuiltInPreset)) {
1561
+ for (const { presetHandle, builtIn } of oldPresets ?? []) {
1562
+ if (builtIn && presetHandle !== null && !newPresetHandles.has(Bytes.toHex(presetHandle))) {
1569
1563
  throw new StatusResponse.ConstraintErrorError(
1570
- `Cannot remove built-in preset with presetHandle ${oldBuiltInPreset}`,
1564
+ `Cannot remove built-in preset with presetHandle ${Bytes.toHex(presetHandle)}`,
1571
1565
  );
1572
1566
  }
1573
1567
  }
@@ -1691,12 +1685,13 @@ export namespace ThermostatBaseServer {
1691
1685
  return pendingValue as Thermostat.Preset[];
1692
1686
  }
1693
1687
 
1694
- return (
1695
- state.persistedPresets ??
1696
- configuredPresets(endpoint) ??
1697
- presetsIn(thermostat.defaults) ??
1698
- []
1699
- );
1688
+ if (state.persistedPresets !== undefined) {
1689
+ return state.persistedPresets;
1690
+ }
1691
+
1692
+ const internal = endpoint.behaviors.internalsOf(ThermostatBaseServer);
1693
+ return (internal.defaultPresets ??=
1694
+ configuredPresets(endpoint) ?? presetsIn(thermostat.defaults) ?? []);
1700
1695
  },
1701
1696
 
1702
1697
  set(value: Thermostat.Preset[]) {
@@ -1727,9 +1722,21 @@ export namespace ThermostatBaseServer {
1727
1722
  Observable<[value: number, oldValue: number, context: ActionContext]>();
1728
1723
  externallyMeasuredOccupancy$Changed = Observable<[value: boolean, oldValue: boolean, context: ActionContext]>();
1729
1724
  persistedPresets$Changed =
1730
- Observable<[value: Thermostat.Preset[], oldValue: Thermostat.Preset[], context: ActionContext]>();
1725
+ Observable<
1726
+ [
1727
+ value: Thermostat.Preset[] | undefined,
1728
+ oldValue: Thermostat.Preset[] | undefined,
1729
+ context: ActionContext,
1730
+ ]
1731
+ >();
1731
1732
  persistedPresets$Changing =
1732
- Observable<[value: Thermostat.Preset[], oldValue: Thermostat.Preset[], context: ActionContext]>();
1733
+ Observable<
1734
+ [
1735
+ value: Thermostat.Preset[] | undefined,
1736
+ oldValue: Thermostat.Preset[] | undefined,
1737
+ context: ActionContext,
1738
+ ]
1739
+ >();
1733
1740
 
1734
1741
  /**
1735
1742
  * Custom event emitted when the calibrated temperature changes.
@@ -1776,13 +1783,29 @@ export namespace ThermostatBaseServer {
1776
1783
  controlSequenceOfOperation!: Thermostat.ControlSequenceOfOperation;
1777
1784
 
1778
1785
  /**
1779
- * What this behavior did to the presets of each transaction in flight: the handles it issued, which no
1780
- * baseline within that transaction carries, and whether it enlisted the check of the settled presets.
1786
+ * The presets the `presets` getter serves until `persistedPresets` is set. One copy, because a getter returns
1787
+ * the same list on every read (see {@link Val.Dynamic}).
1788
+ *
1789
+ * After initialization the getter serves it only inside a transaction that sets `persistedPresets` to
1790
+ * undefined, which cannot commit unless it stores presets again.
1791
+ */
1792
+ defaultPresets?: Thermostat.Preset[];
1793
+
1794
+ /**
1795
+ * What this behavior did to the presets of each transaction in flight: the handles it issued, the presets the
1796
+ * transaction replaces, and whether it enlisted the check of the settled presets.
1781
1797
  *
1782
1798
  * Several transactions reach one endpoint at a time: an atomic write announces its staged presets before it
1783
1799
  * takes any lock.
1784
1800
  */
1785
- presetTransactions = new WeakMap<Transaction, { handles: Set<string>; validatesOnceSettled?: boolean }>();
1801
+ presetTransactions = new WeakMap<
1802
+ Transaction,
1803
+ {
1804
+ handles: Set<string>;
1805
+ stored?: { presets: Thermostat.Preset[] | undefined };
1806
+ validatesOnceSettled?: boolean;
1807
+ }
1808
+ >();
1786
1809
  }
1787
1810
  }
1788
1811
 
@@ -27,7 +27,7 @@ export class TimeFormatLocalizationServer extends TimeFormatLocalizationBehavior
27
27
  }
28
28
 
29
29
  /** Override this getter with own implementation to detect the hour format of the system. */
30
- get detectedHourFormat() {
30
+ get detectedHourFormat(): TimeFormatLocalization.HourFormat {
31
31
  if (Intl.DateTimeFormat(undefined, { hour: "numeric" }).resolvedOptions().hour12) {
32
32
  return TimeFormatLocalization.HourFormat["12Hr"];
33
33
  }
@@ -35,7 +35,7 @@ export class TimeFormatLocalizationServer extends TimeFormatLocalizationBehavior
35
35
  }
36
36
 
37
37
  /** Override this getter with own implementation to detect the calendar type of the system. */
38
- get detectedCalendarType() {
38
+ get detectedCalendarType(): TimeFormatLocalization.CalendarType {
39
39
  const type = Intl.DateTimeFormat().resolvedOptions().calendar;
40
40
  switch (type) {
41
41
  case "buddhist":
@@ -83,7 +83,7 @@ export class TimeFormatLocalizationServer extends TimeFormatLocalizationBehavior
83
83
 
84
84
  export namespace TimeFormatLocalizationServer {
85
85
  export declare const ExtensionInterface: {
86
- detectedHourFormat: string;
87
- detectedCalendarType: string;
86
+ get detectedHourFormat(): TimeFormatLocalization.HourFormat;
87
+ get detectedCalendarType(): TimeFormatLocalization.CalendarType;
88
88
  };
89
89
  }
@@ -28,7 +28,7 @@ import {
28
28
  Transaction,
29
29
  UnexpectedDataError,
30
30
  } from "@matter/general";
31
- import { ClusterModel } from "@matter/model";
31
+ import { ClusterModel, SecretRedaction } from "@matter/model";
32
32
  import { ClusterTypeProtocol, Val } from "@matter/protocol";
33
33
  import type { ClusterId, ClusterType } from "@matter/types";
34
34
  import type { Agent } from "../Agent.js";
@@ -148,6 +148,7 @@ export class Behaviors {
148
148
 
149
149
  if (elements.attributes.size) {
150
150
  const behaviorData = new Array<unknown>();
151
+ const attributeModels = schema instanceof ClusterModel ? schema.attributes : undefined;
151
152
  for (const attributeName of elements.attributes) {
152
153
  const attr = cluster.attributes?.[attributeName];
153
154
  if (attr) {
@@ -155,7 +156,10 @@ export class Behaviors {
155
156
  attributeName,
156
157
  Diagnostic.dict({
157
158
  id: Diagnostic.hex(attr.id),
158
- val: (backing?.stateView as Val.Struct | undefined)?.[attributeName],
159
+ val: SecretRedaction.redact(
160
+ attributeModels?.(attr.id) ?? attr.schema,
161
+ (backing?.stateView as Val.Struct | undefined)?.[attributeName],
162
+ ),
159
163
  flags: Diagnostic.asFlags({
160
164
  fabricScoped: attr.schema.fabricScoped,
161
165
  }),
@@ -350,6 +350,12 @@ export class ClientNode extends Node<ClientNode.RootEndpoint> {
350
350
  return this.#interaction;
351
351
  }
352
352
 
353
+ /**
354
+ * The peer's operational address, or `undefined` if the peer is not commissioned or its storage is not available.
355
+ *
356
+ * Reads the commissioning state when it is loaded, otherwise a cached value or storage. So it also answers for a
357
+ * node whose commissioning state failed to load.
358
+ */
353
359
  get peerAddress(): PeerAddress | undefined {
354
360
  // Whenever the commissioning backing is loaded its state is authoritative - mirror it (set or cleared)
355
361
  // so the cache cannot survive a decommission as a stale value
@@ -12,6 +12,7 @@ import { ServerNetworkRuntime } from "#behavior/system/network/ServerNetworkRunt
12
12
  import { ProductDescriptionServer } from "#behavior/system/product-description/ProductDescriptionServer.js";
13
13
  import { SessionsBehavior } from "#behavior/system/sessions/SessionsBehavior.js";
14
14
  import { SubscriptionsServer } from "#behavior/system/subscriptions/SubscriptionsServer.js";
15
+ import { SubscriptionStore } from "#behavior/system/subscriptions/SubscriptionStore.js";
15
16
  import { Endpoint } from "#endpoint/Endpoint.js";
16
17
  import { EndpointInitializer } from "#endpoint/properties/EndpointInitializer.js";
17
18
  import { ServerNodeStore } from "#storage/server/ServerNodeStore.js";
@@ -248,6 +249,7 @@ export class ServerNode<T extends ServerNode.RootEndpoint = ServerNode.RootEndpo
248
249
  () => this.env.get(SessionManager).clear(),
249
250
  () => this.env.get(FabricManager).clear(),
250
251
  () => this.env.get(OccurrenceManager).clear(),
252
+ () => this.env.get(SubscriptionStore).clear(),
251
253
  () => ServerEnvironment.eraseCredentials(this),
252
254
  () => this.env.get(ServerNodeStore).erase(),
253
255
  ],
@@ -61,12 +61,13 @@ export function ClientEventEmitter(node: ClientNode, structure: ClientStructure)
61
61
 
62
62
  const behavior = target.endpoint.behaviors.supported[names.cluster];
63
63
  if (behavior) {
64
- const { number, timestamp, priority, value } = occurrence;
64
+ const { number, timestamp, resolvedTimestamp, priority, value } = occurrence;
65
65
  const timestampKind = timestampKindOf(occurrence);
66
66
  changes.broadcastEvent(target.endpoint, behavior, target.event.schema as EventModel, {
67
67
  number,
68
68
  timestamp: timestamp as Timestamp,
69
69
  timestampKind,
70
+ resolvedTimestamp,
70
71
  priority,
71
72
  payload: value as Val.Struct | undefined,
72
73
  });
@@ -107,11 +108,14 @@ export function ClientEventEmitter(node: ClientNode, structure: ClientStructure)
107
108
  }
108
109
 
109
110
  /**
110
- * Identify which of the four timestamp variants Matter Core §10.7 defines the peer sent. Absent all of them the
111
+ * Identify which of the four timestamp variants Matter Core §10.6.9 defines the peer sent. Absent all of them the
111
112
  * occurrence carries {@link ReadResult.EventValue.timestamp} 0, which is a Posix epoch of no useful precision.
112
113
  */
113
114
  function timestampKindOf(occurrence: ReadResult.EventValue): ChangeNotificationService.TimestampKind {
114
- const { systemTimestamp, deltaEpochTimestamp, deltaSystemTimestamp } = occurrence;
115
+ const { epochTimestamp, systemTimestamp, deltaEpochTimestamp, deltaSystemTimestamp } = occurrence;
116
+ if (epochTimestamp !== undefined) {
117
+ return "epoch";
118
+ }
115
119
  if (systemTimestamp !== undefined) {
116
120
  return "system";
117
121
  }