@zwave-js/cc 14.0.0-beta.4 → 14.0.0

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 (331) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +381 -266
  2. package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
  3. package/build/cjs/cc/AssociationCC.js +669 -503
  4. package/build/cjs/cc/AssociationCC.js.map +3 -3
  5. package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
  6. package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
  7. package/build/cjs/cc/BarrierOperatorCC.js +595 -429
  8. package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
  9. package/build/cjs/cc/BasicCC.js +354 -260
  10. package/build/cjs/cc/BasicCC.js.map +3 -3
  11. package/build/cjs/cc/BatteryCC.js +427 -345
  12. package/build/cjs/cc/BatteryCC.js.map +3 -3
  13. package/build/cjs/cc/BinarySensorCC.js +391 -276
  14. package/build/cjs/cc/BinarySensorCC.js.map +3 -3
  15. package/build/cjs/cc/BinarySwitchCC.js +347 -253
  16. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  17. package/build/cjs/cc/CRC16CC.js +160 -85
  18. package/build/cjs/cc/CRC16CC.js.map +3 -3
  19. package/build/cjs/cc/CentralSceneCC.js +459 -324
  20. package/build/cjs/cc/CentralSceneCC.js.map +3 -3
  21. package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
  23. package/build/cjs/cc/ClockCC.js +254 -150
  24. package/build/cjs/cc/ClockCC.js.map +3 -3
  25. package/build/cjs/cc/ColorSwitchCC.js +758 -610
  26. package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
  27. package/build/cjs/cc/ConfigurationCC.js +1700 -1453
  28. package/build/cjs/cc/ConfigurationCC.js.map +3 -3
  29. package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
  30. package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
  31. package/build/cjs/cc/DoorLockCC.js +904 -777
  32. package/build/cjs/cc/DoorLockCC.js.map +3 -3
  33. package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
  34. package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
  35. package/build/cjs/cc/EnergyProductionCC.js +249 -160
  36. package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
  37. package/build/cjs/cc/EntryControlCC.js +619 -458
  38. package/build/cjs/cc/EntryControlCC.js.map +3 -3
  39. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
  40. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
  41. package/build/cjs/cc/HailCC.js +57 -11
  42. package/build/cjs/cc/HailCC.js.map +2 -2
  43. package/build/cjs/cc/HumidityControlModeCC.js +359 -233
  44. package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
  45. package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
  46. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
  47. package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
  48. package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
  49. package/build/cjs/cc/InclusionControllerCC.js +205 -114
  50. package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
  51. package/build/cjs/cc/IndicatorCC.js +897 -736
  52. package/build/cjs/cc/IndicatorCC.js.map +3 -3
  53. package/build/cjs/cc/IrrigationCC.js +1651 -1405
  54. package/build/cjs/cc/IrrigationCC.js.map +3 -3
  55. package/build/cjs/cc/LanguageCC.js +268 -171
  56. package/build/cjs/cc/LanguageCC.js.map +3 -3
  57. package/build/cjs/cc/LockCC.js +254 -154
  58. package/build/cjs/cc/LockCC.js.map +3 -3
  59. package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
  60. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  61. package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
  62. package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
  63. package/build/cjs/cc/MeterCC.js +827 -707
  64. package/build/cjs/cc/MeterCC.js.map +3 -3
  65. package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
  66. package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
  67. package/build/cjs/cc/MultiChannelCC.js +1037 -819
  68. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  69. package/build/cjs/cc/MultiCommandCC.js +172 -97
  70. package/build/cjs/cc/MultiCommandCC.js.map +3 -3
  71. package/build/cjs/cc/MultilevelSensorCC.js +589 -449
  72. package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
  73. package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
  74. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  75. package/build/cjs/cc/NoOperationCC.js +89 -27
  76. package/build/cjs/cc/NoOperationCC.js.map +2 -2
  77. package/build/cjs/cc/NodeNamingCC.js +417 -277
  78. package/build/cjs/cc/NodeNamingCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +972 -818
  80. package/build/cjs/cc/NotificationCC.js.map +3 -3
  81. package/build/cjs/cc/PowerlevelCC.js +450 -303
  82. package/build/cjs/cc/PowerlevelCC.js.map +3 -3
  83. package/build/cjs/cc/ProtectionCC.js +686 -494
  84. package/build/cjs/cc/ProtectionCC.js.map +3 -3
  85. package/build/cjs/cc/SceneActivationCC.js +165 -97
  86. package/build/cjs/cc/SceneActivationCC.js.map +3 -3
  87. package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
  88. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
  89. package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
  90. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
  91. package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
  92. package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
  93. package/build/cjs/cc/Security2CC.js +1483 -1219
  94. package/build/cjs/cc/Security2CC.js.map +3 -3
  95. package/build/cjs/cc/SecurityCC.js +839 -619
  96. package/build/cjs/cc/SecurityCC.js.map +3 -3
  97. package/build/cjs/cc/SoundSwitchCC.js +707 -515
  98. package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
  99. package/build/cjs/cc/SupervisionCC.js +327 -237
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
  102. package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
  103. package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
  104. package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
  105. package/build/cjs/cc/ThermostatModeCC.js +425 -302
  106. package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
  107. package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
  108. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
  109. package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
  110. package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
  111. package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.js +515 -353
  114. package/build/cjs/cc/TimeCC.js.map +3 -3
  115. package/build/cjs/cc/TimeParametersCC.js +302 -202
  116. package/build/cjs/cc/TimeParametersCC.js.map +3 -3
  117. package/build/cjs/cc/TransportServiceCC.js +433 -315
  118. package/build/cjs/cc/TransportServiceCC.js.map +3 -3
  119. package/build/cjs/cc/UserCodeCC.js +1385 -1102
  120. package/build/cjs/cc/UserCodeCC.js.map +3 -3
  121. package/build/cjs/cc/VersionCC.js +696 -562
  122. package/build/cjs/cc/VersionCC.js.map +3 -3
  123. package/build/cjs/cc/WakeUpCC.js +499 -346
  124. package/build/cjs/cc/WakeUpCC.js.map +3 -3
  125. package/build/cjs/cc/WindowCoveringCC.js +626 -478
  126. package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
  127. package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
  128. package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
  129. package/build/cjs/cc/ZWavePlusCC.js +233 -159
  130. package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
  131. package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
  132. package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
  133. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  134. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
  135. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
  136. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
  137. package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
  138. package/build/cjs/lib/CommandClassDecorators.js +19 -20
  139. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  140. package/build/cjs/lib/Security2/Extension.d.ts +1 -1
  141. package/build/cjs/lib/Security2/Extension.js +217 -126
  142. package/build/cjs/lib/Security2/Extension.js.map +3 -3
  143. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/AlarmSensorCC.js +389 -291
  145. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  146. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  147. package/build/esm/cc/AssociationCC.js +678 -537
  148. package/build/esm/cc/AssociationCC.js.map +1 -1
  149. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  150. package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
  151. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  152. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  153. package/build/esm/cc/BarrierOperatorCC.js +634 -493
  154. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  155. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  156. package/build/esm/cc/BasicCC.js +380 -302
  157. package/build/esm/cc/BasicCC.js.map +1 -1
  158. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  159. package/build/esm/cc/BatteryCC.js +449 -384
  160. package/build/esm/cc/BatteryCC.js.map +1 -1
  161. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/BinarySensorCC.js +395 -297
  163. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  164. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  165. package/build/esm/cc/BinarySwitchCC.js +353 -274
  166. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  167. package/build/esm/cc/CRC16CC.js +162 -98
  168. package/build/esm/cc/CRC16CC.js.map +1 -1
  169. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  170. package/build/esm/cc/CentralSceneCC.js +465 -351
  171. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  172. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  173. package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
  174. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  175. package/build/esm/cc/ClockCC.js +248 -159
  176. package/build/esm/cc/ClockCC.js.map +1 -1
  177. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  178. package/build/esm/cc/ColorSwitchCC.js +802 -677
  179. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  180. package/build/esm/cc/ConfigurationCC.js +1899 -1687
  181. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  182. package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
  183. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  184. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  185. package/build/esm/cc/DoorLockCC.js +951 -849
  186. package/build/esm/cc/DoorLockCC.js.map +1 -1
  187. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  188. package/build/esm/cc/DoorLockLoggingCC.js +316 -218
  189. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  190. package/build/esm/cc/EnergyProductionCC.js +240 -164
  191. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  192. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  193. package/build/esm/cc/EntryControlCC.js +629 -493
  194. package/build/esm/cc/EntryControlCC.js.map +1 -1
  195. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  196. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
  197. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  198. package/build/esm/cc/HailCC.js +51 -12
  199. package/build/esm/cc/HailCC.js.map +1 -1
  200. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  201. package/build/esm/cc/HumidityControlModeCC.js +357 -250
  202. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  203. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  204. package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
  205. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  206. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  207. package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
  208. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  209. package/build/esm/cc/InclusionControllerCC.js +197 -119
  210. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  211. package/build/esm/cc/IndicatorCC.js +973 -835
  212. package/build/esm/cc/IndicatorCC.js.map +1 -1
  213. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  214. package/build/esm/cc/IrrigationCC.js +1697 -1496
  215. package/build/esm/cc/IrrigationCC.js.map +1 -1
  216. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  217. package/build/esm/cc/LanguageCC.js +266 -184
  218. package/build/esm/cc/LanguageCC.js.map +1 -1
  219. package/build/esm/cc/LockCC.d.ts.map +1 -1
  220. package/build/esm/cc/LockCC.js +247 -162
  221. package/build/esm/cc/LockCC.js.map +1 -1
  222. package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
  223. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  224. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  225. package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
  226. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  227. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  228. package/build/esm/cc/MeterCC.js +896 -795
  229. package/build/esm/cc/MeterCC.js.map +1 -1
  230. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  231. package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
  232. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  233. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  234. package/build/esm/cc/MultiChannelCC.js +1106 -921
  235. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  236. package/build/esm/cc/MultiCommandCC.js +166 -102
  237. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  238. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  239. package/build/esm/cc/MultilevelSensorCC.js +616 -497
  240. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  241. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/MultilevelSwitchCC.js +621 -496
  243. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  244. package/build/esm/cc/NoOperationCC.js +82 -29
  245. package/build/esm/cc/NoOperationCC.js.map +1 -1
  246. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  247. package/build/esm/cc/NodeNamingCC.js +413 -294
  248. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  249. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  250. package/build/esm/cc/NotificationCC.js +1097 -966
  251. package/build/esm/cc/NotificationCC.js.map +1 -1
  252. package/build/esm/cc/PowerlevelCC.js +437 -311
  253. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  254. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  255. package/build/esm/cc/ProtectionCC.js +704 -543
  256. package/build/esm/cc/ProtectionCC.js.map +1 -1
  257. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  258. package/build/esm/cc/SceneActivationCC.js +157 -100
  259. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  260. package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
  261. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  262. package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
  263. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  264. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  265. package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
  266. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  267. package/build/esm/cc/Security2CC.js +1633 -1406
  268. package/build/esm/cc/Security2CC.js.map +1 -1
  269. package/build/esm/cc/SecurityCC.js +876 -687
  270. package/build/esm/cc/SecurityCC.js.map +1 -1
  271. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  272. package/build/esm/cc/SoundSwitchCC.js +689 -526
  273. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  274. package/build/esm/cc/SupervisionCC.js +349 -272
  275. package/build/esm/cc/SupervisionCC.js.map +1 -1
  276. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  277. package/build/esm/cc/ThermostatFanModeCC.js +388 -284
  278. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  279. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  280. package/build/esm/cc/ThermostatFanStateCC.js +184 -111
  281. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  282. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  283. package/build/esm/cc/ThermostatModeCC.js +435 -331
  284. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  285. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  286. package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
  287. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  288. package/build/esm/cc/ThermostatSetbackCC.js +274 -185
  289. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  290. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  291. package/build/esm/cc/ThermostatSetpointCC.js +674 -543
  292. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  293. package/build/esm/cc/TimeCC.js +499 -360
  294. package/build/esm/cc/TimeCC.js.map +1 -1
  295. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  296. package/build/esm/cc/TimeParametersCC.js +296 -211
  297. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  298. package/build/esm/cc/TransportServiceCC.js +464 -363
  299. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  300. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  301. package/build/esm/cc/UserCodeCC.js +1443 -1205
  302. package/build/esm/cc/UserCodeCC.js.map +1 -1
  303. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  304. package/build/esm/cc/VersionCC.js +744 -635
  305. package/build/esm/cc/VersionCC.js.map +1 -1
  306. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  307. package/build/esm/cc/WakeUpCC.js +494 -364
  308. package/build/esm/cc/WakeUpCC.js.map +1 -1
  309. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  310. package/build/esm/cc/WindowCoveringCC.js +655 -530
  311. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  312. package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
  313. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
  314. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  315. package/build/esm/cc/ZWavePlusCC.js +223 -162
  316. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  317. package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
  318. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  319. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  320. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  321. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
  322. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  323. package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
  324. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  325. package/build/esm/lib/CommandClassDecorators.js +24 -24
  326. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  327. package/build/esm/lib/Security2/Extension.d.ts +1 -1
  328. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  329. package/build/esm/lib/Security2/Extension.js +207 -123
  330. package/build/esm/lib/Security2/Extension.js.map +1 -1
  331. package/package.json +6 -6
@@ -45,13 +45,45 @@ var import_Types = require("../lib/_Types.js");
45
45
  var import_CRC16CC = require("./CRC16CC.js");
46
46
  var import_Security2CC = require("./Security2CC.js");
47
47
  var import_TransportServiceCC = require("./TransportServiceCC.js");
48
- var __decorate = function(decorators, target, key, desc) {
49
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
50
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
51
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
52
- return c > 3 && r && Object.defineProperty(target, key, r), r;
48
+ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
49
+ function accept(f) {
50
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
51
+ return f;
52
+ }
53
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
54
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
55
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
56
+ var _, done = false;
57
+ for (var i = decorators.length - 1; i >= 0; i--) {
58
+ var context = {};
59
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
60
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
61
+ context.addInitializer = function(f) {
62
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
63
+ extraInitializers.push(accept(f || null));
64
+ };
65
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
66
+ if (kind === "accessor") {
67
+ if (result === void 0) continue;
68
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
69
+ if (_ = accept(result.get)) descriptor.get = _;
70
+ if (_ = accept(result.set)) descriptor.set = _;
71
+ if (_ = accept(result.init)) initializers.unshift(_);
72
+ } else if (_ = accept(result)) {
73
+ if (kind === "field") initializers.unshift(_);
74
+ else descriptor[key] = _;
75
+ }
76
+ }
77
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
78
+ done = true;
79
+ };
80
+ var __runInitializers = function(thisArg, initializers, value) {
81
+ var useValue = arguments.length > 2;
82
+ for (var i = 0; i < initializers.length; i++) {
83
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
84
+ }
85
+ return useValue ? value : void 0;
53
86
  };
54
- var SecurityCC_1, SecurityCCNonceReport_1, SecurityCCCommandEncapsulation_1, SecurityCCSchemeReport_1, SecurityCCNetworkKeySet_1, SecurityCCCommandsSupportedReport_1;
55
87
  function getAuthenticationData(senderNonce, receiverNonce, ccCommand, sendingNodeId, receivingNodeId, encryptedPayload) {
56
88
  return import_safe.Bytes.concat([
57
89
  senderNonce,
@@ -88,656 +120,844 @@ function assertSecurityTX(ctx) {
88
120
  throw new import_core.ZWaveError(`Secure commands (S0) can only be sent when the security manager is set up!`, import_core.ZWaveErrorCodes.Driver_NoSecurity);
89
121
  }
90
122
  }
91
- let SecurityCCAPI = class SecurityCCAPI2 extends import_API.PhysicalCCAPI {
92
- supportsCommand(_cmd) {
93
- return true;
94
- }
95
- async sendEncapsulated(encapsulated, requestNextNonce = false) {
96
- if (requestNextNonce) {
97
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandEncapsulation);
98
- } else {
99
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandEncapsulationNonceGet);
100
- }
101
- const cc = new (requestNextNonce ? SecurityCCCommandEncapsulationNonceGet : SecurityCCCommandEncapsulation)({
102
- nodeId: this.endpoint.nodeId,
103
- encapsulated
104
- });
105
- await this.host.sendCommand(cc, this.commandOptions);
106
- }
107
- /**
108
- * Requests a new nonce for Security CC encapsulation which is not directly linked to a specific command.
109
- */
110
- async getNonce() {
111
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NonceGet);
112
- const cc = new SecurityCCNonceGet({
113
- nodeId: this.endpoint.nodeId,
114
- endpointIndex: this.endpoint.index
115
- });
116
- const response = await this.host.sendCommand(cc, {
117
- ...this.commandOptions,
118
- // Only try getting a nonce once
119
- maxSendAttempts: 1
120
- });
121
- if (!response)
122
- return;
123
- const nonce = response.nonce;
124
- const secMan = this.host.securityManager;
125
- secMan.setNonce({
126
- issuer: this.endpoint.nodeId,
127
- nonceId: secMan.getNonceId(nonce)
128
- }, { nonce, receiver: this.host.ownNodeId }, { free: true });
129
- return nonce;
130
- }
131
- /**
132
- * Responds to a NonceGet request. The message is sent without any retransmission etc.
133
- * The return value indicates whether a nonce was successfully sent
134
- */
135
- async sendNonce() {
136
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NonceReport);
137
- if (!this.host.securityManager) {
138
- throw new import_core.ZWaveError(`Nonces can only be sent if secure communication is set up!`, import_core.ZWaveErrorCodes.Driver_NoSecurity);
139
- }
140
- const nonce = this.host.securityManager.generateNonce(this.endpoint.nodeId, HALF_NONCE_SIZE);
141
- const nonceId = this.host.securityManager.getNonceId(nonce);
142
- const cc = new SecurityCCNonceReport({
143
- nodeId: this.endpoint.nodeId,
144
- endpointIndex: this.endpoint.index,
145
- nonce
146
- });
147
- try {
148
- await this.host.sendCommand(cc, {
149
- ...this.commandOptions,
150
- // Seems we need these options or some nodes won't accept the nonce
151
- transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
152
- // Only try sending a nonce once
153
- maxSendAttempts: 1,
154
- // Nonce requests must be handled immediately
155
- priority: import_core.MessagePriority.Immediate,
156
- // We don't want failures causing us to treat the node as asleep or dead
157
- changeNodeStatusOnMissingACK: false
158
- });
159
- } catch (e) {
160
- if ((0, import_core.isTransmissionError)(e)) {
161
- this.host.securityManager.deleteNonce(nonceId);
162
- return false;
123
+ let SecurityCCAPI = (() => {
124
+ let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses.Security)];
125
+ let _classDescriptor;
126
+ let _classExtraInitializers = [];
127
+ let _classThis;
128
+ let _classSuper = import_API.PhysicalCCAPI;
129
+ var SecurityCCAPI2 = class extends _classSuper {
130
+ static {
131
+ _classThis = this;
132
+ }
133
+ static {
134
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
135
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
136
+ SecurityCCAPI2 = _classThis = _classDescriptor.value;
137
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
138
+ __runInitializers(_classThis, _classExtraInitializers);
139
+ }
140
+ supportsCommand(_cmd) {
141
+ return true;
142
+ }
143
+ async sendEncapsulated(encapsulated, requestNextNonce = false) {
144
+ if (requestNextNonce) {
145
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandEncapsulation);
163
146
  } else {
164
- throw e;
147
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandEncapsulationNonceGet);
165
148
  }
149
+ const cc = new (requestNextNonce ? SecurityCCCommandEncapsulationNonceGet : SecurityCCCommandEncapsulation)({
150
+ nodeId: this.endpoint.nodeId,
151
+ encapsulated
152
+ });
153
+ await this.host.sendCommand(cc, this.commandOptions);
166
154
  }
167
- return true;
168
- }
169
- async getSecurityScheme() {
170
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.SchemeGet);
171
- const cc = new SecurityCCSchemeGet({
172
- nodeId: this.endpoint.nodeId,
173
- endpointIndex: this.endpoint.index
174
- });
175
- await this.host.sendCommand(cc, this.commandOptions);
176
- return [0];
177
- }
178
- async reportSecurityScheme(encapsulated) {
179
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.SchemeReport);
180
- let cc = new SecurityCCSchemeReport({
181
- nodeId: this.endpoint.nodeId,
182
- endpointIndex: this.endpoint.index
183
- });
184
- if (encapsulated) {
185
- cc = new SecurityCCCommandEncapsulation({
155
+ /**
156
+ * Requests a new nonce for Security CC encapsulation which is not directly linked to a specific command.
157
+ */
158
+ async getNonce() {
159
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NonceGet);
160
+ const cc = new SecurityCCNonceGet({
161
+ nodeId: this.endpoint.nodeId,
162
+ endpointIndex: this.endpoint.index
163
+ });
164
+ const response = await this.host.sendCommand(cc, {
165
+ ...this.commandOptions,
166
+ // Only try getting a nonce once
167
+ maxSendAttempts: 1
168
+ });
169
+ if (!response)
170
+ return;
171
+ const nonce = response.nonce;
172
+ const secMan = this.host.securityManager;
173
+ secMan.setNonce({
174
+ issuer: this.endpoint.nodeId,
175
+ nonceId: secMan.getNonceId(nonce)
176
+ }, { nonce, receiver: this.host.ownNodeId }, { free: true });
177
+ return nonce;
178
+ }
179
+ /**
180
+ * Responds to a NonceGet request. The message is sent without any retransmission etc.
181
+ * The return value indicates whether a nonce was successfully sent
182
+ */
183
+ async sendNonce() {
184
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NonceReport);
185
+ if (!this.host.securityManager) {
186
+ throw new import_core.ZWaveError(`Nonces can only be sent if secure communication is set up!`, import_core.ZWaveErrorCodes.Driver_NoSecurity);
187
+ }
188
+ const nonce = this.host.securityManager.generateNonce(this.endpoint.nodeId, HALF_NONCE_SIZE);
189
+ const nonceId = this.host.securityManager.getNonceId(nonce);
190
+ const cc = new SecurityCCNonceReport({
186
191
  nodeId: this.endpoint.nodeId,
187
192
  endpointIndex: this.endpoint.index,
188
- encapsulated: cc
193
+ nonce
189
194
  });
195
+ try {
196
+ await this.host.sendCommand(cc, {
197
+ ...this.commandOptions,
198
+ // Seems we need these options or some nodes won't accept the nonce
199
+ transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
200
+ // Only try sending a nonce once
201
+ maxSendAttempts: 1,
202
+ // Nonce requests must be handled immediately
203
+ priority: import_core.MessagePriority.Immediate,
204
+ // We don't want failures causing us to treat the node as asleep or dead
205
+ changeNodeStatusOnMissingACK: false
206
+ });
207
+ } catch (e) {
208
+ if ((0, import_core.isTransmissionError)(e)) {
209
+ this.host.securityManager.deleteNonce(nonceId);
210
+ return false;
211
+ } else {
212
+ throw e;
213
+ }
214
+ }
215
+ return true;
190
216
  }
191
- await this.host.sendCommand(cc, this.commandOptions);
192
- }
193
- async inheritSecurityScheme() {
194
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.SchemeInherit);
195
- const cc = new SecurityCCSchemeInherit({
196
- nodeId: this.endpoint.nodeId,
197
- endpointIndex: this.endpoint.index
198
- });
199
- await this.host.sendCommand(cc, this.commandOptions);
200
- }
201
- async setNetworkKey(networkKey) {
202
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NetworkKeySet);
203
- const keySet = new SecurityCCNetworkKeySet({
204
- nodeId: this.endpoint.nodeId,
205
- endpointIndex: this.endpoint.index,
206
- networkKey
207
- });
208
- const cc = new SecurityCCCommandEncapsulation({
209
- nodeId: this.endpoint.nodeId,
210
- endpointIndex: this.endpoint.index,
211
- encapsulated: keySet,
212
- alternativeNetworkKey: new Uint8Array(16).fill(0)
213
- });
214
- await this.host.sendCommand(cc, this.commandOptions);
215
- }
216
- async verifyNetworkKey() {
217
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NetworkKeyVerify);
218
- const cc = new SecurityCCNetworkKeyVerify({
219
- nodeId: this.endpoint.nodeId,
220
- endpointIndex: this.endpoint.index
221
- });
222
- await this.host.sendCommand(cc, this.commandOptions);
223
- }
224
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
225
- async getSupportedCommands() {
226
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandsSupportedGet);
227
- const cc = new SecurityCCCommandsSupportedGet({
228
- nodeId: this.endpoint.nodeId,
229
- endpointIndex: this.endpoint.index
230
- });
231
- const response = await this.host.sendCommand(cc, this.commandOptions);
232
- if (response) {
233
- return (0, import_safe2.pick)(response, ["supportedCCs", "controlledCCs"]);
217
+ async getSecurityScheme() {
218
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.SchemeGet);
219
+ const cc = new SecurityCCSchemeGet({
220
+ nodeId: this.endpoint.nodeId,
221
+ endpointIndex: this.endpoint.index
222
+ });
223
+ await this.host.sendCommand(cc, this.commandOptions);
224
+ return [0];
234
225
  }
235
- }
236
- async reportSupportedCommands(supportedCCs, controlledCCs) {
237
- this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandsSupportedReport);
238
- const cc = new SecurityCCCommandsSupportedReport({
239
- nodeId: this.endpoint.nodeId,
240
- endpointIndex: this.endpoint.index,
241
- supportedCCs,
242
- controlledCCs,
243
- reportsToFollow: 0
244
- });
245
- await this.host.sendCommand(cc, this.commandOptions);
246
- }
247
- };
248
- SecurityCCAPI = __decorate([
249
- (0, import_CommandClassDecorators.API)(import_core.CommandClasses.Security)
250
- ], SecurityCCAPI);
251
- let SecurityCC = SecurityCC_1 = class SecurityCC2 extends import_CommandClass.CommandClass {
252
- async interview(ctx) {
253
- const node = this.getNode(ctx);
254
- const endpoint = this.getEndpoint(ctx);
255
- const api = import_API.CCAPI.create(import_core.CommandClasses.Security, ctx, endpoint).withOptions({
256
- priority: import_core.MessagePriority.NodeQuery
257
- });
258
- ctx.logNode(node.id, {
259
- message: "Querying securely supported commands (S0)...",
260
- direction: "outbound"
261
- });
262
- let supportedCCs;
263
- let controlledCCs;
264
- const MAX_ATTEMPTS = this.endpointIndex === 0 ? 3 : 1;
265
- for (let attempts = 1; attempts <= MAX_ATTEMPTS; attempts++) {
266
- const resp = await api.getSupportedCommands();
267
- if (resp) {
268
- supportedCCs = resp.supportedCCs;
269
- controlledCCs = resp.controlledCCs;
270
- break;
271
- } else if (attempts < MAX_ATTEMPTS) {
272
- ctx.logNode(node.id, {
273
- endpoint: this.endpointIndex,
274
- message: `Querying securely supported commands (S0), attempt ${attempts}/${MAX_ATTEMPTS} failed. Retrying in 500ms...`,
275
- level: "warn"
226
+ async reportSecurityScheme(encapsulated) {
227
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.SchemeReport);
228
+ let cc = new SecurityCCSchemeReport({
229
+ nodeId: this.endpoint.nodeId,
230
+ endpointIndex: this.endpoint.index
231
+ });
232
+ if (encapsulated) {
233
+ cc = new SecurityCCCommandEncapsulation({
234
+ nodeId: this.endpoint.nodeId,
235
+ endpointIndex: this.endpoint.index,
236
+ encapsulated: cc
276
237
  });
277
- await (0, import_async.wait)(500);
278
238
  }
239
+ await this.host.sendCommand(cc, this.commandOptions);
279
240
  }
280
- if (!supportedCCs || !controlledCCs) {
281
- if (node.hasSecurityClass(import_core.SecurityClass.S0_Legacy) === true) {
282
- ctx.logNode(node.id, {
283
- endpoint: this.endpointIndex,
284
- message: "Querying securely supported commands (S0) failed",
285
- level: "warn"
286
- });
287
- } else {
288
- ctx.logNode(node.id, `The node was not granted the S0 security class. Continuing interview non-securely.`);
289
- node.setSecurityClass(import_core.SecurityClass.S0_Legacy, false);
241
+ async inheritSecurityScheme() {
242
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.SchemeInherit);
243
+ const cc = new SecurityCCSchemeInherit({
244
+ nodeId: this.endpoint.nodeId,
245
+ endpointIndex: this.endpoint.index
246
+ });
247
+ await this.host.sendCommand(cc, this.commandOptions);
248
+ }
249
+ async setNetworkKey(networkKey) {
250
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NetworkKeySet);
251
+ const keySet = new SecurityCCNetworkKeySet({
252
+ nodeId: this.endpoint.nodeId,
253
+ endpointIndex: this.endpoint.index,
254
+ networkKey
255
+ });
256
+ const cc = new SecurityCCCommandEncapsulation({
257
+ nodeId: this.endpoint.nodeId,
258
+ endpointIndex: this.endpoint.index,
259
+ encapsulated: keySet,
260
+ alternativeNetworkKey: new Uint8Array(16).fill(0)
261
+ });
262
+ await this.host.sendCommand(cc, this.commandOptions);
263
+ }
264
+ async verifyNetworkKey() {
265
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.NetworkKeyVerify);
266
+ const cc = new SecurityCCNetworkKeyVerify({
267
+ nodeId: this.endpoint.nodeId,
268
+ endpointIndex: this.endpoint.index
269
+ });
270
+ await this.host.sendCommand(cc, this.commandOptions);
271
+ }
272
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
273
+ async getSupportedCommands() {
274
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandsSupportedGet);
275
+ const cc = new SecurityCCCommandsSupportedGet({
276
+ nodeId: this.endpoint.nodeId,
277
+ endpointIndex: this.endpoint.index
278
+ });
279
+ const response = await this.host.sendCommand(cc, this.commandOptions);
280
+ if (response) {
281
+ return (0, import_safe2.pick)(response, ["supportedCCs", "controlledCCs"]);
290
282
  }
291
- return;
292
- }
293
- const logLines = [
294
- "received secure commands (S0)",
295
- "supported CCs:"
296
- ];
297
- for (const cc of supportedCCs) {
298
- logLines.push(`\xB7 ${(0, import_core.getCCName)(cc)}`);
299
- }
300
- logLines.push("controlled CCs:");
301
- for (const cc of controlledCCs) {
302
- logLines.push(`\xB7 ${(0, import_core.getCCName)(cc)}`);
303
- }
304
- ctx.logNode(node.id, {
305
- message: logLines.join("\n"),
306
- direction: "inbound"
307
- });
308
- for (const cc of supportedCCs) {
309
- if (cc === import_core.CommandClasses.Basic) {
310
- endpoint.addCC(cc, { secure: true });
311
- } else {
312
- endpoint.addCC(cc, {
313
- isSupported: true,
314
- secure: true
315
- });
283
+ }
284
+ async reportSupportedCommands(supportedCCs, controlledCCs) {
285
+ this.assertSupportsCommand(import_Types.SecurityCommand, import_Types.SecurityCommand.CommandsSupportedReport);
286
+ const cc = new SecurityCCCommandsSupportedReport({
287
+ nodeId: this.endpoint.nodeId,
288
+ endpointIndex: this.endpoint.index,
289
+ supportedCCs,
290
+ controlledCCs,
291
+ reportsToFollow: 0
292
+ });
293
+ await this.host.sendCommand(cc, this.commandOptions);
294
+ }
295
+ };
296
+ return SecurityCCAPI2 = _classThis;
297
+ })();
298
+ let SecurityCC = (() => {
299
+ let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses.Security), (0, import_CommandClassDecorators.implementedVersion)(1)];
300
+ let _classDescriptor;
301
+ let _classExtraInitializers = [];
302
+ let _classThis;
303
+ let _classSuper = import_CommandClass.CommandClass;
304
+ var SecurityCC2 = class extends _classSuper {
305
+ static {
306
+ _classThis = this;
307
+ }
308
+ static {
309
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
310
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
311
+ SecurityCC2 = _classThis = _classDescriptor.value;
312
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
313
+ __runInitializers(_classThis, _classExtraInitializers);
314
+ }
315
+ async interview(ctx) {
316
+ const node = this.getNode(ctx);
317
+ const endpoint = this.getEndpoint(ctx);
318
+ const api = import_API.CCAPI.create(import_core.CommandClasses.Security, ctx, endpoint).withOptions({
319
+ priority: import_core.MessagePriority.NodeQuery
320
+ });
321
+ ctx.logNode(node.id, {
322
+ message: "Querying securely supported commands (S0)...",
323
+ direction: "outbound"
324
+ });
325
+ let supportedCCs;
326
+ let controlledCCs;
327
+ const MAX_ATTEMPTS = this.endpointIndex === 0 ? 3 : 1;
328
+ for (let attempts = 1; attempts <= MAX_ATTEMPTS; attempts++) {
329
+ const resp = await api.getSupportedCommands();
330
+ if (resp) {
331
+ supportedCCs = resp.supportedCCs;
332
+ controlledCCs = resp.controlledCCs;
333
+ break;
334
+ } else if (attempts < MAX_ATTEMPTS) {
335
+ ctx.logNode(node.id, {
336
+ endpoint: this.endpointIndex,
337
+ message: `Querying securely supported commands (S0), attempt ${attempts}/${MAX_ATTEMPTS} failed. Retrying in 500ms...`,
338
+ level: "warn"
339
+ });
340
+ await (0, import_async.wait)(500);
341
+ }
342
+ }
343
+ if (!supportedCCs || !controlledCCs) {
344
+ if (node.hasSecurityClass(import_core.SecurityClass.S0_Legacy) === true) {
345
+ ctx.logNode(node.id, {
346
+ endpoint: this.endpointIndex,
347
+ message: "Querying securely supported commands (S0) failed",
348
+ level: "warn"
349
+ });
350
+ } else {
351
+ ctx.logNode(node.id, `The node was not granted the S0 security class. Continuing interview non-securely.`);
352
+ node.setSecurityClass(import_core.SecurityClass.S0_Legacy, false);
353
+ }
354
+ return;
355
+ }
356
+ const logLines = [
357
+ "received secure commands (S0)",
358
+ "supported CCs:"
359
+ ];
360
+ for (const cc of supportedCCs) {
361
+ logLines.push(`\xB7 ${(0, import_core.getCCName)(cc)}`);
316
362
  }
363
+ logLines.push("controlled CCs:");
364
+ for (const cc of controlledCCs) {
365
+ logLines.push(`\xB7 ${(0, import_core.getCCName)(cc)}`);
366
+ }
367
+ ctx.logNode(node.id, {
368
+ message: logLines.join("\n"),
369
+ direction: "inbound"
370
+ });
371
+ for (const cc of supportedCCs) {
372
+ if (cc === import_core.CommandClasses.Basic) {
373
+ endpoint.addCC(cc, { secure: true });
374
+ } else {
375
+ endpoint.addCC(cc, {
376
+ isSupported: true,
377
+ secure: true
378
+ });
379
+ }
380
+ }
381
+ for (const cc of controlledCCs) {
382
+ if (cc === import_core.CommandClasses.Basic) {
383
+ endpoint.addCC(cc, { secure: true });
384
+ } else {
385
+ endpoint.addCC(cc, {
386
+ isControlled: true,
387
+ secure: true
388
+ });
389
+ }
390
+ }
391
+ if (node.hasSecurityClass(import_core.SecurityClass.S0_Legacy) !== true) {
392
+ node.setSecurityClass(import_core.SecurityClass.S0_Legacy, true);
393
+ ctx.logNode(node.id, `The node was granted the S0 security class`);
394
+ }
395
+ this.setInterviewComplete(ctx, true);
317
396
  }
318
- for (const cc of controlledCCs) {
319
- if (cc === import_core.CommandClasses.Basic) {
320
- endpoint.addCC(cc, { secure: true });
321
- } else {
322
- endpoint.addCC(cc, {
323
- isControlled: true,
324
- secure: true
325
- });
397
+ /** Tests if a command should be sent secure and thus requires encapsulation */
398
+ static requiresEncapsulation(cc) {
399
+ if (!(cc.encapsulationFlags & import_core.EncapsulationFlags.Security)) {
400
+ return false;
401
+ }
402
+ if (cc instanceof import_Security2CC.Security2CC || cc instanceof import_CRC16CC.CRC16CC || cc instanceof import_TransportServiceCC.TransportServiceCC) {
403
+ return false;
404
+ }
405
+ if (cc instanceof SecurityCC2) {
406
+ switch (cc.ccCommand) {
407
+ // Already encapsulated
408
+ case import_Types.SecurityCommand.CommandEncapsulation:
409
+ case import_Types.SecurityCommand.CommandEncapsulationNonceGet:
410
+ // Cannot be sent encapsulated:
411
+ case import_Types.SecurityCommand.NonceGet:
412
+ case import_Types.SecurityCommand.NonceReport:
413
+ case import_Types.SecurityCommand.SchemeGet:
414
+ case import_Types.SecurityCommand.SchemeReport:
415
+ return false;
416
+ default:
417
+ return true;
418
+ }
326
419
  }
420
+ return true;
327
421
  }
328
- if (node.hasSecurityClass(import_core.SecurityClass.S0_Legacy) !== true) {
329
- node.setSecurityClass(import_core.SecurityClass.S0_Legacy, true);
330
- ctx.logNode(node.id, `The node was granted the S0 security class`);
422
+ /** Encapsulates a command that should be sent encrypted */
423
+ static encapsulate(ownNodeId, securityManager, cc) {
424
+ const ret = new SecurityCCCommandEncapsulation({
425
+ nodeId: cc.nodeId,
426
+ encapsulated: cc
427
+ });
428
+ ret.encapsulationFlags = cc.encapsulationFlags & ~import_core.EncapsulationFlags.Security;
429
+ return ret;
331
430
  }
332
- this.setInterviewComplete(ctx, true);
333
- }
334
- /** Tests if a command should be sent secure and thus requires encapsulation */
335
- static requiresEncapsulation(cc) {
336
- if (!(cc.encapsulationFlags & import_core.EncapsulationFlags.Security)) {
337
- return false;
338
- }
339
- if (cc instanceof import_Security2CC.Security2CC || cc instanceof import_CRC16CC.CRC16CC || cc instanceof import_TransportServiceCC.TransportServiceCC) {
340
- return false;
341
- }
342
- if (cc instanceof SecurityCC_1) {
343
- switch (cc.ccCommand) {
344
- // Already encapsulated
345
- case import_Types.SecurityCommand.CommandEncapsulation:
346
- case import_Types.SecurityCommand.CommandEncapsulationNonceGet:
347
- // Cannot be sent encapsulated:
348
- case import_Types.SecurityCommand.NonceGet:
349
- case import_Types.SecurityCommand.NonceReport:
350
- case import_Types.SecurityCommand.SchemeGet:
351
- case import_Types.SecurityCommand.SchemeReport:
352
- return false;
353
- default:
354
- return true;
431
+ };
432
+ return SecurityCC2 = _classThis;
433
+ })();
434
+ let SecurityCCNonceReport = (() => {
435
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NonceReport)];
436
+ let _classDescriptor;
437
+ let _classExtraInitializers = [];
438
+ let _classThis;
439
+ let _classSuper = SecurityCC;
440
+ var SecurityCCNonceReport2 = class extends _classSuper {
441
+ static {
442
+ _classThis = this;
443
+ }
444
+ static {
445
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
446
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
447
+ SecurityCCNonceReport2 = _classThis = _classDescriptor.value;
448
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
449
+ __runInitializers(_classThis, _classExtraInitializers);
450
+ }
451
+ constructor(options) {
452
+ super(options);
453
+ if (options.nonce.length !== HALF_NONCE_SIZE) {
454
+ throw new import_core.ZWaveError(`Nonce must have length ${HALF_NONCE_SIZE}!`, import_core.ZWaveErrorCodes.Argument_Invalid);
355
455
  }
456
+ this.nonce = options.nonce;
356
457
  }
357
- return true;
358
- }
359
- /** Encapsulates a command that should be sent encrypted */
360
- static encapsulate(ownNodeId, securityManager, cc) {
361
- const ret = new SecurityCCCommandEncapsulation({
362
- nodeId: cc.nodeId,
363
- encapsulated: cc
364
- });
365
- ret.encapsulationFlags = cc.encapsulationFlags & ~import_core.EncapsulationFlags.Security;
366
- return ret;
367
- }
368
- };
369
- SecurityCC = SecurityCC_1 = __decorate([
370
- (0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses.Security),
371
- (0, import_CommandClassDecorators.implementedVersion)(1)
372
- ], SecurityCC);
373
- let SecurityCCNonceReport = SecurityCCNonceReport_1 = class SecurityCCNonceReport2 extends SecurityCC {
374
- constructor(options) {
375
- super(options);
376
- if (options.nonce.length !== HALF_NONCE_SIZE) {
377
- throw new import_core.ZWaveError(`Nonce must have length ${HALF_NONCE_SIZE}!`, import_core.ZWaveErrorCodes.Argument_Invalid);
378
- }
379
- this.nonce = options.nonce;
380
- }
381
- static from(raw, ctx) {
382
- import_core.validatePayload.withReason("Invalid nonce length")(raw.payload.length === HALF_NONCE_SIZE);
383
- return new SecurityCCNonceReport_1({
384
- nodeId: ctx.sourceNodeId,
385
- nonce: raw.payload
386
- });
387
- }
388
- nonce;
389
- serialize(ctx) {
390
- this.payload = import_safe.Bytes.view(this.nonce);
391
- return super.serialize(ctx);
392
- }
393
- toLogEntry(ctx) {
394
- return {
395
- ...super.toLogEntry(ctx),
396
- message: { nonce: (0, import_safe2.buffer2hex)(this.nonce) }
397
- };
398
- }
399
- };
400
- SecurityCCNonceReport = SecurityCCNonceReport_1 = __decorate([
401
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NonceReport)
402
- ], SecurityCCNonceReport);
403
- let SecurityCCNonceGet = class SecurityCCNonceGet2 extends SecurityCC {
404
- };
405
- SecurityCCNonceGet = __decorate([
406
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NonceGet),
407
- (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCNonceReport)
408
- ], SecurityCCNonceGet);
458
+ static from(raw, ctx) {
459
+ import_core.validatePayload.withReason("Invalid nonce length")(raw.payload.length === HALF_NONCE_SIZE);
460
+ return new this({
461
+ nodeId: ctx.sourceNodeId,
462
+ nonce: raw.payload
463
+ });
464
+ }
465
+ nonce;
466
+ serialize(ctx) {
467
+ this.payload = import_safe.Bytes.view(this.nonce);
468
+ return super.serialize(ctx);
469
+ }
470
+ toLogEntry(ctx) {
471
+ return {
472
+ ...super.toLogEntry(ctx),
473
+ message: { nonce: (0, import_safe2.buffer2hex)(this.nonce) }
474
+ };
475
+ }
476
+ };
477
+ return SecurityCCNonceReport2 = _classThis;
478
+ })();
479
+ let SecurityCCNonceGet = (() => {
480
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NonceGet), (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCNonceReport)];
481
+ let _classDescriptor;
482
+ let _classExtraInitializers = [];
483
+ let _classThis;
484
+ let _classSuper = SecurityCC;
485
+ var SecurityCCNonceGet2 = class extends _classSuper {
486
+ static {
487
+ _classThis = this;
488
+ }
489
+ static {
490
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
491
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
492
+ SecurityCCNonceGet2 = _classThis = _classDescriptor.value;
493
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
494
+ __runInitializers(_classThis, _classExtraInitializers);
495
+ }
496
+ };
497
+ return SecurityCCNonceGet2 = _classThis;
498
+ })();
409
499
  function getCCResponseForCommandEncapsulation(sent) {
410
500
  if (sent.encapsulated.expectsCCResponse()) {
411
501
  return SecurityCCCommandEncapsulation;
412
502
  }
413
503
  }
414
- let SecurityCCCommandEncapsulation = SecurityCCCommandEncapsulation_1 = class SecurityCCCommandEncapsulation2 extends SecurityCC {
415
- constructor(options) {
416
- super(options);
417
- if ("encapsulated" in options) {
418
- this.encapsulated = options.encapsulated;
419
- this.encapsulated.encapsulatingCC = this;
420
- } else {
421
- this.decryptedCCBytes = options.decryptedCCBytes;
422
- this.sequenced = options.sequenced;
423
- this.secondFrame = options.secondFrame;
424
- this.sequenceCounter = options.sequenceCounter;
504
+ let SecurityCCCommandEncapsulation = (() => {
505
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandEncapsulation), (0, import_CommandClassDecorators.expectedCCResponse)(getCCResponseForCommandEncapsulation, () => "checkEncapsulated")];
506
+ let _classDescriptor;
507
+ let _classExtraInitializers = [];
508
+ let _classThis;
509
+ let _classSuper = SecurityCC;
510
+ var SecurityCCCommandEncapsulation2 = class extends _classSuper {
511
+ static {
512
+ _classThis = this;
425
513
  }
426
- this.alternativeNetworkKey = options.alternativeNetworkKey;
427
- }
428
- static from(raw, ctx) {
429
- assertSecurityRX(ctx);
430
- (0, import_core.validatePayload)(raw.payload.length >= HALF_NONCE_SIZE + 1 + 1 + 1 + 8);
431
- const iv = raw.payload.subarray(0, HALF_NONCE_SIZE);
432
- const encryptedPayload = raw.payload.subarray(HALF_NONCE_SIZE, -9);
433
- const nonceId = raw.payload.at(-9);
434
- const authCode = raw.payload.subarray(-8);
435
- const nonce = ctx.securityManager.getNonce(nonceId);
436
- if (!nonce) {
437
- import_core.validatePayload.fail(`Nonce ${(0, import_safe2.num2hex)(nonceId)} expired, cannot decode security encapsulated command.`);
438
- }
439
- ctx.securityManager.deleteNonce(nonceId);
440
- const authData = getAuthenticationData(iv, nonce, import_Types.SecurityCommand.CommandEncapsulation, ctx.sourceNodeId, ctx.ownNodeId, encryptedPayload);
441
- const expectedAuthCode = (0, import_core.computeMAC)(authData, ctx.securityManager.authKey);
442
- import_core.validatePayload.withReason("Invalid auth code, won't accept security encapsulated command.")(authCode.equals(expectedAuthCode));
443
- const frameControlAndDecryptedCC = (0, import_core.decryptAES128OFB)(encryptedPayload, ctx.securityManager.encryptionKey, import_safe.Bytes.concat([iv, nonce]));
444
- const frameControl = frameControlAndDecryptedCC[0];
445
- const sequenceCounter = frameControl & 15;
446
- const sequenced = !!(frameControl & 16);
447
- const secondFrame = !!(frameControl & 32);
448
- const decryptedCCBytes = frameControlAndDecryptedCC.subarray(1);
449
- const ret = new SecurityCCCommandEncapsulation_1({
450
- nodeId: ctx.sourceNodeId,
451
- sequenceCounter,
452
- sequenced,
453
- secondFrame,
454
- decryptedCCBytes
455
- });
456
- ret.authData = authData;
457
- ret.authCode = authCode;
458
- ret.iv = iv;
459
- return ret;
460
- }
461
- sequenced;
462
- secondFrame;
463
- sequenceCounter;
464
- decryptedCCBytes;
465
- encapsulated;
466
- alternativeNetworkKey;
467
- get nonceId() {
468
- return this.nonce?.[0];
469
- }
470
- nonce;
471
- // Only used testing/for debugging purposes
472
- iv;
473
- authData;
474
- authCode;
475
- ciphertext;
476
- getPartialCCSessionId() {
477
- if (this.sequenced) {
478
- return {
479
- // Treat Encapsulation and EncapsulationNonceGet as one
480
- ccCommand: void 0,
481
- sequence: this.sequenceCounter
482
- };
483
- } else {
484
- return {
485
- // Treat Encapsulation and EncapsulationNonceGet as one
486
- ccCommand: void 0
487
- };
514
+ static {
515
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
516
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
517
+ SecurityCCCommandEncapsulation2 = _classThis = _classDescriptor.value;
518
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
519
+ __runInitializers(_classThis, _classExtraInitializers);
488
520
  }
489
- }
490
- expectMoreMessages() {
491
- return !!this.sequenced && !this.secondFrame;
492
- }
493
- mergePartialCCs(partials, ctx) {
494
- this.decryptedCCBytes = import_safe.Bytes.concat([...partials, this].map((cc) => cc.decryptedCCBytes));
495
- (0, import_core.validatePayload)(this.decryptedCCBytes.length >= 2);
496
- this.encapsulated = import_CommandClass.CommandClass.parse(this.decryptedCCBytes, ctx);
497
- this.encapsulated.encapsulatingCC = this;
498
- }
499
- serialize(ctx) {
500
- if (!this.nonce)
501
- throwNoNonce();
502
- if (this.nonce.length !== HALF_NONCE_SIZE) {
503
- throwNoNonce("Invalid nonce size");
504
- }
505
- assertSecurityTX(ctx);
506
- let authKey;
507
- let encryptionKey;
508
- if (this.alternativeNetworkKey) {
509
- authKey = (0, import_core.generateAuthKey)(this.alternativeNetworkKey);
510
- encryptionKey = (0, import_core.generateEncryptionKey)(this.alternativeNetworkKey);
511
- } else {
512
- authKey = ctx.securityManager.authKey;
513
- encryptionKey = ctx.securityManager.encryptionKey;
514
- }
515
- const serializedCC = this.encapsulated.serialize(ctx);
516
- const plaintext = import_safe.Bytes.concat([
517
- import_safe.Bytes.from([0]),
518
- // TODO: frame control
519
- serializedCC
520
- ]);
521
- const senderNonce = (0, import_node_crypto.randomBytes)(HALF_NONCE_SIZE);
522
- const iv = import_safe.Bytes.concat([senderNonce, this.nonce]);
523
- const ciphertext = (0, import_core.encryptAES128OFB)(plaintext, encryptionKey, iv);
524
- const authData = getAuthenticationData(senderNonce, this.nonce, this.ccCommand, ctx.ownNodeId, this.nodeId, ciphertext);
525
- const authCode = (0, import_core.computeMAC)(authData, authKey);
526
- this.iv = iv;
527
- this.authData = authData;
528
- this.authCode = authCode;
529
- this.ciphertext = ciphertext;
530
- this.payload = import_safe.Bytes.concat([
531
- senderNonce,
532
- ciphertext,
533
- import_safe.Bytes.from([this.nonceId]),
534
- authCode
535
- ]);
536
- return super.serialize(ctx);
537
- }
538
- computeEncapsulationOverhead() {
539
- return super.computeEncapsulationOverhead() + 18;
540
- }
541
- toLogEntry(ctx) {
542
- const message = {};
543
- if (this.nonceId != void 0) {
544
- message["nonce id"] = this.nonceId;
521
+ constructor(options) {
522
+ super(options);
523
+ if ("encapsulated" in options) {
524
+ this.encapsulated = options.encapsulated;
525
+ this.encapsulated.encapsulatingCC = this;
526
+ } else {
527
+ this.decryptedCCBytes = options.decryptedCCBytes;
528
+ this.sequenced = options.sequenced;
529
+ this.secondFrame = options.secondFrame;
530
+ this.sequenceCounter = options.sequenceCounter;
531
+ }
532
+ this.alternativeNetworkKey = options.alternativeNetworkKey;
533
+ }
534
+ static from(raw, ctx) {
535
+ assertSecurityRX(ctx);
536
+ (0, import_core.validatePayload)(raw.payload.length >= HALF_NONCE_SIZE + 1 + 1 + 1 + 8);
537
+ const iv = raw.payload.subarray(0, HALF_NONCE_SIZE);
538
+ const encryptedPayload = raw.payload.subarray(HALF_NONCE_SIZE, -9);
539
+ const nonceId = raw.payload.at(-9);
540
+ const authCode = raw.payload.subarray(-8);
541
+ const nonce = ctx.securityManager.getNonce(nonceId);
542
+ if (!nonce) {
543
+ import_core.validatePayload.fail(`Nonce ${(0, import_safe2.num2hex)(nonceId)} expired, cannot decode security encapsulated command.`);
544
+ }
545
+ ctx.securityManager.deleteNonce(nonceId);
546
+ const authData = getAuthenticationData(iv, nonce, import_Types.SecurityCommand.CommandEncapsulation, ctx.sourceNodeId, ctx.ownNodeId, encryptedPayload);
547
+ const expectedAuthCode = (0, import_core.computeMAC)(authData, ctx.securityManager.authKey);
548
+ import_core.validatePayload.withReason("Invalid auth code, won't accept security encapsulated command.")(authCode.equals(expectedAuthCode));
549
+ const frameControlAndDecryptedCC = (0, import_core.decryptAES128OFB)(encryptedPayload, ctx.securityManager.encryptionKey, import_safe.Bytes.concat([iv, nonce]));
550
+ const frameControl = frameControlAndDecryptedCC[0];
551
+ const sequenceCounter = frameControl & 15;
552
+ const sequenced = !!(frameControl & 16);
553
+ const secondFrame = !!(frameControl & 32);
554
+ const decryptedCCBytes = frameControlAndDecryptedCC.subarray(1);
555
+ const ret = new SecurityCCCommandEncapsulation2({
556
+ nodeId: ctx.sourceNodeId,
557
+ sequenceCounter,
558
+ sequenced,
559
+ secondFrame,
560
+ decryptedCCBytes
561
+ });
562
+ ret.authData = authData;
563
+ ret.authCode = authCode;
564
+ ret.iv = iv;
565
+ return ret;
566
+ }
567
+ sequenced;
568
+ secondFrame;
569
+ sequenceCounter;
570
+ decryptedCCBytes;
571
+ encapsulated;
572
+ alternativeNetworkKey;
573
+ get nonceId() {
574
+ return this.nonce?.[0];
545
575
  }
546
- if (this.sequenced != void 0) {
547
- message.sequenced = this.sequenced;
576
+ nonce;
577
+ // Only used testing/for debugging purposes
578
+ iv;
579
+ authData;
580
+ authCode;
581
+ ciphertext;
582
+ getPartialCCSessionId() {
548
583
  if (this.sequenced) {
549
- if (this.secondFrame != void 0) {
550
- message["second frame"] = this.secondFrame;
551
- }
552
- if (this.sequenceCounter != void 0) {
553
- message["sequence counter"] = this.sequenceCounter;
554
- }
584
+ return {
585
+ // Treat Encapsulation and EncapsulationNonceGet as one
586
+ ccCommand: void 0,
587
+ sequence: this.sequenceCounter
588
+ };
589
+ } else {
590
+ return {
591
+ // Treat Encapsulation and EncapsulationNonceGet as one
592
+ ccCommand: void 0
593
+ };
555
594
  }
556
595
  }
557
- if (process.env.NODE_ENV === "test" || process.env.NODE_ENV === "development") {
558
- if (this.iv) {
559
- message.IV = (0, import_safe2.buffer2hex)(this.iv);
596
+ expectMoreMessages() {
597
+ return !!this.sequenced && !this.secondFrame;
598
+ }
599
+ mergePartialCCs(partials, ctx) {
600
+ this.decryptedCCBytes = import_safe.Bytes.concat([...partials, this].map((cc) => cc.decryptedCCBytes));
601
+ (0, import_core.validatePayload)(this.decryptedCCBytes.length >= 2);
602
+ this.encapsulated = import_CommandClass.CommandClass.parse(this.decryptedCCBytes, ctx);
603
+ this.encapsulated.encapsulatingCC = this;
604
+ }
605
+ serialize(ctx) {
606
+ if (!this.nonce)
607
+ throwNoNonce();
608
+ if (this.nonce.length !== HALF_NONCE_SIZE) {
609
+ throwNoNonce("Invalid nonce size");
560
610
  }
561
- if (this.ciphertext) {
562
- message.ciphertext = (0, import_safe2.buffer2hex)(this.ciphertext);
563
- } else if (this.decryptedCCBytes) {
564
- message.plaintext = (0, import_safe2.buffer2hex)(this.decryptedCCBytes);
611
+ assertSecurityTX(ctx);
612
+ let authKey;
613
+ let encryptionKey;
614
+ if (this.alternativeNetworkKey) {
615
+ authKey = (0, import_core.generateAuthKey)(this.alternativeNetworkKey);
616
+ encryptionKey = (0, import_core.generateEncryptionKey)(this.alternativeNetworkKey);
617
+ } else {
618
+ authKey = ctx.securityManager.authKey;
619
+ encryptionKey = ctx.securityManager.encryptionKey;
565
620
  }
566
- if (this.authData) {
567
- message["auth data"] = (0, import_safe2.buffer2hex)(this.authData);
621
+ const serializedCC = this.encapsulated.serialize(ctx);
622
+ const plaintext = import_safe.Bytes.concat([
623
+ import_safe.Bytes.from([0]),
624
+ // TODO: frame control
625
+ serializedCC
626
+ ]);
627
+ const senderNonce = (0, import_node_crypto.randomBytes)(HALF_NONCE_SIZE);
628
+ const iv = import_safe.Bytes.concat([senderNonce, this.nonce]);
629
+ const ciphertext = (0, import_core.encryptAES128OFB)(plaintext, encryptionKey, iv);
630
+ const authData = getAuthenticationData(senderNonce, this.nonce, this.ccCommand, ctx.ownNodeId, this.nodeId, ciphertext);
631
+ const authCode = (0, import_core.computeMAC)(authData, authKey);
632
+ this.iv = iv;
633
+ this.authData = authData;
634
+ this.authCode = authCode;
635
+ this.ciphertext = ciphertext;
636
+ this.payload = import_safe.Bytes.concat([
637
+ senderNonce,
638
+ ciphertext,
639
+ import_safe.Bytes.from([this.nonceId]),
640
+ authCode
641
+ ]);
642
+ return super.serialize(ctx);
643
+ }
644
+ computeEncapsulationOverhead() {
645
+ return super.computeEncapsulationOverhead() + 18;
646
+ }
647
+ toLogEntry(ctx) {
648
+ const message = {};
649
+ if (this.nonceId != void 0) {
650
+ message["nonce id"] = this.nonceId;
568
651
  }
569
- if (this.authCode) {
570
- message["auth code"] = (0, import_safe2.buffer2hex)(this.authCode);
652
+ if (this.sequenced != void 0) {
653
+ message.sequenced = this.sequenced;
654
+ if (this.sequenced) {
655
+ if (this.secondFrame != void 0) {
656
+ message["second frame"] = this.secondFrame;
657
+ }
658
+ if (this.sequenceCounter != void 0) {
659
+ message["sequence counter"] = this.sequenceCounter;
660
+ }
661
+ }
571
662
  }
663
+ if (process.env.NODE_ENV === "test" || process.env.NODE_ENV === "development") {
664
+ if (this.iv) {
665
+ message.IV = (0, import_safe2.buffer2hex)(this.iv);
666
+ }
667
+ if (this.ciphertext) {
668
+ message.ciphertext = (0, import_safe2.buffer2hex)(this.ciphertext);
669
+ } else if (this.decryptedCCBytes) {
670
+ message.plaintext = (0, import_safe2.buffer2hex)(this.decryptedCCBytes);
671
+ }
672
+ if (this.authData) {
673
+ message["auth data"] = (0, import_safe2.buffer2hex)(this.authData);
674
+ }
675
+ if (this.authCode) {
676
+ message["auth code"] = (0, import_safe2.buffer2hex)(this.authCode);
677
+ }
678
+ }
679
+ return {
680
+ ...super.toLogEntry(ctx),
681
+ message
682
+ };
572
683
  }
573
- return {
574
- ...super.toLogEntry(ctx),
575
- message
576
- };
577
- }
578
- };
579
- SecurityCCCommandEncapsulation = SecurityCCCommandEncapsulation_1 = __decorate([
580
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandEncapsulation),
581
- (0, import_CommandClassDecorators.expectedCCResponse)(getCCResponseForCommandEncapsulation, () => "checkEncapsulated")
582
- ], SecurityCCCommandEncapsulation);
583
- let SecurityCCCommandEncapsulationNonceGet = class SecurityCCCommandEncapsulationNonceGet2 extends SecurityCCCommandEncapsulation {
584
- };
585
- SecurityCCCommandEncapsulationNonceGet = __decorate([
586
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandEncapsulationNonceGet)
587
- ], SecurityCCCommandEncapsulationNonceGet);
588
- let SecurityCCSchemeReport = SecurityCCSchemeReport_1 = class SecurityCCSchemeReport2 extends SecurityCC {
589
- static from(raw, ctx) {
590
- (0, import_core.validatePayload)(raw.payload.length >= 1);
591
- return new SecurityCCSchemeReport_1({
592
- nodeId: ctx.sourceNodeId
593
- });
594
- }
595
- serialize(ctx) {
596
- this.payload = import_safe.Bytes.from([0]);
597
- return super.serialize(ctx);
598
- }
599
- toLogEntry(ctx) {
600
- return {
601
- ...super.toLogEntry(ctx),
602
- // Hide the default payload line
603
- message: void 0
604
- };
605
- }
606
- };
607
- SecurityCCSchemeReport = SecurityCCSchemeReport_1 = __decorate([
608
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.SchemeReport)
609
- ], SecurityCCSchemeReport);
610
- let SecurityCCSchemeGet = class SecurityCCSchemeGet2 extends SecurityCC {
611
- serialize(ctx) {
612
- this.payload = import_safe.Bytes.from([0]);
613
- return super.serialize(ctx);
614
- }
615
- toLogEntry(ctx) {
616
- return {
617
- ...super.toLogEntry(ctx),
618
- // Hide the default payload line
619
- message: void 0
620
- };
621
- }
622
- };
623
- SecurityCCSchemeGet = __decorate([
624
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.SchemeGet),
625
- (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCSchemeReport)
626
- ], SecurityCCSchemeGet);
627
- let SecurityCCSchemeInherit = class SecurityCCSchemeInherit2 extends SecurityCC {
628
- serialize(ctx) {
629
- this.payload = import_safe.Bytes.from([0]);
630
- return super.serialize(ctx);
631
- }
632
- toLogEntry(ctx) {
633
- return {
634
- ...super.toLogEntry(ctx),
635
- // Hide the default payload line
636
- message: void 0
637
- };
638
- }
639
- };
640
- SecurityCCSchemeInherit = __decorate([
641
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.SchemeInherit),
642
- (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCSchemeReport)
643
- ], SecurityCCSchemeInherit);
644
- let SecurityCCNetworkKeyVerify = class SecurityCCNetworkKeyVerify2 extends SecurityCC {
645
- };
646
- SecurityCCNetworkKeyVerify = __decorate([
647
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NetworkKeyVerify)
648
- ], SecurityCCNetworkKeyVerify);
649
- let SecurityCCNetworkKeySet = SecurityCCNetworkKeySet_1 = class SecurityCCNetworkKeySet2 extends SecurityCC {
650
- constructor(options) {
651
- super(options);
652
- if (options.networkKey.length !== 16) {
653
- throw new import_core.ZWaveError(`The network key must have length 16!`, import_core.ZWaveErrorCodes.Argument_Invalid);
654
- }
655
- this.networkKey = options.networkKey;
656
- }
657
- static from(raw, ctx) {
658
- (0, import_core.validatePayload)(raw.payload.length >= 16);
659
- const networkKey = raw.payload.subarray(0, 16);
660
- return new SecurityCCNetworkKeySet_1({
661
- nodeId: ctx.sourceNodeId,
662
- networkKey
663
- });
664
- }
665
- networkKey;
666
- serialize(ctx) {
667
- this.payload = import_safe.Bytes.view(this.networkKey);
668
- return super.serialize(ctx);
669
- }
670
- toLogEntry(ctx) {
671
- const { message, ...log } = super.toLogEntry(ctx);
672
- return log;
673
- }
674
- };
675
- SecurityCCNetworkKeySet = SecurityCCNetworkKeySet_1 = __decorate([
676
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NetworkKeySet),
677
- (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCNetworkKeyVerify)
678
- ], SecurityCCNetworkKeySet);
679
- let SecurityCCCommandsSupportedReport = SecurityCCCommandsSupportedReport_1 = class SecurityCCCommandsSupportedReport2 extends SecurityCC {
680
- constructor(options) {
681
- super(options);
682
- this.supportedCCs = options.supportedCCs;
683
- this.controlledCCs = options.controlledCCs;
684
- this.reportsToFollow = options.reportsToFollow ?? 0;
685
- }
686
- static from(raw, ctx) {
687
- (0, import_core.validatePayload)(raw.payload.length >= 1);
688
- const reportsToFollow = raw.payload[0];
689
- const list = (0, import_core.parseCCList)(raw.payload.subarray(1));
690
- const supportedCCs = list.supportedCCs;
691
- const controlledCCs = list.controlledCCs;
692
- return new SecurityCCCommandsSupportedReport_1({
693
- nodeId: ctx.sourceNodeId,
694
- reportsToFollow,
695
- supportedCCs,
696
- controlledCCs
697
- });
698
- }
699
- reportsToFollow;
700
- supportedCCs;
701
- controlledCCs;
702
- getPartialCCSessionId() {
703
- return {};
704
- }
705
- expectMoreMessages() {
706
- return this.reportsToFollow > 0;
707
- }
708
- mergePartialCCs(partials) {
709
- this.supportedCCs = [...partials, this].map((report) => report.supportedCCs).reduce((prev, cur) => prev.concat(...cur), []);
710
- this.controlledCCs = [...partials, this].map((report) => report.controlledCCs).reduce((prev, cur) => prev.concat(...cur), []);
711
- }
712
- serialize(ctx) {
713
- this.payload = import_safe.Bytes.concat([
714
- import_safe.Bytes.from([this.reportsToFollow]),
715
- (0, import_core.encodeCCList)(this.supportedCCs, this.controlledCCs)
716
- ]);
717
- return super.serialize(ctx);
718
- }
719
- toLogEntry(ctx) {
720
- return {
721
- ...super.toLogEntry(ctx),
722
- message: {
723
- reportsToFollow: this.reportsToFollow,
724
- supportedCCs: this.supportedCCs.map((cc) => (0, import_core.getCCName)(cc)).map((cc) => `
684
+ };
685
+ return SecurityCCCommandEncapsulation2 = _classThis;
686
+ })();
687
+ let SecurityCCCommandEncapsulationNonceGet = (() => {
688
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandEncapsulationNonceGet)];
689
+ let _classDescriptor;
690
+ let _classExtraInitializers = [];
691
+ let _classThis;
692
+ let _classSuper = SecurityCCCommandEncapsulation;
693
+ var SecurityCCCommandEncapsulationNonceGet2 = class extends _classSuper {
694
+ static {
695
+ _classThis = this;
696
+ }
697
+ static {
698
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
699
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
700
+ SecurityCCCommandEncapsulationNonceGet2 = _classThis = _classDescriptor.value;
701
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
702
+ __runInitializers(_classThis, _classExtraInitializers);
703
+ }
704
+ };
705
+ return SecurityCCCommandEncapsulationNonceGet2 = _classThis;
706
+ })();
707
+ let SecurityCCSchemeReport = (() => {
708
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.SchemeReport)];
709
+ let _classDescriptor;
710
+ let _classExtraInitializers = [];
711
+ let _classThis;
712
+ let _classSuper = SecurityCC;
713
+ var SecurityCCSchemeReport2 = class extends _classSuper {
714
+ static {
715
+ _classThis = this;
716
+ }
717
+ static {
718
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
719
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
720
+ SecurityCCSchemeReport2 = _classThis = _classDescriptor.value;
721
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
722
+ __runInitializers(_classThis, _classExtraInitializers);
723
+ }
724
+ static from(raw, ctx) {
725
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
726
+ return new this({
727
+ nodeId: ctx.sourceNodeId
728
+ });
729
+ }
730
+ serialize(ctx) {
731
+ this.payload = import_safe.Bytes.from([0]);
732
+ return super.serialize(ctx);
733
+ }
734
+ toLogEntry(ctx) {
735
+ return {
736
+ ...super.toLogEntry(ctx),
737
+ // Hide the default payload line
738
+ message: void 0
739
+ };
740
+ }
741
+ };
742
+ return SecurityCCSchemeReport2 = _classThis;
743
+ })();
744
+ let SecurityCCSchemeGet = (() => {
745
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.SchemeGet), (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCSchemeReport)];
746
+ let _classDescriptor;
747
+ let _classExtraInitializers = [];
748
+ let _classThis;
749
+ let _classSuper = SecurityCC;
750
+ var SecurityCCSchemeGet2 = class extends _classSuper {
751
+ static {
752
+ _classThis = this;
753
+ }
754
+ static {
755
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
756
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
757
+ SecurityCCSchemeGet2 = _classThis = _classDescriptor.value;
758
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
759
+ __runInitializers(_classThis, _classExtraInitializers);
760
+ }
761
+ serialize(ctx) {
762
+ this.payload = import_safe.Bytes.from([0]);
763
+ return super.serialize(ctx);
764
+ }
765
+ toLogEntry(ctx) {
766
+ return {
767
+ ...super.toLogEntry(ctx),
768
+ // Hide the default payload line
769
+ message: void 0
770
+ };
771
+ }
772
+ };
773
+ return SecurityCCSchemeGet2 = _classThis;
774
+ })();
775
+ let SecurityCCSchemeInherit = (() => {
776
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.SchemeInherit), (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCSchemeReport)];
777
+ let _classDescriptor;
778
+ let _classExtraInitializers = [];
779
+ let _classThis;
780
+ let _classSuper = SecurityCC;
781
+ var SecurityCCSchemeInherit2 = class extends _classSuper {
782
+ static {
783
+ _classThis = this;
784
+ }
785
+ static {
786
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
787
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
788
+ SecurityCCSchemeInherit2 = _classThis = _classDescriptor.value;
789
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
790
+ __runInitializers(_classThis, _classExtraInitializers);
791
+ }
792
+ serialize(ctx) {
793
+ this.payload = import_safe.Bytes.from([0]);
794
+ return super.serialize(ctx);
795
+ }
796
+ toLogEntry(ctx) {
797
+ return {
798
+ ...super.toLogEntry(ctx),
799
+ // Hide the default payload line
800
+ message: void 0
801
+ };
802
+ }
803
+ };
804
+ return SecurityCCSchemeInherit2 = _classThis;
805
+ })();
806
+ let SecurityCCNetworkKeyVerify = (() => {
807
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NetworkKeyVerify)];
808
+ let _classDescriptor;
809
+ let _classExtraInitializers = [];
810
+ let _classThis;
811
+ let _classSuper = SecurityCC;
812
+ var SecurityCCNetworkKeyVerify2 = class extends _classSuper {
813
+ static {
814
+ _classThis = this;
815
+ }
816
+ static {
817
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
818
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
819
+ SecurityCCNetworkKeyVerify2 = _classThis = _classDescriptor.value;
820
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
821
+ __runInitializers(_classThis, _classExtraInitializers);
822
+ }
823
+ };
824
+ return SecurityCCNetworkKeyVerify2 = _classThis;
825
+ })();
826
+ let SecurityCCNetworkKeySet = (() => {
827
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.NetworkKeySet), (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCNetworkKeyVerify)];
828
+ let _classDescriptor;
829
+ let _classExtraInitializers = [];
830
+ let _classThis;
831
+ let _classSuper = SecurityCC;
832
+ var SecurityCCNetworkKeySet2 = class extends _classSuper {
833
+ static {
834
+ _classThis = this;
835
+ }
836
+ static {
837
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
838
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
839
+ SecurityCCNetworkKeySet2 = _classThis = _classDescriptor.value;
840
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
841
+ __runInitializers(_classThis, _classExtraInitializers);
842
+ }
843
+ constructor(options) {
844
+ super(options);
845
+ if (options.networkKey.length !== 16) {
846
+ throw new import_core.ZWaveError(`The network key must have length 16!`, import_core.ZWaveErrorCodes.Argument_Invalid);
847
+ }
848
+ this.networkKey = options.networkKey;
849
+ }
850
+ static from(raw, ctx) {
851
+ (0, import_core.validatePayload)(raw.payload.length >= 16);
852
+ const networkKey = raw.payload.subarray(0, 16);
853
+ return new this({
854
+ nodeId: ctx.sourceNodeId,
855
+ networkKey
856
+ });
857
+ }
858
+ networkKey;
859
+ serialize(ctx) {
860
+ this.payload = import_safe.Bytes.view(this.networkKey);
861
+ return super.serialize(ctx);
862
+ }
863
+ toLogEntry(ctx) {
864
+ const { message, ...log } = super.toLogEntry(ctx);
865
+ return log;
866
+ }
867
+ };
868
+ return SecurityCCNetworkKeySet2 = _classThis;
869
+ })();
870
+ let SecurityCCCommandsSupportedReport = (() => {
871
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandsSupportedReport)];
872
+ let _classDescriptor;
873
+ let _classExtraInitializers = [];
874
+ let _classThis;
875
+ let _classSuper = SecurityCC;
876
+ var SecurityCCCommandsSupportedReport2 = class extends _classSuper {
877
+ static {
878
+ _classThis = this;
879
+ }
880
+ static {
881
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
882
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
883
+ SecurityCCCommandsSupportedReport2 = _classThis = _classDescriptor.value;
884
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
885
+ __runInitializers(_classThis, _classExtraInitializers);
886
+ }
887
+ constructor(options) {
888
+ super(options);
889
+ this.supportedCCs = options.supportedCCs;
890
+ this.controlledCCs = options.controlledCCs;
891
+ this.reportsToFollow = options.reportsToFollow ?? 0;
892
+ }
893
+ static from(raw, ctx) {
894
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
895
+ const reportsToFollow = raw.payload[0];
896
+ const list = (0, import_core.parseCCList)(raw.payload.subarray(1));
897
+ const supportedCCs = list.supportedCCs;
898
+ const controlledCCs = list.controlledCCs;
899
+ return new this({
900
+ nodeId: ctx.sourceNodeId,
901
+ reportsToFollow,
902
+ supportedCCs,
903
+ controlledCCs
904
+ });
905
+ }
906
+ reportsToFollow;
907
+ supportedCCs;
908
+ controlledCCs;
909
+ getPartialCCSessionId() {
910
+ return {};
911
+ }
912
+ expectMoreMessages() {
913
+ return this.reportsToFollow > 0;
914
+ }
915
+ mergePartialCCs(partials) {
916
+ this.supportedCCs = [...partials, this].map((report) => report.supportedCCs).reduce((prev, cur) => prev.concat(...cur), []);
917
+ this.controlledCCs = [...partials, this].map((report) => report.controlledCCs).reduce((prev, cur) => prev.concat(...cur), []);
918
+ }
919
+ serialize(ctx) {
920
+ this.payload = import_safe.Bytes.concat([
921
+ import_safe.Bytes.from([this.reportsToFollow]),
922
+ (0, import_core.encodeCCList)(this.supportedCCs, this.controlledCCs)
923
+ ]);
924
+ return super.serialize(ctx);
925
+ }
926
+ toLogEntry(ctx) {
927
+ return {
928
+ ...super.toLogEntry(ctx),
929
+ message: {
930
+ reportsToFollow: this.reportsToFollow,
931
+ supportedCCs: this.supportedCCs.map((cc) => (0, import_core.getCCName)(cc)).map((cc) => `
725
932
  \xB7 ${cc}`).join(""),
726
- controlledCCs: this.controlledCCs.map((cc) => (0, import_core.getCCName)(cc)).map((cc) => `
933
+ controlledCCs: this.controlledCCs.map((cc) => (0, import_core.getCCName)(cc)).map((cc) => `
727
934
  \xB7 ${cc}`).join("")
728
- }
729
- };
730
- }
731
- };
732
- SecurityCCCommandsSupportedReport = SecurityCCCommandsSupportedReport_1 = __decorate([
733
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandsSupportedReport)
734
- ], SecurityCCCommandsSupportedReport);
735
- let SecurityCCCommandsSupportedGet = class SecurityCCCommandsSupportedGet2 extends SecurityCC {
736
- };
737
- SecurityCCCommandsSupportedGet = __decorate([
738
- (0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandsSupportedGet),
739
- (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCCommandsSupportedReport)
740
- ], SecurityCCCommandsSupportedGet);
935
+ }
936
+ };
937
+ }
938
+ };
939
+ return SecurityCCCommandsSupportedReport2 = _classThis;
940
+ })();
941
+ let SecurityCCCommandsSupportedGet = (() => {
942
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.SecurityCommand.CommandsSupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(SecurityCCCommandsSupportedReport)];
943
+ let _classDescriptor;
944
+ let _classExtraInitializers = [];
945
+ let _classThis;
946
+ let _classSuper = SecurityCC;
947
+ var SecurityCCCommandsSupportedGet2 = class extends _classSuper {
948
+ static {
949
+ _classThis = this;
950
+ }
951
+ static {
952
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
953
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
954
+ SecurityCCCommandsSupportedGet2 = _classThis = _classDescriptor.value;
955
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
956
+ __runInitializers(_classThis, _classExtraInitializers);
957
+ }
958
+ };
959
+ return SecurityCCCommandsSupportedGet2 = _classThis;
960
+ })();
741
961
  // Annotate the CommonJS export names for ESM import in node:
742
962
  0 && (module.exports = {
743
963
  SecurityCC,