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

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 (922) hide show
  1. package/build/cjs/cc/AlarmSensorCC.d.ts +194 -0
  2. package/build/cjs/cc/AlarmSensorCC.js +395 -0
  3. package/build/cjs/cc/AlarmSensorCC.js.map +7 -0
  4. package/build/cjs/cc/AssociationCC.d.ts +253 -0
  5. package/build/cjs/cc/AssociationCC.js +711 -0
  6. package/build/cjs/cc/AssociationCC.js.map +7 -0
  7. package/build/cjs/cc/AssociationGroupInfoCC.d.ts +230 -0
  8. package/build/cjs/cc/AssociationGroupInfoCC.js +746 -0
  9. package/build/cjs/cc/AssociationGroupInfoCC.js.map +7 -0
  10. package/build/cjs/cc/BarrierOperatorCC.d.ts +243 -0
  11. package/build/cjs/cc/BarrierOperatorCC.js +582 -0
  12. package/build/cjs/cc/BarrierOperatorCC.js.map +7 -0
  13. package/build/cjs/cc/BasicCC.d.ts +191 -0
  14. package/build/cjs/cc/BasicCC.js +384 -0
  15. package/build/cjs/cc/BasicCC.js.map +7 -0
  16. package/build/cjs/cc/BatteryCC.d.ts +406 -0
  17. package/build/cjs/cc/BatteryCC.js +508 -0
  18. package/build/cjs/cc/BatteryCC.js.map +7 -0
  19. package/build/cjs/cc/BinarySensorCC.d.ts +122 -0
  20. package/build/cjs/cc/BinarySensorCC.js +431 -0
  21. package/build/cjs/cc/BinarySensorCC.js.map +7 -0
  22. package/build/cjs/cc/BinarySwitchCC.d.ts +139 -0
  23. package/build/cjs/cc/BinarySwitchCC.js +378 -0
  24. package/build/cjs/cc/BinarySwitchCC.js.map +7 -0
  25. package/build/cjs/cc/CRC16CC.d.ts +29 -0
  26. package/build/cjs/cc/CRC16CC.js +133 -0
  27. package/build/cjs/cc/CRC16CC.js.map +7 -0
  28. package/build/cjs/cc/CentralSceneCC.d.ts +210 -0
  29. package/build/cjs/cc/CentralSceneCC.js +449 -0
  30. package/build/cjs/cc/CentralSceneCC.js.map +7 -0
  31. package/build/cjs/cc/ClimateControlScheduleCC.d.ts +177 -0
  32. package/build/cjs/cc/ClimateControlScheduleCC.js +480 -0
  33. package/build/cjs/cc/ClimateControlScheduleCC.js.map +7 -0
  34. package/build/cjs/cc/ClockCC.d.ts +47 -0
  35. package/build/cjs/cc/ClockCC.js +226 -0
  36. package/build/cjs/cc/ClockCC.js.map +7 -0
  37. package/build/cjs/cc/ColorSwitchCC.d.ts +339 -0
  38. package/build/cjs/cc/ColorSwitchCC.js +1117 -0
  39. package/build/cjs/cc/ColorSwitchCC.js.map +7 -0
  40. package/build/cjs/cc/ConfigurationCC.d.ts +396 -0
  41. package/build/cjs/cc/ConfigurationCC.js +2230 -0
  42. package/build/cjs/cc/ConfigurationCC.js.map +7 -0
  43. package/build/cjs/cc/DeviceResetLocallyCC.d.ts +17 -0
  44. package/build/cjs/cc/DeviceResetLocallyCC.js +92 -0
  45. package/build/cjs/cc/DeviceResetLocallyCC.js.map +7 -0
  46. package/build/cjs/cc/DoorLockCC.d.ts +837 -0
  47. package/build/cjs/cc/DoorLockCC.js +1239 -0
  48. package/build/cjs/cc/DoorLockCC.js.map +7 -0
  49. package/build/cjs/cc/DoorLockLoggingCC.d.ts +77 -0
  50. package/build/cjs/cc/DoorLockLoggingCC.js +343 -0
  51. package/build/cjs/cc/DoorLockLoggingCC.js.map +7 -0
  52. package/build/cjs/cc/EnergyProductionCC.d.ts +77 -0
  53. package/build/cjs/cc/EnergyProductionCC.js +240 -0
  54. package/build/cjs/cc/EnergyProductionCC.js.map +7 -0
  55. package/build/cjs/cc/EntryControlCC.d.ts +231 -0
  56. package/build/cjs/cc/EntryControlCC.js +593 -0
  57. package/build/cjs/cc/EntryControlCC.js.map +7 -0
  58. package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +359 -0
  59. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +1122 -0
  60. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +7 -0
  61. package/build/cjs/cc/HailCC.d.ts +6 -0
  62. package/build/cjs/cc/HailCC.js +45 -0
  63. package/build/cjs/cc/HailCC.js.map +7 -0
  64. package/build/cjs/cc/HumidityControlModeCC.d.ts +111 -0
  65. package/build/cjs/cc/HumidityControlModeCC.js +323 -0
  66. package/build/cjs/cc/HumidityControlModeCC.js.map +7 -0
  67. package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +60 -0
  68. package/build/cjs/cc/HumidityControlOperatingStateCC.js +164 -0
  69. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +7 -0
  70. package/build/cjs/cc/HumidityControlSetpointCC.d.ts +209 -0
  71. package/build/cjs/cc/HumidityControlSetpointCC.js +634 -0
  72. package/build/cjs/cc/HumidityControlSetpointCC.js.map +7 -0
  73. package/build/cjs/cc/InclusionControllerCC.d.ts +42 -0
  74. package/build/cjs/cc/InclusionControllerCC.js +160 -0
  75. package/build/cjs/cc/InclusionControllerCC.js.map +7 -0
  76. package/build/cjs/cc/IndicatorCC.d.ts +338 -0
  77. package/build/cjs/cc/IndicatorCC.js +1234 -0
  78. package/build/cjs/cc/IndicatorCC.js.map +7 -0
  79. package/build/cjs/cc/IrrigationCC.d.ts +1496 -0
  80. package/build/cjs/cc/IrrigationCC.js +1978 -0
  81. package/build/cjs/cc/IrrigationCC.js.map +7 -0
  82. package/build/cjs/cc/LanguageCC.d.ts +101 -0
  83. package/build/cjs/cc/LanguageCC.js +267 -0
  84. package/build/cjs/cc/LanguageCC.js.map +7 -0
  85. package/build/cjs/cc/LockCC.d.ts +73 -0
  86. package/build/cjs/cc/LockCC.js +222 -0
  87. package/build/cjs/cc/LockCC.js.map +7 -0
  88. package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +32 -0
  89. package/build/cjs/cc/ManufacturerProprietaryCC.js +209 -0
  90. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +7 -0
  91. package/build/cjs/cc/ManufacturerSpecificCC.d.ts +171 -0
  92. package/build/cjs/cc/ManufacturerSpecificCC.js +334 -0
  93. package/build/cjs/cc/ManufacturerSpecificCC.js.map +7 -0
  94. package/build/cjs/cc/MeterCC.d.ts +318 -0
  95. package/build/cjs/cc/MeterCC.js +1235 -0
  96. package/build/cjs/cc/MeterCC.js.map +7 -0
  97. package/build/cjs/cc/MultiChannelAssociationCC.d.ts +241 -0
  98. package/build/cjs/cc/MultiChannelAssociationCC.js +956 -0
  99. package/build/cjs/cc/MultiChannelAssociationCC.js.map +7 -0
  100. package/build/cjs/cc/MultiChannelCC.d.ts +394 -0
  101. package/build/cjs/cc/MultiChannelCC.js +1050 -0
  102. package/build/cjs/cc/MultiChannelCC.js.map +7 -0
  103. package/build/cjs/cc/MultiCommandCC.d.ts +27 -0
  104. package/build/cjs/cc/MultiCommandCC.js +159 -0
  105. package/build/cjs/cc/MultiCommandCC.js.map +7 -0
  106. package/build/cjs/cc/MultilevelSensorCC.d.ts +185 -0
  107. package/build/cjs/cc/MultilevelSensorCC.js +716 -0
  108. package/build/cjs/cc/MultilevelSensorCC.js.map +7 -0
  109. package/build/cjs/cc/MultilevelSwitchCC.d.ts +357 -0
  110. package/build/cjs/cc/MultilevelSwitchCC.js +780 -0
  111. package/build/cjs/cc/MultilevelSwitchCC.js.map +7 -0
  112. package/build/cjs/cc/NoOperationCC.d.ts +9 -0
  113. package/build/cjs/cc/NoOperationCC.js +64 -0
  114. package/build/cjs/cc/NoOperationCC.js.map +7 -0
  115. package/build/cjs/cc/NodeNamingCC.d.ts +118 -0
  116. package/build/cjs/cc/NodeNamingCC.js +364 -0
  117. package/build/cjs/cc/NodeNamingCC.js.map +7 -0
  118. package/build/cjs/cc/NotificationCC.d.ts +479 -0
  119. package/build/cjs/cc/NotificationCC.js +1245 -0
  120. package/build/cjs/cc/NotificationCC.js.map +7 -0
  121. package/build/cjs/cc/PowerlevelCC.d.ts +82 -0
  122. package/build/cjs/cc/PowerlevelCC.js +510 -0
  123. package/build/cjs/cc/PowerlevelCC.js.map +7 -0
  124. package/build/cjs/cc/ProtectionCC.d.ts +325 -0
  125. package/build/cjs/cc/ProtectionCC.js +667 -0
  126. package/build/cjs/cc/ProtectionCC.js.map +7 -0
  127. package/build/cjs/cc/SceneActivationCC.d.ts +89 -0
  128. package/build/cjs/cc/SceneActivationCC.js +193 -0
  129. package/build/cjs/cc/SceneActivationCC.js.map +7 -0
  130. package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +120 -0
  131. package/build/cjs/cc/SceneActuatorConfigurationCC.js +370 -0
  132. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +7 -0
  133. package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +129 -0
  134. package/build/cjs/cc/SceneControllerConfigurationCC.js +423 -0
  135. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +7 -0
  136. package/build/cjs/cc/ScheduleEntryLockCC.d.ts +434 -0
  137. package/build/cjs/cc/ScheduleEntryLockCC.js +1763 -0
  138. package/build/cjs/cc/ScheduleEntryLockCC.js.map +7 -0
  139. package/build/cjs/cc/Security2CC.d.ts +251 -0
  140. package/build/cjs/cc/Security2CC.js +1589 -0
  141. package/build/cjs/cc/Security2CC.js.map +7 -0
  142. package/build/cjs/cc/SecurityCC.d.ts +128 -0
  143. package/build/cjs/cc/SecurityCC.js +757 -0
  144. package/build/cjs/cc/SecurityCC.js.map +7 -0
  145. package/build/cjs/cc/SoundSwitchCC.d.ts +232 -0
  146. package/build/cjs/cc/SoundSwitchCC.js +661 -0
  147. package/build/cjs/cc/SoundSwitchCC.js.map +7 -0
  148. package/build/cjs/cc/SupervisionCC.d.ts +104 -0
  149. package/build/cjs/cc/SupervisionCC.js +308 -0
  150. package/build/cjs/cc/SupervisionCC.js.map +7 -0
  151. package/build/cjs/cc/ThermostatFanModeCC.d.ts +141 -0
  152. package/build/cjs/cc/ThermostatFanModeCC.js +372 -0
  153. package/build/cjs/cc/ThermostatFanModeCC.js.map +7 -0
  154. package/build/cjs/cc/ThermostatFanStateCC.d.ts +60 -0
  155. package/build/cjs/cc/ThermostatFanStateCC.js +166 -0
  156. package/build/cjs/cc/ThermostatFanStateCC.js.map +7 -0
  157. package/build/cjs/cc/ThermostatModeCC.d.ts +150 -0
  158. package/build/cjs/cc/ThermostatModeCC.js +436 -0
  159. package/build/cjs/cc/ThermostatModeCC.js.map +7 -0
  160. package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +61 -0
  161. package/build/cjs/cc/ThermostatOperatingStateCC.js +162 -0
  162. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +7 -0
  163. package/build/cjs/cc/ThermostatSetbackCC.d.ts +46 -0
  164. package/build/cjs/cc/ThermostatSetbackCC.js +262 -0
  165. package/build/cjs/cc/ThermostatSetbackCC.js.map +7 -0
  166. package/build/cjs/cc/ThermostatSetpointCC.d.ts +197 -0
  167. package/build/cjs/cc/ThermostatSetpointCC.js +638 -0
  168. package/build/cjs/cc/ThermostatSetpointCC.js.map +7 -0
  169. package/build/cjs/cc/TimeCC.d.ts +88 -0
  170. package/build/cjs/cc/TimeCC.js +473 -0
  171. package/build/cjs/cc/TimeCC.js.map +7 -0
  172. package/build/cjs/cc/TimeParametersCC.d.ts +72 -0
  173. package/build/cjs/cc/TimeParametersCC.js +313 -0
  174. package/build/cjs/cc/TimeParametersCC.js.map +7 -0
  175. package/build/cjs/cc/TransportServiceCC.d.ts +107 -0
  176. package/build/cjs/cc/TransportServiceCC.js +404 -0
  177. package/build/cjs/cc/TransportServiceCC.js.map +7 -0
  178. package/build/cjs/cc/UserCodeCC.d.ts +683 -0
  179. package/build/cjs/cc/UserCodeCC.js +1620 -0
  180. package/build/cjs/cc/UserCodeCC.js.map +7 -0
  181. package/build/cjs/cc/VersionCC.d.ts +469 -0
  182. package/build/cjs/cc/VersionCC.js +828 -0
  183. package/build/cjs/cc/VersionCC.js.map +7 -0
  184. package/build/cjs/cc/WakeUpCC.d.ts +150 -0
  185. package/build/cjs/cc/WakeUpCC.js +456 -0
  186. package/build/cjs/cc/WakeUpCC.js.map +7 -0
  187. package/build/cjs/cc/WindowCoveringCC.d.ts +315 -0
  188. package/build/cjs/cc/WindowCoveringCC.js +776 -0
  189. package/build/cjs/cc/WindowCoveringCC.js.map +7 -0
  190. package/build/cjs/cc/ZWaveLongRangeCC.d.ts +4 -0
  191. package/build/cjs/cc/ZWaveLongRangeCC.js +43 -0
  192. package/build/cjs/cc/ZWaveLongRangeCC.js.map +7 -0
  193. package/build/cjs/cc/ZWavePlusCC.d.ts +163 -0
  194. package/build/cjs/cc/ZWavePlusCC.js +288 -0
  195. package/build/cjs/cc/ZWavePlusCC.js.map +7 -0
  196. package/build/cjs/cc/ZWaveProtocolCC.d.ts +344 -0
  197. package/build/cjs/cc/ZWaveProtocolCC.js +1071 -0
  198. package/build/cjs/cc/ZWaveProtocolCC.js.map +7 -0
  199. package/build/cjs/cc/index.d.ts +132 -0
  200. package/build/cjs/cc/index.js +1180 -0
  201. package/build/cjs/cc/index.js.map +7 -0
  202. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +64 -0
  203. package/build/cjs/cc/manufacturerProprietary/Decorators.js +76 -0
  204. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +7 -0
  205. package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +79 -0
  206. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +412 -0
  207. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +7 -0
  208. package/build/cjs/index.d.ts +15 -0
  209. package/build/cjs/index.js +77 -0
  210. package/build/cjs/index.js.map +7 -0
  211. package/build/cjs/index_safe.d.ts +3 -0
  212. package/build/cjs/index_safe.js +25 -0
  213. package/build/cjs/index_safe.js.map +7 -0
  214. package/build/cjs/lib/API.d.ts +271 -0
  215. package/build/cjs/lib/API.js +413 -0
  216. package/build/cjs/lib/API.js.map +7 -0
  217. package/build/cjs/lib/CommandClass.d.ts +234 -0
  218. package/build/cjs/lib/CommandClass.js +692 -0
  219. package/build/cjs/lib/CommandClass.js.map +7 -0
  220. package/build/cjs/lib/CommandClassDecorators.d.ts +112 -0
  221. package/build/cjs/lib/CommandClassDecorators.js +182 -0
  222. package/build/cjs/lib/CommandClassDecorators.js.map +7 -0
  223. package/build/cjs/lib/EncapsulatingCommandClass.d.ts +22 -0
  224. package/build/cjs/lib/EncapsulatingCommandClass.js +71 -0
  225. package/build/cjs/lib/EncapsulatingCommandClass.js.map +7 -0
  226. package/build/cjs/lib/ICommandClassContainer.js +17 -0
  227. package/build/cjs/lib/ICommandClassContainer.js.map +7 -0
  228. package/build/cjs/lib/NotificationEventPayload.d.ts +10 -0
  229. package/build/cjs/lib/NotificationEventPayload.js +31 -0
  230. package/build/cjs/lib/NotificationEventPayload.js.map +7 -0
  231. package/build/cjs/lib/Security2/Extension.js +333 -0
  232. package/build/cjs/lib/Security2/Extension.js.map +7 -0
  233. package/build/cjs/lib/Security2/shared.js +69 -0
  234. package/build/cjs/lib/Security2/shared.js.map +7 -0
  235. package/build/cjs/lib/SetValueResult.js +65 -0
  236. package/build/cjs/lib/SetValueResult.js.map +7 -0
  237. package/build/cjs/lib/Values.d.ts +223 -0
  238. package/build/cjs/lib/Values.js +191 -0
  239. package/build/cjs/lib/Values.js.map +7 -0
  240. package/build/cjs/lib/_Types.js +1676 -0
  241. package/build/cjs/lib/_Types.js.map +7 -0
  242. package/build/cjs/lib/serializers.d.ts +34 -0
  243. package/build/cjs/lib/serializers.js +110 -0
  244. package/build/cjs/lib/serializers.js.map +7 -0
  245. package/build/cjs/lib/utils.d.ts +17 -0
  246. package/build/cjs/lib/utils.js +678 -0
  247. package/build/cjs/lib/utils.js.map +7 -0
  248. package/build/cjs/package.json +3 -0
  249. package/build/esm/cc/AlarmSensorCC.d.ts +194 -0
  250. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -0
  251. package/build/esm/cc/AlarmSensorCC.js +392 -0
  252. package/build/esm/cc/AlarmSensorCC.js.map +1 -0
  253. package/build/esm/cc/AssociationCC.d.ts +253 -0
  254. package/build/esm/cc/AssociationCC.d.ts.map +1 -0
  255. package/build/esm/cc/AssociationCC.js +706 -0
  256. package/build/esm/cc/AssociationCC.js.map +1 -0
  257. package/build/esm/cc/AssociationGroupInfoCC.d.ts +230 -0
  258. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -0
  259. package/build/esm/cc/AssociationGroupInfoCC.js +769 -0
  260. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -0
  261. package/build/esm/cc/BarrierOperatorCC.d.ts +243 -0
  262. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -0
  263. package/build/esm/cc/BarrierOperatorCC.js +610 -0
  264. package/build/esm/cc/BarrierOperatorCC.js.map +1 -0
  265. package/build/esm/cc/BasicCC.d.ts +191 -0
  266. package/build/esm/cc/BasicCC.d.ts.map +1 -0
  267. package/build/esm/cc/BasicCC.js +390 -0
  268. package/build/esm/cc/BasicCC.js.map +1 -0
  269. package/build/esm/cc/BatteryCC.d.ts +406 -0
  270. package/build/esm/cc/BatteryCC.d.ts.map +1 -0
  271. package/build/esm/cc/BatteryCC.js +513 -0
  272. package/build/esm/cc/BatteryCC.js.map +1 -0
  273. package/build/esm/cc/BinarySensorCC.d.ts +122 -0
  274. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -0
  275. package/build/esm/cc/BinarySensorCC.js +417 -0
  276. package/build/esm/cc/BinarySensorCC.js.map +1 -0
  277. package/build/esm/cc/BinarySwitchCC.d.ts +139 -0
  278. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -0
  279. package/build/esm/cc/BinarySwitchCC.js +362 -0
  280. package/build/esm/cc/BinarySwitchCC.js.map +1 -0
  281. package/build/esm/cc/CRC16CC.d.ts +29 -0
  282. package/build/esm/cc/CRC16CC.d.ts.map +1 -0
  283. package/build/esm/cc/CRC16CC.js +123 -0
  284. package/build/esm/cc/CRC16CC.js.map +1 -0
  285. package/build/esm/cc/CentralSceneCC.d.ts +210 -0
  286. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -0
  287. package/build/esm/cc/CentralSceneCC.js +427 -0
  288. package/build/esm/cc/CentralSceneCC.js.map +1 -0
  289. package/build/esm/cc/ClimateControlScheduleCC.d.ts +177 -0
  290. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -0
  291. package/build/esm/cc/ClimateControlScheduleCC.js +466 -0
  292. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -0
  293. package/build/esm/cc/ClockCC.d.ts +47 -0
  294. package/build/esm/cc/ClockCC.d.ts.map +1 -0
  295. package/build/esm/cc/ClockCC.js +205 -0
  296. package/build/esm/cc/ClockCC.js.map +1 -0
  297. package/build/esm/cc/ColorSwitchCC.d.ts +339 -0
  298. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -0
  299. package/build/esm/cc/ColorSwitchCC.js +1149 -0
  300. package/build/esm/cc/ColorSwitchCC.js.map +1 -0
  301. package/build/esm/cc/ConfigurationCC.d.ts +396 -0
  302. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -0
  303. package/build/esm/cc/ConfigurationCC.js +2454 -0
  304. package/build/esm/cc/ConfigurationCC.js.map +1 -0
  305. package/build/esm/cc/DeviceResetLocallyCC.d.ts +17 -0
  306. package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -0
  307. package/build/esm/cc/DeviceResetLocallyCC.js +73 -0
  308. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -0
  309. package/build/esm/cc/DoorLockCC.d.ts +837 -0
  310. package/build/esm/cc/DoorLockCC.d.ts.map +1 -0
  311. package/build/esm/cc/DoorLockCC.js +1270 -0
  312. package/build/esm/cc/DoorLockCC.js.map +1 -0
  313. package/build/esm/cc/DoorLockLoggingCC.d.ts +77 -0
  314. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -0
  315. package/build/esm/cc/DoorLockLoggingCC.js +316 -0
  316. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -0
  317. package/build/esm/cc/EnergyProductionCC.d.ts +77 -0
  318. package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -0
  319. package/build/esm/cc/EnergyProductionCC.js +213 -0
  320. package/build/esm/cc/EnergyProductionCC.js.map +1 -0
  321. package/build/esm/cc/EntryControlCC.d.ts +231 -0
  322. package/build/esm/cc/EntryControlCC.d.ts.map +1 -0
  323. package/build/esm/cc/EntryControlCC.js +581 -0
  324. package/build/esm/cc/EntryControlCC.js.map +1 -0
  325. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +359 -0
  326. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -0
  327. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +1142 -0
  328. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -0
  329. package/build/esm/cc/HailCC.d.ts +6 -0
  330. package/build/esm/cc/HailCC.d.ts.map +1 -0
  331. package/build/esm/cc/HailCC.js +21 -0
  332. package/build/esm/cc/HailCC.js.map +1 -0
  333. package/build/esm/cc/HumidityControlModeCC.d.ts +111 -0
  334. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -0
  335. package/build/esm/cc/HumidityControlModeCC.js +305 -0
  336. package/build/esm/cc/HumidityControlModeCC.js.map +1 -0
  337. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +60 -0
  338. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -0
  339. package/build/esm/cc/HumidityControlOperatingStateCC.js +137 -0
  340. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -0
  341. package/build/esm/cc/HumidityControlSetpointCC.d.ts +209 -0
  342. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -0
  343. package/build/esm/cc/HumidityControlSetpointCC.js +645 -0
  344. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -0
  345. package/build/esm/cc/InclusionControllerCC.d.ts +42 -0
  346. package/build/esm/cc/InclusionControllerCC.d.ts.map +1 -0
  347. package/build/esm/cc/InclusionControllerCC.js +133 -0
  348. package/build/esm/cc/InclusionControllerCC.js.map +1 -0
  349. package/build/esm/cc/IndicatorCC.d.ts +338 -0
  350. package/build/esm/cc/IndicatorCC.d.ts.map +1 -0
  351. package/build/esm/cc/IndicatorCC.js +1317 -0
  352. package/build/esm/cc/IndicatorCC.js.map +1 -0
  353. package/build/esm/cc/IrrigationCC.d.ts +1496 -0
  354. package/build/esm/cc/IrrigationCC.d.ts.map +1 -0
  355. package/build/esm/cc/IrrigationCC.js +2038 -0
  356. package/build/esm/cc/IrrigationCC.js.map +1 -0
  357. package/build/esm/cc/LanguageCC.d.ts +101 -0
  358. package/build/esm/cc/LanguageCC.d.ts.map +1 -0
  359. package/build/esm/cc/LanguageCC.js +243 -0
  360. package/build/esm/cc/LanguageCC.js.map +1 -0
  361. package/build/esm/cc/LockCC.d.ts +73 -0
  362. package/build/esm/cc/LockCC.d.ts.map +1 -0
  363. package/build/esm/cc/LockCC.js +197 -0
  364. package/build/esm/cc/LockCC.js.map +1 -0
  365. package/build/esm/cc/ManufacturerProprietaryCC.d.ts +32 -0
  366. package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -0
  367. package/build/esm/cc/ManufacturerProprietaryCC.js +201 -0
  368. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -0
  369. package/build/esm/cc/ManufacturerSpecificCC.d.ts +171 -0
  370. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -0
  371. package/build/esm/cc/ManufacturerSpecificCC.js +315 -0
  372. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -0
  373. package/build/esm/cc/MeterCC.d.ts +318 -0
  374. package/build/esm/cc/MeterCC.d.ts.map +1 -0
  375. package/build/esm/cc/MeterCC.js +1308 -0
  376. package/build/esm/cc/MeterCC.js.map +1 -0
  377. package/build/esm/cc/MultiChannelAssociationCC.d.ts +241 -0
  378. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -0
  379. package/build/esm/cc/MultiChannelAssociationCC.js +981 -0
  380. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -0
  381. package/build/esm/cc/MultiChannelCC.d.ts +394 -0
  382. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -0
  383. package/build/esm/cc/MultiChannelCC.js +1127 -0
  384. package/build/esm/cc/MultiChannelCC.js.map +1 -0
  385. package/build/esm/cc/MultiCommandCC.d.ts +27 -0
  386. package/build/esm/cc/MultiCommandCC.d.ts.map +1 -0
  387. package/build/esm/cc/MultiCommandCC.js +142 -0
  388. package/build/esm/cc/MultiCommandCC.js.map +1 -0
  389. package/build/esm/cc/MultilevelSensorCC.d.ts +185 -0
  390. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -0
  391. package/build/esm/cc/MultilevelSensorCC.js +753 -0
  392. package/build/esm/cc/MultilevelSensorCC.js.map +1 -0
  393. package/build/esm/cc/MultilevelSwitchCC.d.ts +357 -0
  394. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -0
  395. package/build/esm/cc/MultilevelSwitchCC.js +810 -0
  396. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -0
  397. package/build/esm/cc/NoOperationCC.d.ts +9 -0
  398. package/build/esm/cc/NoOperationCC.d.ts.map +1 -0
  399. package/build/esm/cc/NoOperationCC.js +39 -0
  400. package/build/esm/cc/NoOperationCC.js.map +1 -0
  401. package/build/esm/cc/NodeNamingCC.d.ts +118 -0
  402. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -0
  403. package/build/esm/cc/NodeNamingCC.js +345 -0
  404. package/build/esm/cc/NodeNamingCC.js.map +1 -0
  405. package/build/esm/cc/NotificationCC.d.ts +479 -0
  406. package/build/esm/cc/NotificationCC.d.ts.map +1 -0
  407. package/build/esm/cc/NotificationCC.js +1350 -0
  408. package/build/esm/cc/NotificationCC.js.map +1 -0
  409. package/build/esm/cc/PowerlevelCC.d.ts +82 -0
  410. package/build/esm/cc/PowerlevelCC.d.ts.map +1 -0
  411. package/build/esm/cc/PowerlevelCC.js +485 -0
  412. package/build/esm/cc/PowerlevelCC.js.map +1 -0
  413. package/build/esm/cc/ProtectionCC.d.ts +325 -0
  414. package/build/esm/cc/ProtectionCC.d.ts.map +1 -0
  415. package/build/esm/cc/ProtectionCC.js +669 -0
  416. package/build/esm/cc/ProtectionCC.js.map +1 -0
  417. package/build/esm/cc/SceneActivationCC.d.ts +89 -0
  418. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -0
  419. package/build/esm/cc/SceneActivationCC.js +166 -0
  420. package/build/esm/cc/SceneActivationCC.js.map +1 -0
  421. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +120 -0
  422. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -0
  423. package/build/esm/cc/SceneActuatorConfigurationCC.js +374 -0
  424. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -0
  425. package/build/esm/cc/SceneControllerConfigurationCC.d.ts +129 -0
  426. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -0
  427. package/build/esm/cc/SceneControllerConfigurationCC.js +446 -0
  428. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -0
  429. package/build/esm/cc/ScheduleEntryLockCC.d.ts +434 -0
  430. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -0
  431. package/build/esm/cc/ScheduleEntryLockCC.js +1826 -0
  432. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -0
  433. package/build/esm/cc/Security2CC.d.ts +251 -0
  434. package/build/esm/cc/Security2CC.d.ts.map +1 -0
  435. package/build/esm/cc/Security2CC.js +1814 -0
  436. package/build/esm/cc/Security2CC.js.map +1 -0
  437. package/build/esm/cc/SecurityCC.d.ts +128 -0
  438. package/build/esm/cc/SecurityCC.d.ts.map +1 -0
  439. package/build/esm/cc/SecurityCC.js +800 -0
  440. package/build/esm/cc/SecurityCC.js.map +1 -0
  441. package/build/esm/cc/SoundSwitchCC.d.ts +232 -0
  442. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -0
  443. package/build/esm/cc/SoundSwitchCC.js +633 -0
  444. package/build/esm/cc/SoundSwitchCC.js.map +1 -0
  445. package/build/esm/cc/SupervisionCC.d.ts +104 -0
  446. package/build/esm/cc/SupervisionCC.d.ts.map +1 -0
  447. package/build/esm/cc/SupervisionCC.js +319 -0
  448. package/build/esm/cc/SupervisionCC.js.map +1 -0
  449. package/build/esm/cc/ThermostatFanModeCC.d.ts +141 -0
  450. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -0
  451. package/build/esm/cc/ThermostatFanModeCC.js +359 -0
  452. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -0
  453. package/build/esm/cc/ThermostatFanStateCC.d.ts +60 -0
  454. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -0
  455. package/build/esm/cc/ThermostatFanStateCC.js +139 -0
  456. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -0
  457. package/build/esm/cc/ThermostatModeCC.d.ts +150 -0
  458. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -0
  459. package/build/esm/cc/ThermostatModeCC.js +426 -0
  460. package/build/esm/cc/ThermostatModeCC.js.map +1 -0
  461. package/build/esm/cc/ThermostatOperatingStateCC.d.ts +61 -0
  462. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -0
  463. package/build/esm/cc/ThermostatOperatingStateCC.js +135 -0
  464. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -0
  465. package/build/esm/cc/ThermostatSetbackCC.d.ts +46 -0
  466. package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -0
  467. package/build/esm/cc/ThermostatSetbackCC.js +244 -0
  468. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -0
  469. package/build/esm/cc/ThermostatSetpointCC.d.ts +197 -0
  470. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -0
  471. package/build/esm/cc/ThermostatSetpointCC.js +655 -0
  472. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -0
  473. package/build/esm/cc/TimeCC.d.ts +88 -0
  474. package/build/esm/cc/TimeCC.d.ts.map +1 -0
  475. package/build/esm/cc/TimeCC.js +451 -0
  476. package/build/esm/cc/TimeCC.js.map +1 -0
  477. package/build/esm/cc/TimeParametersCC.d.ts +72 -0
  478. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -0
  479. package/build/esm/cc/TimeParametersCC.js +300 -0
  480. package/build/esm/cc/TimeParametersCC.js.map +1 -0
  481. package/build/esm/cc/TransportServiceCC.d.ts +107 -0
  482. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -0
  483. package/build/esm/cc/TransportServiceCC.js +422 -0
  484. package/build/esm/cc/TransportServiceCC.js.map +1 -0
  485. package/build/esm/cc/UserCodeCC.d.ts +683 -0
  486. package/build/esm/cc/UserCodeCC.d.ts.map +1 -0
  487. package/build/esm/cc/UserCodeCC.js +1695 -0
  488. package/build/esm/cc/UserCodeCC.js.map +1 -0
  489. package/build/esm/cc/VersionCC.d.ts +469 -0
  490. package/build/esm/cc/VersionCC.d.ts.map +1 -0
  491. package/build/esm/cc/VersionCC.js +862 -0
  492. package/build/esm/cc/VersionCC.js.map +1 -0
  493. package/build/esm/cc/WakeUpCC.d.ts +150 -0
  494. package/build/esm/cc/WakeUpCC.d.ts.map +1 -0
  495. package/build/esm/cc/WakeUpCC.js +438 -0
  496. package/build/esm/cc/WakeUpCC.js.map +1 -0
  497. package/build/esm/cc/WindowCoveringCC.d.ts +315 -0
  498. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -0
  499. package/build/esm/cc/WindowCoveringCC.js +780 -0
  500. package/build/esm/cc/WindowCoveringCC.js.map +1 -0
  501. package/build/esm/cc/ZWaveLongRangeCC.d.ts +4 -0
  502. package/build/esm/cc/ZWaveLongRangeCC.d.ts.map +1 -0
  503. package/build/esm/cc/ZWaveLongRangeCC.js +17 -0
  504. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -0
  505. package/build/esm/cc/ZWavePlusCC.d.ts +163 -0
  506. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -0
  507. package/build/esm/cc/ZWavePlusCC.js +267 -0
  508. package/build/esm/cc/ZWavePlusCC.js.map +1 -0
  509. package/build/esm/cc/ZWaveProtocolCC.d.ts +344 -0
  510. package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -0
  511. package/build/esm/cc/ZWaveProtocolCC.js +1030 -0
  512. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -0
  513. package/build/esm/cc/index.d.ts +132 -0
  514. package/build/esm/cc/index.d.ts.map +1 -0
  515. package/build/esm/cc/index.js +71 -0
  516. package/build/esm/cc/index.js.map +1 -0
  517. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +64 -0
  518. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -0
  519. package/build/esm/cc/manufacturerProprietary/Decorators.js +79 -0
  520. package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -0
  521. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +79 -0
  522. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -0
  523. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +385 -0
  524. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -0
  525. package/build/esm/index.d.ts +15 -0
  526. package/build/esm/index.d.ts.map +1 -0
  527. package/build/esm/index.js +14 -0
  528. package/build/esm/index.js.map +1 -0
  529. package/build/esm/index_safe.d.ts +3 -0
  530. package/build/esm/index_safe.d.ts.map +1 -0
  531. package/build/esm/index_safe.js +4 -0
  532. package/build/esm/index_safe.js.map +1 -0
  533. package/build/esm/lib/API.d.ts +271 -0
  534. package/build/esm/lib/API.d.ts.map +1 -0
  535. package/build/esm/lib/API.js +448 -0
  536. package/build/esm/lib/API.js.map +1 -0
  537. package/build/esm/lib/CommandClass.d.ts +234 -0
  538. package/build/esm/lib/CommandClass.d.ts.map +1 -0
  539. package/build/esm/lib/CommandClass.js +781 -0
  540. package/build/esm/lib/CommandClass.js.map +1 -0
  541. package/build/esm/lib/CommandClassDecorators.d.ts +112 -0
  542. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -0
  543. package/build/esm/lib/CommandClassDecorators.js +229 -0
  544. package/build/esm/lib/CommandClassDecorators.js.map +1 -0
  545. package/build/esm/lib/EncapsulatingCommandClass.d.ts +22 -0
  546. package/build/esm/lib/EncapsulatingCommandClass.d.ts.map +1 -0
  547. package/build/esm/lib/EncapsulatingCommandClass.js +56 -0
  548. package/build/esm/lib/EncapsulatingCommandClass.js.map +1 -0
  549. package/build/esm/lib/ICommandClassContainer.d.ts +2 -0
  550. package/build/esm/lib/ICommandClassContainer.d.ts.map +1 -0
  551. package/build/esm/lib/ICommandClassContainer.js +2 -0
  552. package/build/esm/lib/ICommandClassContainer.js.map +1 -0
  553. package/build/esm/lib/NotificationEventPayload.d.ts +10 -0
  554. package/build/esm/lib/NotificationEventPayload.d.ts.map +1 -0
  555. package/build/esm/lib/NotificationEventPayload.js +7 -0
  556. package/build/esm/lib/NotificationEventPayload.js.map +1 -0
  557. package/build/esm/lib/Security2/Extension.d.ts +106 -0
  558. package/build/esm/lib/Security2/Extension.d.ts.map +1 -0
  559. package/build/esm/lib/Security2/Extension.js +296 -0
  560. package/build/esm/lib/Security2/Extension.js.map +1 -0
  561. package/build/esm/lib/Security2/shared.d.ts +37 -0
  562. package/build/esm/lib/Security2/shared.d.ts.map +1 -0
  563. package/build/esm/lib/Security2/shared.js +40 -0
  564. package/build/esm/lib/Security2/shared.js.map +1 -0
  565. package/build/esm/lib/SetValueResult.d.ts +55 -0
  566. package/build/esm/lib/SetValueResult.d.ts.map +1 -0
  567. package/build/esm/lib/SetValueResult.js +53 -0
  568. package/build/esm/lib/SetValueResult.js.map +1 -0
  569. package/build/esm/lib/Values.d.ts +223 -0
  570. package/build/esm/lib/Values.d.ts.map +1 -0
  571. package/build/esm/lib/Values.js +169 -0
  572. package/build/esm/lib/Values.js.map +1 -0
  573. package/build/esm/lib/_Types.d.ts +1461 -0
  574. package/build/esm/lib/_Types.d.ts.map +1 -0
  575. package/build/esm/lib/_Types.js +1432 -0
  576. package/build/esm/lib/_Types.js.map +1 -0
  577. package/build/esm/lib/serializers.d.ts +34 -0
  578. package/build/esm/lib/serializers.d.ts.map +1 -0
  579. package/build/esm/lib/serializers.js +98 -0
  580. package/build/esm/lib/serializers.js.map +1 -0
  581. package/build/esm/lib/utils.d.ts +17 -0
  582. package/build/esm/lib/utils.d.ts.map +1 -0
  583. package/build/esm/lib/utils.js +847 -0
  584. package/build/esm/lib/utils.js.map +1 -0
  585. package/build/esm/package.json +3 -0
  586. package/package.json +28 -23
  587. package/build/cc/AlarmSensorCC.d.ts +0 -194
  588. package/build/cc/AlarmSensorCC.d.ts.map +0 -1
  589. package/build/cc/AlarmSensorCC.js +0 -395
  590. package/build/cc/AlarmSensorCC.js.map +0 -1
  591. package/build/cc/AssociationCC.d.ts +0 -253
  592. package/build/cc/AssociationCC.d.ts.map +0 -1
  593. package/build/cc/AssociationCC.js +0 -732
  594. package/build/cc/AssociationCC.js.map +0 -1
  595. package/build/cc/AssociationGroupInfoCC.d.ts +0 -230
  596. package/build/cc/AssociationGroupInfoCC.d.ts.map +0 -1
  597. package/build/cc/AssociationGroupInfoCC.js +0 -772
  598. package/build/cc/AssociationGroupInfoCC.js.map +0 -1
  599. package/build/cc/BarrierOperatorCC.d.ts +0 -243
  600. package/build/cc/BarrierOperatorCC.d.ts.map +0 -1
  601. package/build/cc/BarrierOperatorCC.js +0 -613
  602. package/build/cc/BarrierOperatorCC.js.map +0 -1
  603. package/build/cc/BasicCC.d.ts +0 -191
  604. package/build/cc/BasicCC.d.ts.map +0 -1
  605. package/build/cc/BasicCC.js +0 -393
  606. package/build/cc/BasicCC.js.map +0 -1
  607. package/build/cc/BatteryCC.d.ts +0 -406
  608. package/build/cc/BatteryCC.d.ts.map +0 -1
  609. package/build/cc/BatteryCC.js +0 -516
  610. package/build/cc/BatteryCC.js.map +0 -1
  611. package/build/cc/BinarySensorCC.d.ts +0 -122
  612. package/build/cc/BinarySensorCC.d.ts.map +0 -1
  613. package/build/cc/BinarySensorCC.js +0 -420
  614. package/build/cc/BinarySensorCC.js.map +0 -1
  615. package/build/cc/BinarySwitchCC.d.ts +0 -139
  616. package/build/cc/BinarySwitchCC.d.ts.map +0 -1
  617. package/build/cc/BinarySwitchCC.js +0 -365
  618. package/build/cc/BinarySwitchCC.js.map +0 -1
  619. package/build/cc/CRC16CC.d.ts +0 -29
  620. package/build/cc/CRC16CC.d.ts.map +0 -1
  621. package/build/cc/CRC16CC.js +0 -126
  622. package/build/cc/CRC16CC.js.map +0 -1
  623. package/build/cc/CentralSceneCC.d.ts +0 -210
  624. package/build/cc/CentralSceneCC.d.ts.map +0 -1
  625. package/build/cc/CentralSceneCC.js +0 -453
  626. package/build/cc/CentralSceneCC.js.map +0 -1
  627. package/build/cc/ClimateControlScheduleCC.d.ts +0 -177
  628. package/build/cc/ClimateControlScheduleCC.d.ts.map +0 -1
  629. package/build/cc/ClimateControlScheduleCC.js +0 -469
  630. package/build/cc/ClimateControlScheduleCC.js.map +0 -1
  631. package/build/cc/ClockCC.d.ts +0 -47
  632. package/build/cc/ClockCC.d.ts.map +0 -1
  633. package/build/cc/ClockCC.js +0 -208
  634. package/build/cc/ClockCC.js.map +0 -1
  635. package/build/cc/ColorSwitchCC.d.ts +0 -339
  636. package/build/cc/ColorSwitchCC.d.ts.map +0 -1
  637. package/build/cc/ColorSwitchCC.js +0 -1152
  638. package/build/cc/ColorSwitchCC.js.map +0 -1
  639. package/build/cc/ConfigurationCC.d.ts +0 -396
  640. package/build/cc/ConfigurationCC.d.ts.map +0 -1
  641. package/build/cc/ConfigurationCC.js +0 -2458
  642. package/build/cc/ConfigurationCC.js.map +0 -1
  643. package/build/cc/DeviceResetLocallyCC.d.ts +0 -17
  644. package/build/cc/DeviceResetLocallyCC.d.ts.map +0 -1
  645. package/build/cc/DeviceResetLocallyCC.js +0 -76
  646. package/build/cc/DeviceResetLocallyCC.js.map +0 -1
  647. package/build/cc/DoorLockCC.d.ts +0 -837
  648. package/build/cc/DoorLockCC.d.ts.map +0 -1
  649. package/build/cc/DoorLockCC.js +0 -1273
  650. package/build/cc/DoorLockCC.js.map +0 -1
  651. package/build/cc/DoorLockLoggingCC.d.ts +0 -77
  652. package/build/cc/DoorLockLoggingCC.d.ts.map +0 -1
  653. package/build/cc/DoorLockLoggingCC.js +0 -319
  654. package/build/cc/DoorLockLoggingCC.js.map +0 -1
  655. package/build/cc/EnergyProductionCC.d.ts +0 -77
  656. package/build/cc/EnergyProductionCC.d.ts.map +0 -1
  657. package/build/cc/EnergyProductionCC.js +0 -216
  658. package/build/cc/EnergyProductionCC.js.map +0 -1
  659. package/build/cc/EntryControlCC.d.ts +0 -231
  660. package/build/cc/EntryControlCC.d.ts.map +0 -1
  661. package/build/cc/EntryControlCC.js +0 -607
  662. package/build/cc/EntryControlCC.js.map +0 -1
  663. package/build/cc/FirmwareUpdateMetaDataCC.d.ts +0 -359
  664. package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +0 -1
  665. package/build/cc/FirmwareUpdateMetaDataCC.js +0 -1145
  666. package/build/cc/FirmwareUpdateMetaDataCC.js.map +0 -1
  667. package/build/cc/HailCC.d.ts +0 -6
  668. package/build/cc/HailCC.d.ts.map +0 -1
  669. package/build/cc/HailCC.js +0 -24
  670. package/build/cc/HailCC.js.map +0 -1
  671. package/build/cc/HumidityControlModeCC.d.ts +0 -111
  672. package/build/cc/HumidityControlModeCC.d.ts.map +0 -1
  673. package/build/cc/HumidityControlModeCC.js +0 -308
  674. package/build/cc/HumidityControlModeCC.js.map +0 -1
  675. package/build/cc/HumidityControlOperatingStateCC.d.ts +0 -60
  676. package/build/cc/HumidityControlOperatingStateCC.d.ts.map +0 -1
  677. package/build/cc/HumidityControlOperatingStateCC.js +0 -140
  678. package/build/cc/HumidityControlOperatingStateCC.js.map +0 -1
  679. package/build/cc/HumidityControlSetpointCC.d.ts +0 -209
  680. package/build/cc/HumidityControlSetpointCC.d.ts.map +0 -1
  681. package/build/cc/HumidityControlSetpointCC.js +0 -648
  682. package/build/cc/HumidityControlSetpointCC.js.map +0 -1
  683. package/build/cc/InclusionControllerCC.d.ts +0 -42
  684. package/build/cc/InclusionControllerCC.d.ts.map +0 -1
  685. package/build/cc/InclusionControllerCC.js +0 -136
  686. package/build/cc/InclusionControllerCC.js.map +0 -1
  687. package/build/cc/IndicatorCC.d.ts +0 -338
  688. package/build/cc/IndicatorCC.d.ts.map +0 -1
  689. package/build/cc/IndicatorCC.js +0 -1320
  690. package/build/cc/IndicatorCC.js.map +0 -1
  691. package/build/cc/IrrigationCC.d.ts +0 -1496
  692. package/build/cc/IrrigationCC.d.ts.map +0 -1
  693. package/build/cc/IrrigationCC.js +0 -2041
  694. package/build/cc/IrrigationCC.js.map +0 -1
  695. package/build/cc/LanguageCC.d.ts +0 -101
  696. package/build/cc/LanguageCC.d.ts.map +0 -1
  697. package/build/cc/LanguageCC.js +0 -246
  698. package/build/cc/LanguageCC.js.map +0 -1
  699. package/build/cc/LockCC.d.ts +0 -73
  700. package/build/cc/LockCC.d.ts.map +0 -1
  701. package/build/cc/LockCC.js +0 -200
  702. package/build/cc/LockCC.js.map +0 -1
  703. package/build/cc/ManufacturerProprietaryCC.d.ts +0 -32
  704. package/build/cc/ManufacturerProprietaryCC.d.ts.map +0 -1
  705. package/build/cc/ManufacturerProprietaryCC.js +0 -204
  706. package/build/cc/ManufacturerProprietaryCC.js.map +0 -1
  707. package/build/cc/ManufacturerSpecificCC.d.ts +0 -171
  708. package/build/cc/ManufacturerSpecificCC.d.ts.map +0 -1
  709. package/build/cc/ManufacturerSpecificCC.js +0 -318
  710. package/build/cc/ManufacturerSpecificCC.js.map +0 -1
  711. package/build/cc/MeterCC.d.ts +0 -318
  712. package/build/cc/MeterCC.d.ts.map +0 -1
  713. package/build/cc/MeterCC.js +0 -1312
  714. package/build/cc/MeterCC.js.map +0 -1
  715. package/build/cc/MultiChannelAssociationCC.d.ts +0 -241
  716. package/build/cc/MultiChannelAssociationCC.d.ts.map +0 -1
  717. package/build/cc/MultiChannelAssociationCC.js +0 -1007
  718. package/build/cc/MultiChannelAssociationCC.js.map +0 -1
  719. package/build/cc/MultiChannelCC.d.ts +0 -394
  720. package/build/cc/MultiChannelCC.d.ts.map +0 -1
  721. package/build/cc/MultiChannelCC.js +0 -1130
  722. package/build/cc/MultiChannelCC.js.map +0 -1
  723. package/build/cc/MultiCommandCC.d.ts +0 -27
  724. package/build/cc/MultiCommandCC.d.ts.map +0 -1
  725. package/build/cc/MultiCommandCC.js +0 -145
  726. package/build/cc/MultiCommandCC.js.map +0 -1
  727. package/build/cc/MultilevelSensorCC.d.ts +0 -185
  728. package/build/cc/MultilevelSensorCC.d.ts.map +0 -1
  729. package/build/cc/MultilevelSensorCC.js +0 -756
  730. package/build/cc/MultilevelSensorCC.js.map +0 -1
  731. package/build/cc/MultilevelSwitchCC.d.ts +0 -357
  732. package/build/cc/MultilevelSwitchCC.d.ts.map +0 -1
  733. package/build/cc/MultilevelSwitchCC.js +0 -813
  734. package/build/cc/MultilevelSwitchCC.js.map +0 -1
  735. package/build/cc/NoOperationCC.d.ts +0 -9
  736. package/build/cc/NoOperationCC.d.ts.map +0 -1
  737. package/build/cc/NoOperationCC.js +0 -42
  738. package/build/cc/NoOperationCC.js.map +0 -1
  739. package/build/cc/NodeNamingCC.d.ts +0 -118
  740. package/build/cc/NodeNamingCC.d.ts.map +0 -1
  741. package/build/cc/NodeNamingCC.js +0 -348
  742. package/build/cc/NodeNamingCC.js.map +0 -1
  743. package/build/cc/NotificationCC.d.ts +0 -479
  744. package/build/cc/NotificationCC.d.ts.map +0 -1
  745. package/build/cc/NotificationCC.js +0 -1379
  746. package/build/cc/NotificationCC.js.map +0 -1
  747. package/build/cc/PowerlevelCC.d.ts +0 -82
  748. package/build/cc/PowerlevelCC.d.ts.map +0 -1
  749. package/build/cc/PowerlevelCC.js +0 -488
  750. package/build/cc/PowerlevelCC.js.map +0 -1
  751. package/build/cc/ProtectionCC.d.ts +0 -325
  752. package/build/cc/ProtectionCC.d.ts.map +0 -1
  753. package/build/cc/ProtectionCC.js +0 -672
  754. package/build/cc/ProtectionCC.js.map +0 -1
  755. package/build/cc/SceneActivationCC.d.ts +0 -89
  756. package/build/cc/SceneActivationCC.d.ts.map +0 -1
  757. package/build/cc/SceneActivationCC.js +0 -169
  758. package/build/cc/SceneActivationCC.js.map +0 -1
  759. package/build/cc/SceneActuatorConfigurationCC.d.ts +0 -120
  760. package/build/cc/SceneActuatorConfigurationCC.d.ts.map +0 -1
  761. package/build/cc/SceneActuatorConfigurationCC.js +0 -377
  762. package/build/cc/SceneActuatorConfigurationCC.js.map +0 -1
  763. package/build/cc/SceneControllerConfigurationCC.d.ts +0 -129
  764. package/build/cc/SceneControllerConfigurationCC.d.ts.map +0 -1
  765. package/build/cc/SceneControllerConfigurationCC.js +0 -449
  766. package/build/cc/SceneControllerConfigurationCC.js.map +0 -1
  767. package/build/cc/ScheduleEntryLockCC.d.ts +0 -434
  768. package/build/cc/ScheduleEntryLockCC.d.ts.map +0 -1
  769. package/build/cc/ScheduleEntryLockCC.js +0 -1829
  770. package/build/cc/ScheduleEntryLockCC.js.map +0 -1
  771. package/build/cc/Security2CC.d.ts +0 -251
  772. package/build/cc/Security2CC.d.ts.map +0 -1
  773. package/build/cc/Security2CC.js +0 -1817
  774. package/build/cc/Security2CC.js.map +0 -1
  775. package/build/cc/SecurityCC.d.ts +0 -128
  776. package/build/cc/SecurityCC.d.ts.map +0 -1
  777. package/build/cc/SecurityCC.js +0 -803
  778. package/build/cc/SecurityCC.js.map +0 -1
  779. package/build/cc/SoundSwitchCC.d.ts +0 -232
  780. package/build/cc/SoundSwitchCC.d.ts.map +0 -1
  781. package/build/cc/SoundSwitchCC.js +0 -636
  782. package/build/cc/SoundSwitchCC.js.map +0 -1
  783. package/build/cc/SupervisionCC.d.ts +0 -104
  784. package/build/cc/SupervisionCC.d.ts.map +0 -1
  785. package/build/cc/SupervisionCC.js +0 -322
  786. package/build/cc/SupervisionCC.js.map +0 -1
  787. package/build/cc/ThermostatFanModeCC.d.ts +0 -141
  788. package/build/cc/ThermostatFanModeCC.d.ts.map +0 -1
  789. package/build/cc/ThermostatFanModeCC.js +0 -362
  790. package/build/cc/ThermostatFanModeCC.js.map +0 -1
  791. package/build/cc/ThermostatFanStateCC.d.ts +0 -60
  792. package/build/cc/ThermostatFanStateCC.d.ts.map +0 -1
  793. package/build/cc/ThermostatFanStateCC.js +0 -142
  794. package/build/cc/ThermostatFanStateCC.js.map +0 -1
  795. package/build/cc/ThermostatModeCC.d.ts +0 -150
  796. package/build/cc/ThermostatModeCC.d.ts.map +0 -1
  797. package/build/cc/ThermostatModeCC.js +0 -429
  798. package/build/cc/ThermostatModeCC.js.map +0 -1
  799. package/build/cc/ThermostatOperatingStateCC.d.ts +0 -61
  800. package/build/cc/ThermostatOperatingStateCC.d.ts.map +0 -1
  801. package/build/cc/ThermostatOperatingStateCC.js +0 -138
  802. package/build/cc/ThermostatOperatingStateCC.js.map +0 -1
  803. package/build/cc/ThermostatSetbackCC.d.ts +0 -46
  804. package/build/cc/ThermostatSetbackCC.d.ts.map +0 -1
  805. package/build/cc/ThermostatSetbackCC.js +0 -247
  806. package/build/cc/ThermostatSetbackCC.js.map +0 -1
  807. package/build/cc/ThermostatSetpointCC.d.ts +0 -197
  808. package/build/cc/ThermostatSetpointCC.d.ts.map +0 -1
  809. package/build/cc/ThermostatSetpointCC.js +0 -658
  810. package/build/cc/ThermostatSetpointCC.js.map +0 -1
  811. package/build/cc/TimeCC.d.ts +0 -88
  812. package/build/cc/TimeCC.d.ts.map +0 -1
  813. package/build/cc/TimeCC.js +0 -454
  814. package/build/cc/TimeCC.js.map +0 -1
  815. package/build/cc/TimeParametersCC.d.ts +0 -72
  816. package/build/cc/TimeParametersCC.d.ts.map +0 -1
  817. package/build/cc/TimeParametersCC.js +0 -303
  818. package/build/cc/TimeParametersCC.js.map +0 -1
  819. package/build/cc/TransportServiceCC.d.ts +0 -107
  820. package/build/cc/TransportServiceCC.d.ts.map +0 -1
  821. package/build/cc/TransportServiceCC.js +0 -426
  822. package/build/cc/TransportServiceCC.js.map +0 -1
  823. package/build/cc/UserCodeCC.d.ts +0 -683
  824. package/build/cc/UserCodeCC.d.ts.map +0 -1
  825. package/build/cc/UserCodeCC.js +0 -1699
  826. package/build/cc/UserCodeCC.js.map +0 -1
  827. package/build/cc/VersionCC.d.ts +0 -469
  828. package/build/cc/VersionCC.d.ts.map +0 -1
  829. package/build/cc/VersionCC.js +0 -865
  830. package/build/cc/VersionCC.js.map +0 -1
  831. package/build/cc/WakeUpCC.d.ts +0 -150
  832. package/build/cc/WakeUpCC.d.ts.map +0 -1
  833. package/build/cc/WakeUpCC.js +0 -441
  834. package/build/cc/WakeUpCC.js.map +0 -1
  835. package/build/cc/WindowCoveringCC.d.ts +0 -315
  836. package/build/cc/WindowCoveringCC.d.ts.map +0 -1
  837. package/build/cc/WindowCoveringCC.js +0 -783
  838. package/build/cc/WindowCoveringCC.js.map +0 -1
  839. package/build/cc/ZWaveLongRangeCC.d.ts +0 -4
  840. package/build/cc/ZWaveLongRangeCC.d.ts.map +0 -1
  841. package/build/cc/ZWaveLongRangeCC.js +0 -20
  842. package/build/cc/ZWaveLongRangeCC.js.map +0 -1
  843. package/build/cc/ZWavePlusCC.d.ts +0 -163
  844. package/build/cc/ZWavePlusCC.d.ts.map +0 -1
  845. package/build/cc/ZWavePlusCC.js +0 -270
  846. package/build/cc/ZWavePlusCC.js.map +0 -1
  847. package/build/cc/ZWaveProtocolCC.d.ts +0 -344
  848. package/build/cc/ZWaveProtocolCC.d.ts.map +0 -1
  849. package/build/cc/ZWaveProtocolCC.js +0 -1033
  850. package/build/cc/ZWaveProtocolCC.js.map +0 -1
  851. package/build/cc/index.d.ts +0 -132
  852. package/build/cc/index.d.ts.map +0 -1
  853. package/build/cc/index.js +0 -627
  854. package/build/cc/index.js.map +0 -1
  855. package/build/cc/manufacturerProprietary/Decorators.d.ts +0 -64
  856. package/build/cc/manufacturerProprietary/Decorators.d.ts.map +0 -1
  857. package/build/cc/manufacturerProprietary/Decorators.js +0 -83
  858. package/build/cc/manufacturerProprietary/Decorators.js.map +0 -1
  859. package/build/cc/manufacturerProprietary/FibaroCC.d.ts +0 -79
  860. package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +0 -1
  861. package/build/cc/manufacturerProprietary/FibaroCC.js +0 -392
  862. package/build/cc/manufacturerProprietary/FibaroCC.js.map +0 -1
  863. package/build/index.d.ts +0 -15
  864. package/build/index.d.ts.map +0 -1
  865. package/build/index.js +0 -52
  866. package/build/index.js.map +0 -1
  867. package/build/index_safe.d.ts +0 -3
  868. package/build/index_safe.d.ts.map +0 -1
  869. package/build/index_safe.js +0 -20
  870. package/build/index_safe.js.map +0 -1
  871. package/build/lib/API.d.ts +0 -271
  872. package/build/lib/API.d.ts.map +0 -1
  873. package/build/lib/API.js +0 -458
  874. package/build/lib/API.js.map +0 -1
  875. package/build/lib/CommandClass.d.ts +0 -234
  876. package/build/lib/CommandClass.d.ts.map +0 -1
  877. package/build/lib/CommandClass.js +0 -788
  878. package/build/lib/CommandClass.js.map +0 -1
  879. package/build/lib/CommandClassDecorators.d.ts +0 -112
  880. package/build/lib/CommandClassDecorators.d.ts.map +0 -1
  881. package/build/lib/CommandClassDecorators.js +0 -243
  882. package/build/lib/CommandClassDecorators.js.map +0 -1
  883. package/build/lib/EncapsulatingCommandClass.d.ts +0 -22
  884. package/build/lib/EncapsulatingCommandClass.d.ts.map +0 -1
  885. package/build/lib/EncapsulatingCommandClass.js +0 -61
  886. package/build/lib/EncapsulatingCommandClass.js.map +0 -1
  887. package/build/lib/ICommandClassContainer.d.ts.map +0 -1
  888. package/build/lib/ICommandClassContainer.js +0 -3
  889. package/build/lib/ICommandClassContainer.js.map +0 -1
  890. package/build/lib/NotificationEventPayload.d.ts +0 -10
  891. package/build/lib/NotificationEventPayload.d.ts.map +0 -1
  892. package/build/lib/NotificationEventPayload.js +0 -10
  893. package/build/lib/NotificationEventPayload.js.map +0 -1
  894. package/build/lib/Security2/Extension.d.ts.map +0 -1
  895. package/build/lib/Security2/Extension.js +0 -303
  896. package/build/lib/Security2/Extension.js.map +0 -1
  897. package/build/lib/Security2/shared.d.ts.map +0 -1
  898. package/build/lib/Security2/shared.js +0 -43
  899. package/build/lib/Security2/shared.js.map +0 -1
  900. package/build/lib/SetValueResult.d.ts.map +0 -1
  901. package/build/lib/SetValueResult.js +0 -60
  902. package/build/lib/SetValueResult.js.map +0 -1
  903. package/build/lib/Values.d.ts +0 -223
  904. package/build/lib/Values.d.ts.map +0 -1
  905. package/build/lib/Values.js +0 -172
  906. package/build/lib/Values.js.map +0 -1
  907. package/build/lib/_Types.d.ts.map +0 -1
  908. package/build/lib/_Types.js +0 -1443
  909. package/build/lib/_Types.js.map +0 -1
  910. package/build/lib/serializers.d.ts +0 -34
  911. package/build/lib/serializers.d.ts.map +0 -1
  912. package/build/lib/serializers.js +0 -107
  913. package/build/lib/serializers.js.map +0 -1
  914. package/build/lib/utils.d.ts +0 -17
  915. package/build/lib/utils.d.ts.map +0 -1
  916. package/build/lib/utils.js +0 -860
  917. package/build/lib/utils.js.map +0 -1
  918. /package/build/{lib → cjs/lib}/ICommandClassContainer.d.ts +0 -0
  919. /package/build/{lib → cjs/lib}/Security2/Extension.d.ts +0 -0
  920. /package/build/{lib → cjs/lib}/Security2/shared.d.ts +0 -0
  921. /package/build/{lib → cjs/lib}/SetValueResult.d.ts +0 -0
  922. /package/build/{lib → cjs/lib}/_Types.d.ts +0 -0
@@ -0,0 +1,1814 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var Security2CC_1, Security2CCMessageEncapsulation_1, Security2CCNonceReport_1, Security2CCNonceGet_1, Security2CCKEXReport_1, Security2CCKEXSet_1, Security2CCKEXFail_1, Security2CCPublicKeyReport_1, Security2CCNetworkKeyReport_1, Security2CCNetworkKeyGet_1, Security2CCTransferEnd_1, Security2CCCommandsSupportedReport_1;
8
+ import { CommandClasses, MPANState, MessagePriority, SECURITY_S2_AUTH_TAG_LENGTH, SPANState, SecurityClass, TransmitOptions, ZWaveError, ZWaveErrorCodes, decryptAES128CCM, encodeBitMask, encryptAES128CCM, getCCName, highResTimestamp, isLongRangeNodeId, isTransmissionError, isZWaveError, parseBitMask, parseCCList, securityClassIsS2, securityClassOrder, validatePayload, } from "@zwave-js/core";
9
+ import { EncapsulationFlags, NODE_ID_BROADCAST, NODE_ID_BROADCAST_LR, encodeCCList, } from "@zwave-js/core/safe";
10
+ import { Bytes } from "@zwave-js/shared/safe";
11
+ import { buffer2hex, getEnumMemberName, pick } from "@zwave-js/shared/safe";
12
+ import { wait } from "alcalzone-shared/async/index.js";
13
+ import { isArray } from "alcalzone-shared/typeguards/index.js";
14
+ import { CCAPI } from "../lib/API.js";
15
+ import { CommandClass, } from "../lib/CommandClass.js";
16
+ import { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, } from "../lib/CommandClassDecorators.js";
17
+ import { MGRPExtension, MOSExtension, MPANExtension, SPANExtension, Security2Extension, ValidateS2ExtensionResult, validateS2Extension, } from "../lib/Security2/Extension.js";
18
+ import { ECDHProfiles, KEXFailType, KEXSchemes, } from "../lib/Security2/shared.js";
19
+ import { Security2Command } from "../lib/_Types.js";
20
+ import { CRC16CC } from "./CRC16CC.js";
21
+ import { MultiChannelCC } from "./MultiChannelCC.js";
22
+ import { SecurityCC } from "./SecurityCC.js";
23
+ import { TransportServiceCC } from "./TransportServiceCC.js";
24
+ function securityClassToBitMask(key) {
25
+ return encodeBitMask([key], SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated);
26
+ }
27
+ function bitMaskToSecurityClass(buffer, offset) {
28
+ const keys = parseBitMask(buffer.subarray(offset, offset + 1), SecurityClass.S2_Unauthenticated);
29
+ validatePayload(keys.length === 1);
30
+ return keys[0];
31
+ }
32
+ function getAuthenticationData(sendingNodeId, destination, homeId, commandLength, unencryptedPayload) {
33
+ const nodeIdSize = isLongRangeNodeId(sendingNodeId) || isLongRangeNodeId(destination)
34
+ ? 2
35
+ : 1;
36
+ const ret = new Bytes(2 * nodeIdSize + 6 + unencryptedPayload.length);
37
+ let offset = 0;
38
+ ret.writeUIntBE(sendingNodeId, offset, nodeIdSize);
39
+ offset += nodeIdSize;
40
+ ret.writeUIntBE(destination, offset, nodeIdSize);
41
+ offset += nodeIdSize;
42
+ ret.writeUInt32BE(homeId, offset);
43
+ offset += 4;
44
+ ret.writeUInt16BE(commandLength, offset);
45
+ offset += 2;
46
+ // This includes the sequence number and all unencrypted extensions
47
+ ret.set(unencryptedPayload, offset);
48
+ return ret;
49
+ }
50
+ function getSecurityManager(ownNodeId, securityManagers, otherNodeId) {
51
+ const longRange = isLongRangeNodeId(ownNodeId)
52
+ || isLongRangeNodeId(isArray(otherNodeId) ? otherNodeId[0] : otherNodeId);
53
+ return longRange
54
+ ? securityManagers.securityManagerLR
55
+ : securityManagers.securityManager2;
56
+ }
57
+ /** Validates that a sequence number is not a duplicate and updates the SPAN table if it is accepted. Returns the previous sequence number if there is one. */
58
+ function validateSequenceNumber(securityManager, sourceNodeId, sequenceNumber) {
59
+ validatePayload.withReason(`Duplicate command (sequence number ${sequenceNumber})`)(!securityManager.isDuplicateSinglecast(sourceNodeId, sequenceNumber));
60
+ // Not a duplicate, store it
61
+ return securityManager.storeSequenceNumber(sourceNodeId, sequenceNumber);
62
+ }
63
+ const MAX_DECRYPT_ATTEMPTS_SINGLECAST = 5;
64
+ const MAX_DECRYPT_ATTEMPTS_MULTICAST = 5;
65
+ const MAX_DECRYPT_ATTEMPTS_SC_FOLLOWUP = 1;
66
+ function assertSecurityRX(ctx) {
67
+ if (!ctx.ownNodeId) {
68
+ throw new ZWaveError(`Secure commands (S2) can only be decoded when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady);
69
+ }
70
+ const ret = getSecurityManager(ctx.ownNodeId, ctx, ctx.sourceNodeId);
71
+ if (!ret) {
72
+ throw new ZWaveError(`Secure commands (S2) can only be decoded when the security manager is set up!`, ZWaveErrorCodes.Driver_NoSecurity);
73
+ }
74
+ return ret;
75
+ }
76
+ function assertSecurityTX(ctx, destination) {
77
+ if (!ctx.ownNodeId) {
78
+ throw new ZWaveError(`Secure commands (S2) can only be sent when the controller's node id is known!`, ZWaveErrorCodes.Driver_NotReady);
79
+ }
80
+ const ret = getSecurityManager(ctx.ownNodeId, ctx, destination);
81
+ if (!ret) {
82
+ throw new ZWaveError(`Secure commands (S2) can only be sent when the security manager is set up!`, ZWaveErrorCodes.Driver_NoSecurity);
83
+ }
84
+ return ret;
85
+ }
86
+ function decryptSinglecast(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
87
+ const decryptWithNonce = (nonce) => {
88
+ const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
89
+ const iv = nonce;
90
+ return {
91
+ key,
92
+ iv,
93
+ ...decryptAES128CCM(key, iv, ciphertext, authData, authTag),
94
+ };
95
+ };
96
+ const getNonceAndDecrypt = () => {
97
+ const iv = securityManager.nextNonce(sendingNodeId);
98
+ return decryptWithNonce(iv);
99
+ };
100
+ if (spanState.type === SPANState.SPAN) {
101
+ // There SHOULD be a shared SPAN between both parties. But experience has shown that both could have
102
+ // sent a command at roughly the same time, using the same SPAN for encryption.
103
+ // To avoid a nasty desync and both nodes trying to resync at the same time, causing message loss,
104
+ // we accept commands encrypted with the previous SPAN under very specific circumstances:
105
+ if (
106
+ // The previous SPAN is still known, i.e. the node didn't send another command that was successfully decrypted
107
+ !!spanState.currentSPAN
108
+ // it is still valid
109
+ && spanState.currentSPAN.expires > highResTimestamp()
110
+ // The received command is exactly the next, expected one
111
+ && prevSequenceNumber != undefined
112
+ && curSequenceNumber === ((prevSequenceNumber + 1) & 0xff)
113
+ // And in case of a mock-based test, do this only on the controller
114
+ && !ctx.__internalIsMockNode) {
115
+ const nonce = spanState.currentSPAN.nonce;
116
+ spanState.currentSPAN = undefined;
117
+ // If we could decrypt this way, we're done...
118
+ const result = decryptWithNonce(nonce);
119
+ if (result.authOK) {
120
+ return {
121
+ ...result,
122
+ securityClass: spanState.securityClass,
123
+ };
124
+ }
125
+ // ...otherwise, we need to try the normal way
126
+ }
127
+ else {
128
+ // forgetting the current SPAN shouldn't be necessary but better be safe than sorry
129
+ spanState.currentSPAN = undefined;
130
+ }
131
+ // This can only happen if the security class is known
132
+ return {
133
+ ...getNonceAndDecrypt(),
134
+ securityClass: spanState.securityClass,
135
+ };
136
+ }
137
+ else if (spanState.type === SPANState.LocalEI) {
138
+ // We've sent the other our receiver's EI and received its sender's EI,
139
+ // meaning we can now establish an SPAN
140
+ const senderEI = getSenderEI(extensions);
141
+ if (!senderEI)
142
+ failNoSPAN();
143
+ const receiverEI = spanState.receiverEI;
144
+ // How we do this depends on whether we know the security class of the other node
145
+ const isBootstrappingNode = securityManager.tempKeys.has(sendingNodeId);
146
+ if (isBootstrappingNode) {
147
+ // We're currently bootstrapping the node, it might be using a temporary key
148
+ securityManager.initializeTempSPAN(sendingNodeId, senderEI, receiverEI);
149
+ const ret = getNonceAndDecrypt();
150
+ // Decryption with the temporary key worked
151
+ if (ret.authOK) {
152
+ return {
153
+ ...ret,
154
+ securityClass: SecurityClass.Temporary,
155
+ };
156
+ }
157
+ // Reset the SPAN state and try with the recently granted security class
158
+ securityManager.setSPANState(sendingNodeId, spanState);
159
+ }
160
+ // When ending up here, one of two situations has occured:
161
+ // a) We've taken over an existing network and do not know the node's security class
162
+ // b) We know the security class, but we're about to establish a new SPAN. This may happen at a lower
163
+ // security class than the one the node normally uses, e.g. when we're being queried for securely
164
+ // supported CCs.
165
+ // In both cases, we should simply try decoding with multiple security classes, starting from the highest one.
166
+ // If this fails, we restore the previous (partial) SPAN state.
167
+ // Try all security classes where we do not definitely know that it was not granted
168
+ // While bootstrapping a node, we consider the key that is being exchanged (including S0) to be the highest. No need to look at others
169
+ const possibleSecurityClasses = isBootstrappingNode
170
+ ? [ctx.getHighestSecurityClass(sendingNodeId)]
171
+ : securityClassOrder.filter((s) => ctx.hasSecurityClass(sendingNodeId, s)
172
+ !== false);
173
+ for (const secClass of possibleSecurityClasses) {
174
+ // Skip security classes we don't have keys for
175
+ if (!securityManager.hasKeysForSecurityClass(secClass)) {
176
+ continue;
177
+ }
178
+ // Initialize an SPAN with that security class
179
+ securityManager.initializeSPAN(sendingNodeId, secClass, senderEI, receiverEI);
180
+ const ret = getNonceAndDecrypt();
181
+ // It worked, return the result
182
+ if (ret.authOK) {
183
+ // Also if we weren't sure before, we now know that the security class is granted
184
+ if (ctx.hasSecurityClass(sendingNodeId, secClass)
185
+ === undefined) {
186
+ ctx.setSecurityClass(sendingNodeId, secClass, true);
187
+ }
188
+ return {
189
+ ...ret,
190
+ securityClass: secClass,
191
+ };
192
+ }
193
+ else {
194
+ // Reset the SPAN state and try with the next security class
195
+ securityManager.setSPANState(sendingNodeId, spanState);
196
+ }
197
+ }
198
+ }
199
+ // Nothing worked, fail the decryption
200
+ return {
201
+ plaintext: new Uint8Array(),
202
+ authOK: false,
203
+ securityClass: undefined,
204
+ };
205
+ }
206
+ function decryptMulticast(sendingNodeId, securityManager, groupId, ciphertext, authData, authTag) {
207
+ const iv = securityManager.nextPeerMPAN(sendingNodeId, groupId);
208
+ const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
209
+ return {
210
+ key,
211
+ iv,
212
+ ...decryptAES128CCM(key, iv, ciphertext, authData, authTag),
213
+ // The security class is irrelevant when decrypting multicast commands
214
+ securityClass: undefined,
215
+ };
216
+ }
217
+ function getDestinationIDTX() {
218
+ if (this.isSinglecast())
219
+ return this.nodeId;
220
+ const ret = getMulticastGroupId(this.extensions);
221
+ if (ret == undefined) {
222
+ throw new ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", ZWaveErrorCodes.Security2CC_MissingExtension);
223
+ }
224
+ return ret;
225
+ }
226
+ function getDestinationIDRX(ctx, extensions) {
227
+ if (ctx.frameType === "singlecast") {
228
+ return ctx.ownNodeId;
229
+ }
230
+ const ret = getMulticastGroupId(extensions);
231
+ if (ret == undefined) {
232
+ throw new ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", ZWaveErrorCodes.Security2CC_MissingExtension);
233
+ }
234
+ return ret;
235
+ }
236
+ function getMulticastGroupId(extensions) {
237
+ const mgrpExtension = extensions.find((e) => e instanceof MGRPExtension);
238
+ return mgrpExtension?.groupId;
239
+ }
240
+ /** Returns the Sender's Entropy Input if this command contains an SPAN extension */
241
+ function getSenderEI(extensions) {
242
+ const spanExtension = extensions.find((e) => e instanceof SPANExtension);
243
+ return spanExtension?.senderEI;
244
+ }
245
+ // Encapsulation CCs are used internally and too frequently that we
246
+ // want to pay the cost of validating each call
247
+ /* eslint-disable @zwave-js/ccapi-validate-args */
248
+ let Security2CCAPI = class Security2CCAPI extends CCAPI {
249
+ supportsCommand(_cmd) {
250
+ // All commands are mandatory
251
+ return true;
252
+ }
253
+ /**
254
+ * Sends a nonce to the node, either in response to a NonceGet request or a message that failed to decrypt. The message is sent without any retransmission etc.
255
+ * The return value indicates whether a nonce was successfully sent
256
+ */
257
+ async sendNonce() {
258
+ this.assertSupportsCommand(Security2Command, Security2Command.NonceReport);
259
+ this.assertPhysicalEndpoint(this.endpoint);
260
+ const securityManager = getSecurityManager(this.host.ownNodeId, this.host, this.endpoint.nodeId);
261
+ if (!securityManager) {
262
+ throw new ZWaveError(`Nonces can only be sent if secure communication is set up!`, ZWaveErrorCodes.Driver_NoSecurity);
263
+ }
264
+ const receiverEI = securityManager.generateNonce(this.endpoint.nodeId);
265
+ const cc = new Security2CCNonceReport({
266
+ nodeId: this.endpoint.nodeId,
267
+ endpointIndex: this.endpoint.index,
268
+ SOS: true,
269
+ MOS: false,
270
+ receiverEI,
271
+ });
272
+ try {
273
+ await this.host.sendCommand(cc, {
274
+ ...this.commandOptions,
275
+ // Seems we need these options or some nodes won't accept the nonce
276
+ transmitOptions: TransmitOptions.ACK
277
+ | TransmitOptions.AutoRoute,
278
+ // Only try sending a nonce once
279
+ maxSendAttempts: 1,
280
+ // Nonce requests must be handled immediately
281
+ priority: MessagePriority.Immediate,
282
+ // We don't want failures causing us to treat the node as asleep or dead
283
+ changeNodeStatusOnMissingACK: false,
284
+ // And we need to react to
285
+ });
286
+ }
287
+ catch (e) {
288
+ if (isTransmissionError(e)) {
289
+ // The nonce could not be sent, invalidate it
290
+ securityManager.deleteNonce(this.endpoint.nodeId);
291
+ return false;
292
+ }
293
+ else {
294
+ // Pass other errors through
295
+ throw e;
296
+ }
297
+ }
298
+ return true;
299
+ }
300
+ /** Notifies the target node that the MPAN state is out of sync */
301
+ async sendMOS() {
302
+ this.assertSupportsCommand(Security2Command, Security2Command.NonceReport);
303
+ this.assertPhysicalEndpoint(this.endpoint);
304
+ const cc = new Security2CCNonceReport({
305
+ nodeId: this.endpoint.nodeId,
306
+ endpointIndex: this.endpoint.index,
307
+ SOS: false,
308
+ MOS: true,
309
+ });
310
+ try {
311
+ await this.host.sendCommand(cc, {
312
+ ...this.commandOptions,
313
+ // Seems we need these options or some nodes won't accept the nonce
314
+ transmitOptions: TransmitOptions.ACK
315
+ | TransmitOptions.AutoRoute,
316
+ // Only try sending a nonce once
317
+ maxSendAttempts: 1,
318
+ // Nonce requests must be handled immediately
319
+ priority: MessagePriority.Immediate,
320
+ // We don't want failures causing us to treat the node as asleep or dead
321
+ changeNodeStatusOnMissingACK: false,
322
+ });
323
+ }
324
+ catch (e) {
325
+ if (isTransmissionError(e)) {
326
+ return false;
327
+ }
328
+ else {
329
+ // Pass other errors through
330
+ throw e;
331
+ }
332
+ }
333
+ return true;
334
+ }
335
+ /** Sends the given MPAN to the node */
336
+ async sendMPAN(groupId, innerMPANState) {
337
+ this.assertSupportsCommand(Security2Command, Security2Command.MessageEncapsulation);
338
+ this.assertPhysicalEndpoint(this.endpoint);
339
+ const cc = new Security2CCMessageEncapsulation({
340
+ nodeId: this.endpoint.nodeId,
341
+ endpointIndex: this.endpoint.index,
342
+ extensions: [
343
+ new MPANExtension({
344
+ groupId,
345
+ innerMPANState,
346
+ }),
347
+ ],
348
+ });
349
+ try {
350
+ await this.host.sendCommand(cc, {
351
+ ...this.commandOptions,
352
+ // Seems we need these options or some nodes won't accept the nonce
353
+ transmitOptions: TransmitOptions.ACK
354
+ | TransmitOptions.AutoRoute,
355
+ // Only try sending a nonce once
356
+ maxSendAttempts: 1,
357
+ // Nonce requests must be handled immediately
358
+ priority: MessagePriority.Immediate,
359
+ // We don't want failures causing us to treat the node as asleep or dead
360
+ changeNodeStatusOnMissingACK: false,
361
+ });
362
+ }
363
+ catch (e) {
364
+ if (isTransmissionError(e)) {
365
+ return false;
366
+ }
367
+ else {
368
+ // Pass other errors through
369
+ throw e;
370
+ }
371
+ }
372
+ return true;
373
+ }
374
+ /**
375
+ * Queries the securely supported commands for the current security class
376
+ * @param securityClass Can be used to overwrite the security class to use. If this doesn't match the current one, new nonces will need to be exchanged.
377
+ */
378
+ async getSupportedCommands(securityClass) {
379
+ this.assertSupportsCommand(Security2Command, Security2Command.CommandsSupportedGet);
380
+ let cc = new Security2CCCommandsSupportedGet({
381
+ nodeId: this.endpoint.nodeId,
382
+ endpointIndex: this.endpoint.index,
383
+ });
384
+ // Security2CCCommandsSupportedGet is special because we cannot reply on the applHost to do the automatic
385
+ // encapsulation because it would use a different security class. Therefore the entire possible stack
386
+ // of encapsulation needs to be done here
387
+ if (MultiChannelCC.requiresEncapsulation(cc)) {
388
+ const multiChannelCCVersion = this.host.getSupportedCCVersion(CommandClasses["Multi Channel"], this.endpoint.nodeId);
389
+ cc = multiChannelCCVersion === 1
390
+ ? MultiChannelCC.encapsulateV1(cc)
391
+ : MultiChannelCC.encapsulate(cc);
392
+ }
393
+ cc = Security2CC.encapsulate(cc, this.host.ownNodeId, this.host, { securityClass });
394
+ const response = await this.host.sendCommand(cc, {
395
+ ...this.commandOptions,
396
+ autoEncapsulate: false,
397
+ });
398
+ return response?.supportedCCs;
399
+ }
400
+ async reportSupportedCommands(supportedCCs) {
401
+ this.assertSupportsCommand(Security2Command, Security2Command.CommandsSupportedReport);
402
+ const cc = new Security2CCCommandsSupportedReport({
403
+ nodeId: this.endpoint.nodeId,
404
+ endpointIndex: this.endpoint.index,
405
+ supportedCCs,
406
+ });
407
+ await this.host.sendCommand(cc, this.commandOptions);
408
+ }
409
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
410
+ async getKeyExchangeParameters() {
411
+ this.assertSupportsCommand(Security2Command, Security2Command.KEXGet);
412
+ const cc = new Security2CCKEXGet({
413
+ nodeId: this.endpoint.nodeId,
414
+ endpointIndex: this.endpoint.index,
415
+ });
416
+ const response = await this.host.sendCommand(cc, this.commandOptions);
417
+ if (response) {
418
+ return pick(response, [
419
+ "requestCSA",
420
+ "echo",
421
+ "supportedKEXSchemes",
422
+ "supportedECDHProfiles",
423
+ "requestedKeys",
424
+ "_reserved",
425
+ ]);
426
+ }
427
+ }
428
+ /** Requests the given keys from an including node */
429
+ async requestKeys(params) {
430
+ this.assertSupportsCommand(Security2Command, Security2Command.KEXReport);
431
+ const cc = new Security2CCKEXReport({
432
+ nodeId: this.endpoint.nodeId,
433
+ endpointIndex: this.endpoint.index,
434
+ ...params,
435
+ echo: false,
436
+ });
437
+ await this.host.sendCommand(cc, this.commandOptions);
438
+ }
439
+ /** Grants the joining node the given keys */
440
+ async grantKeys(params) {
441
+ this.assertSupportsCommand(Security2Command, Security2Command.KEXSet);
442
+ const cc = new Security2CCKEXSet({
443
+ nodeId: this.endpoint.nodeId,
444
+ endpointIndex: this.endpoint.index,
445
+ ...params,
446
+ echo: false,
447
+ });
448
+ await this.host.sendCommand(cc, this.commandOptions);
449
+ }
450
+ /** Confirms the keys that were requested by a node */
451
+ async confirmRequestedKeys(params) {
452
+ this.assertSupportsCommand(Security2Command, Security2Command.KEXReport);
453
+ const cc = new Security2CCKEXReport({
454
+ nodeId: this.endpoint.nodeId,
455
+ endpointIndex: this.endpoint.index,
456
+ ...params,
457
+ echo: true,
458
+ });
459
+ await this.host.sendCommand(cc, this.commandOptions);
460
+ }
461
+ /** Confirms the keys that were granted by the including node */
462
+ async confirmGrantedKeys(params) {
463
+ this.assertSupportsCommand(Security2Command, Security2Command.KEXSet);
464
+ const cc = new Security2CCKEXSet({
465
+ nodeId: this.endpoint.nodeId,
466
+ endpointIndex: this.endpoint.index,
467
+ ...params,
468
+ echo: true,
469
+ });
470
+ return this.host.sendCommand(cc, this.commandOptions);
471
+ }
472
+ /** Notifies the other node that the ongoing key exchange was aborted */
473
+ async abortKeyExchange(failType) {
474
+ this.assertSupportsCommand(Security2Command, Security2Command.KEXFail);
475
+ const cc = new Security2CCKEXFail({
476
+ nodeId: this.endpoint.nodeId,
477
+ endpointIndex: this.endpoint.index,
478
+ failType,
479
+ });
480
+ await this.host.sendCommand(cc, this.commandOptions);
481
+ }
482
+ async sendPublicKey(publicKey, includingNode = true) {
483
+ this.assertSupportsCommand(Security2Command, Security2Command.PublicKeyReport);
484
+ const cc = new Security2CCPublicKeyReport({
485
+ nodeId: this.endpoint.nodeId,
486
+ endpointIndex: this.endpoint.index,
487
+ includingNode,
488
+ publicKey,
489
+ });
490
+ await this.host.sendCommand(cc, this.commandOptions);
491
+ }
492
+ async requestNetworkKey(securityClass) {
493
+ this.assertSupportsCommand(Security2Command, Security2Command.NetworkKeyGet);
494
+ const cc = new Security2CCNetworkKeyGet({
495
+ nodeId: this.endpoint.nodeId,
496
+ endpointIndex: this.endpoint.index,
497
+ requestedKey: securityClass,
498
+ });
499
+ await this.host.sendCommand(cc, this.commandOptions);
500
+ }
501
+ async sendNetworkKey(securityClass, networkKey) {
502
+ this.assertSupportsCommand(Security2Command, Security2Command.NetworkKeyReport);
503
+ const cc = new Security2CCNetworkKeyReport({
504
+ nodeId: this.endpoint.nodeId,
505
+ endpointIndex: this.endpoint.index,
506
+ grantedKey: securityClass,
507
+ networkKey,
508
+ });
509
+ await this.host.sendCommand(cc, this.commandOptions);
510
+ }
511
+ async verifyNetworkKey() {
512
+ this.assertSupportsCommand(Security2Command, Security2Command.NetworkKeyVerify);
513
+ const cc = new Security2CCNetworkKeyVerify({
514
+ nodeId: this.endpoint.nodeId,
515
+ endpointIndex: this.endpoint.index,
516
+ });
517
+ await this.host.sendCommand(cc, this.commandOptions);
518
+ }
519
+ async confirmKeyVerification() {
520
+ this.assertSupportsCommand(Security2Command, Security2Command.TransferEnd);
521
+ const cc = new Security2CCTransferEnd({
522
+ nodeId: this.endpoint.nodeId,
523
+ endpointIndex: this.endpoint.index,
524
+ keyVerified: true,
525
+ keyRequestComplete: false,
526
+ });
527
+ await this.host.sendCommand(cc, {
528
+ ...this.commandOptions,
529
+ // Don't wait for an ACK from the node
530
+ transmitOptions: TransmitOptions.DEFAULT & ~TransmitOptions.ACK,
531
+ });
532
+ }
533
+ async endKeyExchange() {
534
+ this.assertSupportsCommand(Security2Command, Security2Command.TransferEnd);
535
+ const cc = new Security2CCTransferEnd({
536
+ nodeId: this.endpoint.nodeId,
537
+ endpointIndex: this.endpoint.index,
538
+ keyVerified: false,
539
+ keyRequestComplete: true,
540
+ });
541
+ await this.host.sendCommand(cc, this.commandOptions);
542
+ }
543
+ };
544
+ Security2CCAPI = __decorate([
545
+ API(CommandClasses["Security 2"])
546
+ ], Security2CCAPI);
547
+ export { Security2CCAPI };
548
+ let Security2CC = Security2CC_1 = class Security2CC extends CommandClass {
549
+ async interview(ctx) {
550
+ const securityManager = getSecurityManager(ctx.ownNodeId, ctx, this.nodeId);
551
+ const node = this.getNode(ctx);
552
+ const endpoint = this.getEndpoint(ctx);
553
+ const api = CCAPI.create(CommandClasses["Security 2"], ctx, endpoint).withOptions({
554
+ priority: MessagePriority.NodeQuery,
555
+ });
556
+ // Only on the highest security class the response includes the supported commands
557
+ const secClass = node.getHighestSecurityClass();
558
+ let hasReceivedSecureCommands = false;
559
+ let possibleSecurityClasses;
560
+ if (securityClassIsS2(secClass)) {
561
+ // The highest security class is known to be S2, only query that one
562
+ possibleSecurityClasses = [secClass];
563
+ }
564
+ else if (endpoint.index === 0) {
565
+ // If the highest security class isn't known, query all possible security classes
566
+ // but only on the root device
567
+ possibleSecurityClasses = [
568
+ SecurityClass.S2_Unauthenticated,
569
+ SecurityClass.S2_Authenticated,
570
+ SecurityClass.S2_AccessControl,
571
+ ];
572
+ }
573
+ else {
574
+ // For endpoint interviews, the security class MUST be known
575
+ ctx.logNode(node.id, {
576
+ endpoint: endpoint.index,
577
+ message: `Cannot query securely supported commands for endpoint because the node's security class isn't known...`,
578
+ level: "error",
579
+ });
580
+ return;
581
+ }
582
+ for (const secClass of possibleSecurityClasses) {
583
+ // We might not know all assigned security classes yet, so we work our way up from low to high and try to request the supported commands.
584
+ // This way, each command is encrypted with the security class we're currently testing.
585
+ // If the node does not respond, it wasn't assigned the security class.
586
+ // If it responds with a non-empty list, we know this is the highest class it supports.
587
+ // If the list is empty, the security class is still supported.
588
+ // If we already know the class is not supported, skip it
589
+ if (node.hasSecurityClass(secClass) === false)
590
+ continue;
591
+ // If no key is configured for this security class, skip it
592
+ if (!securityManager?.hasKeysForSecurityClass(secClass)) {
593
+ ctx.logNode(node.id, {
594
+ endpoint: endpoint.index,
595
+ message: `Cannot query securely supported commands (${getEnumMemberName(SecurityClass, secClass)}) - network key is not configured...`,
596
+ level: "warn",
597
+ });
598
+ continue;
599
+ }
600
+ ctx.logNode(node.id, {
601
+ endpoint: endpoint.index,
602
+ message: `Querying securely supported commands (${getEnumMemberName(SecurityClass, secClass)})...`,
603
+ direction: "outbound",
604
+ });
605
+ // Query the supported commands but avoid remembering the wrong security class in case of a failure
606
+ let supportedCCs;
607
+ // Try up to 3 times on the root device. We REALLY don't want a spurious timeout or collision to cause us to discard a known good security class
608
+ const MAX_ATTEMPTS = this.endpointIndex === 0 ? 3 : 1;
609
+ for (let attempts = 1; attempts <= MAX_ATTEMPTS; attempts++) {
610
+ try {
611
+ supportedCCs = await api.getSupportedCommands(secClass);
612
+ }
613
+ catch (e) {
614
+ if (isZWaveError(e)
615
+ && e.code === ZWaveErrorCodes.Security2CC_CannotDecode) {
616
+ // Either we were using a non-granted security class,
617
+ // or querying with the known highest security class had an issue
618
+ supportedCCs = undefined;
619
+ }
620
+ else {
621
+ throw e;
622
+ }
623
+ }
624
+ if (supportedCCs == undefined
625
+ && possibleSecurityClasses.length === 1) {
626
+ if (attempts < MAX_ATTEMPTS) {
627
+ // We definitely know the highest security class
628
+ ctx.logNode(node.id, {
629
+ endpoint: endpoint.index,
630
+ message: `Querying securely supported commands (${getEnumMemberName(SecurityClass, secClass)}), attempt ${attempts}/${MAX_ATTEMPTS} failed. Retrying in 500ms...`,
631
+ level: "warn",
632
+ });
633
+ await wait(500);
634
+ continue;
635
+ }
636
+ else if (endpoint.index > 0) {
637
+ ctx.logNode(node.id, {
638
+ endpoint: endpoint.index,
639
+ message: `Querying securely supported commands (${getEnumMemberName(SecurityClass, secClass)}) failed. Assuming the endpoint supports all its mandatory CCs securely...`,
640
+ level: "warn",
641
+ });
642
+ // Just mark all endpoint CCs as secure. Without this we would attempt
643
+ // unencrypted communication with the endpoint, which will likely fail.
644
+ for (const [ccId] of endpoint.getCCs()) {
645
+ endpoint.addCC(ccId, { secure: true });
646
+ }
647
+ break;
648
+ }
649
+ else {
650
+ ctx.logNode(node.id, {
651
+ endpoint: endpoint.index,
652
+ message: `Querying securely supported commands (${getEnumMemberName(SecurityClass, secClass)}) failed. Let's hope for the best...`,
653
+ level: "warn",
654
+ });
655
+ break;
656
+ }
657
+ }
658
+ else {
659
+ // In any other case, we can stop trying
660
+ break;
661
+ }
662
+ }
663
+ if (supportedCCs == undefined) {
664
+ if (endpoint.index === 0
665
+ && possibleSecurityClasses.length > 1) {
666
+ // No supported commands found, mark the security class as not granted
667
+ // unless we were sure about the security class
668
+ node.setSecurityClass(secClass, false);
669
+ ctx.logNode(node.id, {
670
+ message: `The node was NOT granted the security class ${getEnumMemberName(SecurityClass, secClass)}`,
671
+ direction: "inbound",
672
+ });
673
+ }
674
+ continue;
675
+ }
676
+ if (endpoint.index === 0 && possibleSecurityClasses.length > 1) {
677
+ // Mark the security class as granted unless we were sure about the security class
678
+ node.setSecurityClass(secClass, true);
679
+ ctx.logNode(node.id, {
680
+ message: `The node was granted the security class ${getEnumMemberName(SecurityClass, secClass)}`,
681
+ direction: "inbound",
682
+ });
683
+ }
684
+ if (!hasReceivedSecureCommands && supportedCCs.length > 0) {
685
+ hasReceivedSecureCommands = true;
686
+ const logLines = [
687
+ `received secure commands (${getEnumMemberName(SecurityClass, secClass)})`,
688
+ "supported CCs:",
689
+ ];
690
+ for (const cc of supportedCCs) {
691
+ logLines.push(`· ${getCCName(cc)}`);
692
+ }
693
+ ctx.logNode(node.id, {
694
+ endpoint: endpoint.index,
695
+ message: logLines.join("\n"),
696
+ direction: "inbound",
697
+ });
698
+ // Remember which commands are supported securely
699
+ for (const cc of supportedCCs) {
700
+ // Basic CC has special rules for when it is considered supported
701
+ // Therefore we mark all other CCs as supported, but not Basic CC,
702
+ // for which support is determined later.
703
+ if (cc === CommandClasses.Basic) {
704
+ endpoint.addCC(cc, { secure: true });
705
+ }
706
+ else {
707
+ endpoint.addCC(cc, {
708
+ isSupported: true,
709
+ secure: true,
710
+ });
711
+ }
712
+ }
713
+ }
714
+ }
715
+ // Remember that the interview is complete
716
+ this.setInterviewComplete(ctx, true);
717
+ }
718
+ /** Tests if a command should be sent secure and thus requires encapsulation */
719
+ static requiresEncapsulation(cc) {
720
+ // No security flag -> no encapsulation
721
+ if (!(cc.encapsulationFlags & EncapsulationFlags.Security)) {
722
+ return false;
723
+ }
724
+ // S0, CRC16, Transport Service -> no S2 encapsulation
725
+ if (cc instanceof SecurityCC
726
+ || cc instanceof CRC16CC
727
+ || cc instanceof TransportServiceCC) {
728
+ return false;
729
+ }
730
+ // S2: check command
731
+ if (cc instanceof Security2CC_1) {
732
+ // These S2 commands need additional encapsulation
733
+ switch (cc.ccCommand) {
734
+ case Security2Command.CommandsSupportedGet:
735
+ case Security2Command.CommandsSupportedReport:
736
+ case Security2Command.NetworkKeyGet:
737
+ case Security2Command.NetworkKeyReport:
738
+ case Security2Command.NetworkKeyVerify:
739
+ case Security2Command.TransferEnd:
740
+ return true;
741
+ case Security2Command.KEXSet:
742
+ case Security2Command.KEXReport:
743
+ // KEXSet/Report need to be encrypted for the confirmation only
744
+ return cc
745
+ .echo;
746
+ case Security2Command.KEXFail: {
747
+ switch (cc.failType) {
748
+ case KEXFailType.Decrypt:
749
+ case KEXFailType.WrongSecurityLevel:
750
+ case KEXFailType.KeyNotGranted:
751
+ case KEXFailType.NoVerify:
752
+ return true;
753
+ default:
754
+ return false;
755
+ }
756
+ }
757
+ }
758
+ return false;
759
+ }
760
+ // Everything else needs to be encapsulated if the CC is secure
761
+ return true;
762
+ }
763
+ /** Encapsulates a command that should be sent encrypted */
764
+ static encapsulate(cc, ownNodeId, securityManagers, options) {
765
+ // Determine which extensions must be used on the command
766
+ const extensions = [];
767
+ if (options?.multicastOutOfSync) {
768
+ extensions.push(new MOSExtension());
769
+ }
770
+ if (options?.multicastGroupId != undefined) {
771
+ extensions.push(new MGRPExtension({ groupId: options.multicastGroupId }));
772
+ }
773
+ // Make sure that S2 multicast uses broadcasts. While the specs mention that both multicast and broadcast
774
+ // are possible, it has been found that devices treat multicasts like singlecast followups and respond incorrectly.
775
+ let nodeId;
776
+ if (cc.isMulticast()) {
777
+ if (cc.nodeId.some((nodeId) => isLongRangeNodeId(nodeId))) {
778
+ nodeId = NODE_ID_BROADCAST_LR;
779
+ }
780
+ else {
781
+ nodeId = NODE_ID_BROADCAST;
782
+ }
783
+ }
784
+ else {
785
+ nodeId = cc.nodeId;
786
+ }
787
+ const ret = new Security2CCMessageEncapsulation({
788
+ nodeId,
789
+ encapsulated: cc,
790
+ securityClass: options?.securityClass,
791
+ extensions,
792
+ verifyDelivery: options?.verifyDelivery,
793
+ });
794
+ // Copy the encapsulation flags from the encapsulated command
795
+ // but omit Security, since we're doing that right now
796
+ ret.encapsulationFlags = cc.encapsulationFlags
797
+ & ~EncapsulationFlags.Security;
798
+ return ret;
799
+ }
800
+ };
801
+ Security2CC = Security2CC_1 = __decorate([
802
+ commandClass(CommandClasses["Security 2"]),
803
+ implementedVersion(1)
804
+ ], Security2CC);
805
+ export { Security2CC };
806
+ function failNoSPAN() {
807
+ validatePayload.fail(ZWaveErrorCodes.Security2CC_NoSPAN);
808
+ }
809
+ function failNoMPAN() {
810
+ validatePayload.fail(ZWaveErrorCodes.Security2CC_NoMPAN);
811
+ }
812
+ // An S2 encapsulated command may result in a NonceReport to be sent by the node if it couldn't decrypt the message
813
+ function getCCResponseForMessageEncapsulation(sent) {
814
+ if (sent.encapsulated?.expectsCCResponse()) {
815
+ const ret = [
816
+ Security2CCMessageEncapsulation,
817
+ Security2CCNonceReport,
818
+ ];
819
+ if (sent.encapsulated instanceof Security2CCKEXSet
820
+ || sent.encapsulated instanceof Security2CCKEXReport
821
+ || sent.encapsulated instanceof Security2CCNetworkKeyGet
822
+ || sent.encapsulated instanceof Security2CCNetworkKeyReport
823
+ || sent.encapsulated instanceof Security2CCNetworkKeyVerify) {
824
+ ret.push(Security2CCKEXFail);
825
+ }
826
+ return ret;
827
+ }
828
+ }
829
+ function testCCResponseForMessageEncapsulation(sent, received) {
830
+ if (received instanceof Security2CCMessageEncapsulation) {
831
+ return "checkEncapsulated";
832
+ }
833
+ else if (received instanceof Security2CCKEXFail) {
834
+ return true;
835
+ }
836
+ else {
837
+ return received.SOS && !!received.receiverEI;
838
+ }
839
+ }
840
+ let Security2CCMessageEncapsulation = Security2CCMessageEncapsulation_1 = class Security2CCMessageEncapsulation extends Security2CC {
841
+ constructor(options) {
842
+ super(options);
843
+ if (!options.encapsulated && !options.extensions?.length) {
844
+ throw new ZWaveError("Security S2 encapsulation requires an encapsulated CC and/or extensions", ZWaveErrorCodes.Argument_Invalid);
845
+ }
846
+ this.sequenceNumber = options.sequenceNumber;
847
+ this.securityClass = options.securityClass;
848
+ if (options.encapsulated) {
849
+ this.encapsulated = options.encapsulated;
850
+ options.encapsulated.encapsulatingCC = this;
851
+ }
852
+ this.verifyDelivery = options.verifyDelivery !== false;
853
+ this.extensions = options.extensions ?? [];
854
+ if (typeof this.nodeId !== "number"
855
+ && !this.extensions.some((e) => e instanceof MGRPExtension)) {
856
+ throw new ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", ZWaveErrorCodes.Security2CC_MissingExtension);
857
+ }
858
+ }
859
+ static from(raw, ctx) {
860
+ const securityManager = assertSecurityRX(ctx);
861
+ validatePayload(raw.payload.length >= 2);
862
+ // Check the sequence number to avoid duplicates
863
+ const sequenceNumber = raw.payload[0];
864
+ // Ensure the node has a security class
865
+ validatePayload.withReason("No security class granted")(ctx.getHighestSecurityClass(ctx.sourceNodeId) !== SecurityClass.None);
866
+ const hasExtensions = !!(raw.payload[1] & 0b1);
867
+ const hasEncryptedExtensions = !!(raw.payload[1] & 0b10);
868
+ let offset = 2;
869
+ const extensions = [];
870
+ let mustDiscardCommand = false;
871
+ const parseExtensions = (buffer, wasEncrypted) => {
872
+ while (true) {
873
+ if (buffer.length < offset + 2) {
874
+ // An S2 extension was expected, but the buffer is too short
875
+ mustDiscardCommand = true;
876
+ return;
877
+ }
878
+ // The length field could be too large, which would cause part of the actual ciphertext
879
+ // to be ignored. Try to avoid this for known extensions by checking the actual and expected length.
880
+ const { actual: actualLength, expected: expectedLength } = Security2Extension
881
+ .getExtensionLength(buffer.subarray(offset));
882
+ // Parse the extension using the expected length if possible
883
+ const extensionLength = expectedLength ?? actualLength;
884
+ if (extensionLength < 2) {
885
+ // An S2 extension was expected, but the length is too short
886
+ mustDiscardCommand = true;
887
+ return;
888
+ }
889
+ else if (extensionLength
890
+ > buffer.length
891
+ - offset
892
+ - (wasEncrypted
893
+ ? 0
894
+ : SECURITY_S2_AUTH_TAG_LENGTH)) {
895
+ // The supposed length is longer than the space the extensions may occupy
896
+ mustDiscardCommand = true;
897
+ return;
898
+ }
899
+ const extensionData = buffer.subarray(offset, offset + extensionLength);
900
+ offset += extensionLength;
901
+ const ext = Security2Extension.parse(extensionData);
902
+ switch (validateS2Extension(ext, wasEncrypted)) {
903
+ case ValidateS2ExtensionResult.OK:
904
+ if (expectedLength != undefined
905
+ && actualLength !== expectedLength) {
906
+ // The extension length field does not match, ignore the extension
907
+ }
908
+ else {
909
+ extensions.push(ext);
910
+ }
911
+ break;
912
+ case ValidateS2ExtensionResult.DiscardExtension:
913
+ // Do nothing
914
+ break;
915
+ case ValidateS2ExtensionResult.DiscardCommand:
916
+ mustDiscardCommand = true;
917
+ break;
918
+ }
919
+ // Check if that was the last extension
920
+ if (!ext.moreToFollow)
921
+ break;
922
+ }
923
+ };
924
+ if (hasExtensions)
925
+ parseExtensions(raw.payload, false);
926
+ const mcctx = (() => {
927
+ const multicastGroupId = getMulticastGroupId(extensions);
928
+ if (ctx.frameType === "multicast" || ctx.frameType === "broadcast") {
929
+ if (multicastGroupId == undefined) {
930
+ validatePayload.fail("Multicast frames without MGRP extension");
931
+ }
932
+ return {
933
+ isMulticast: true,
934
+ groupId: multicastGroupId,
935
+ };
936
+ }
937
+ else {
938
+ return { isMulticast: false, groupId: multicastGroupId };
939
+ }
940
+ })();
941
+ // If a command is to be discarded before decryption,
942
+ // we still need to increment the SPAN or MPAN state
943
+ if (mustDiscardCommand) {
944
+ if (mcctx.isMulticast) {
945
+ securityManager.nextPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
946
+ }
947
+ else {
948
+ securityManager.nextNonce(ctx.sourceNodeId);
949
+ }
950
+ validatePayload.fail("Invalid S2 extension");
951
+ }
952
+ let prevSequenceNumber;
953
+ let mpanState;
954
+ if (mcctx.isMulticast) {
955
+ mpanState = securityManager.getPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
956
+ }
957
+ else {
958
+ // Don't accept duplicate Singlecast commands
959
+ prevSequenceNumber = validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
960
+ // When a node receives a singlecast message after a multicast group was marked out of sync,
961
+ // it must forget about the group.
962
+ if (mcctx.groupId == undefined) {
963
+ securityManager.resetOutOfSyncMPANs(ctx.sourceNodeId);
964
+ }
965
+ }
966
+ const unencryptedPayload = raw.payload.subarray(0, offset);
967
+ const ciphertext = raw.payload.subarray(offset, -SECURITY_S2_AUTH_TAG_LENGTH);
968
+ const authTag = raw.payload.subarray(-SECURITY_S2_AUTH_TAG_LENGTH);
969
+ const messageLength = 2 /* CommandClass.computeEncapsulationOverhead() */
970
+ + raw.payload.length;
971
+ const authData = getAuthenticationData(ctx.sourceNodeId, getDestinationIDRX(ctx, extensions), ctx.homeId, messageLength, unencryptedPayload);
972
+ let decrypt;
973
+ if (mcctx.isMulticast) {
974
+ // For incoming multicast commands, make sure we have an MPAN
975
+ if (mpanState?.type !== MPANState.MPAN) {
976
+ // If we don't, mark the MPAN as out of sync, so we can respond accordingly on the singlecast followup
977
+ securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
978
+ failNoMPAN();
979
+ }
980
+ decrypt = () => decryptMulticast(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
981
+ }
982
+ else {
983
+ // Decrypt payload and verify integrity
984
+ const spanState = securityManager.getSPANState(ctx.sourceNodeId);
985
+ // If we are not able to establish an SPAN yet, fail the decryption
986
+ if (spanState.type === SPANState.None) {
987
+ failNoSPAN();
988
+ }
989
+ else if (spanState.type === SPANState.RemoteEI) {
990
+ // TODO: The specs are not clear how to handle this case
991
+ // For now, do the same as if we didn't have any EI
992
+ failNoSPAN();
993
+ }
994
+ decrypt = () => decryptSinglecast(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
995
+ }
996
+ let plaintext;
997
+ let authOK = false;
998
+ let key;
999
+ let iv;
1000
+ let decryptionSecurityClass;
1001
+ // If the Receiver is unable to authenticate the singlecast message with the current SPAN,
1002
+ // the Receiver SHOULD try decrypting the message with one or more of the following SPAN values,
1003
+ // stopping when decryption is successful or the maximum number of iterations is reached.
1004
+ // If the Receiver is unable to decrypt the S2 MC frame with the current MPAN, the Receiver MAY try
1005
+ // decrypting the frame with one or more of the subsequent MPAN values, stopping when decryption is
1006
+ // successful or the maximum number of iterations is reached.
1007
+ const decryptAttempts = mcctx.isMulticast
1008
+ ? MAX_DECRYPT_ATTEMPTS_MULTICAST
1009
+ : mcctx.groupId != undefined
1010
+ ? MAX_DECRYPT_ATTEMPTS_SC_FOLLOWUP
1011
+ : MAX_DECRYPT_ATTEMPTS_SINGLECAST;
1012
+ for (let i = 0; i < decryptAttempts; i++) {
1013
+ ({
1014
+ plaintext,
1015
+ authOK,
1016
+ key,
1017
+ iv,
1018
+ securityClass: decryptionSecurityClass,
1019
+ } = decrypt());
1020
+ if (!!authOK && !!plaintext)
1021
+ break;
1022
+ // No need to try further SPANs if we just got the sender's EI
1023
+ if (!!getSenderEI(extensions))
1024
+ break;
1025
+ }
1026
+ // If authentication fails, do so with an error code that instructs the
1027
+ // applHost to tell the node we have no nonce
1028
+ if (!authOK || !plaintext) {
1029
+ if (mcctx.isMulticast) {
1030
+ // Mark the MPAN as out of sync
1031
+ securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
1032
+ validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecodeMulticast);
1033
+ }
1034
+ else {
1035
+ validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecode);
1036
+ }
1037
+ }
1038
+ else if (!mcctx.isMulticast && mcctx.groupId != undefined) {
1039
+ // After reception of a singlecast followup, the MPAN state must be increased
1040
+ securityManager.tryIncrementPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
1041
+ }
1042
+ // Remember which security class was used to decrypt this message, so we can discard it later
1043
+ const securityClass = decryptionSecurityClass;
1044
+ offset = 0;
1045
+ if (hasEncryptedExtensions)
1046
+ parseExtensions(plaintext, true);
1047
+ // Before we can continue, check if the command must be discarded
1048
+ if (mustDiscardCommand) {
1049
+ validatePayload.fail("Invalid extension");
1050
+ }
1051
+ // If the MPAN extension was received, store the MPAN
1052
+ if (!mcctx.isMulticast) {
1053
+ const mpanExtension = extensions.find((e) => e instanceof MPANExtension);
1054
+ if (mpanExtension) {
1055
+ securityManager.storePeerMPAN(ctx.sourceNodeId, mpanExtension.groupId, {
1056
+ type: MPANState.MPAN,
1057
+ currentMPAN: mpanExtension.innerMPANState,
1058
+ });
1059
+ }
1060
+ }
1061
+ // Not every S2 message includes an encapsulated CC
1062
+ const decryptedCCBytes = plaintext.subarray(offset);
1063
+ let encapsulated;
1064
+ if (decryptedCCBytes.length > 0) {
1065
+ // make sure this contains a complete CC command that's worth splitting
1066
+ validatePayload(decryptedCCBytes.length >= 2);
1067
+ // and deserialize the CC
1068
+ encapsulated = CommandClass.parse(decryptedCCBytes, ctx);
1069
+ }
1070
+ const ret = new Security2CCMessageEncapsulation_1({
1071
+ nodeId: ctx.sourceNodeId,
1072
+ sequenceNumber,
1073
+ securityClass,
1074
+ extensions,
1075
+ encapsulated,
1076
+ });
1077
+ // Remember for debugging purposes
1078
+ ret.key = key;
1079
+ ret.iv = iv;
1080
+ ret.authData = authData;
1081
+ ret.authTag = authTag;
1082
+ ret.plaintext = decryptedCCBytes;
1083
+ return ret;
1084
+ }
1085
+ securityClass;
1086
+ // Only used for testing/debugging purposes
1087
+ key;
1088
+ iv;
1089
+ authData;
1090
+ authTag;
1091
+ ciphertext;
1092
+ plaintext;
1093
+ verifyDelivery = true;
1094
+ sequenceNumber;
1095
+ ensureSequenceNumber(securityManager) {
1096
+ if (this.sequenceNumber == undefined) {
1097
+ if (this.isSinglecast()) {
1098
+ this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
1099
+ }
1100
+ else {
1101
+ const groupId = getDestinationIDTX.call(this);
1102
+ this.sequenceNumber = securityManager
1103
+ .nextMulticastSequenceNumber(groupId);
1104
+ }
1105
+ }
1106
+ }
1107
+ encapsulated;
1108
+ extensions;
1109
+ prepareRetransmission() {
1110
+ super.prepareRetransmission();
1111
+ this.sequenceNumber = undefined;
1112
+ }
1113
+ hasMOSExtension() {
1114
+ return this.extensions.some((e) => e instanceof MOSExtension);
1115
+ }
1116
+ /** Returns the Sender's Entropy Input if this command contains an SPAN extension */
1117
+ getSenderEI() {
1118
+ return getSenderEI(this.extensions);
1119
+ }
1120
+ /** Returns the multicast group ID if this command contains an MGRP extension */
1121
+ getMulticastGroupId() {
1122
+ return getMulticastGroupId(this.extensions);
1123
+ }
1124
+ maybeAddSPANExtension(ctx, securityManager) {
1125
+ if (!this.isSinglecast())
1126
+ return;
1127
+ const receiverNodeId = this.nodeId;
1128
+ const spanState = securityManager.getSPANState(receiverNodeId);
1129
+ if (spanState.type === SPANState.None
1130
+ || spanState.type === SPANState.LocalEI) {
1131
+ // Can't do anything here if we don't have the receiver's EI
1132
+ throw new ZWaveError(`Security S2 CC requires the receiver's nonce to be sent!`, ZWaveErrorCodes.Security2CC_NoSPAN);
1133
+ }
1134
+ else if (spanState.type === SPANState.RemoteEI) {
1135
+ // We have the receiver's EI, generate our input and send it over
1136
+ // With both, we can create an SPAN
1137
+ const senderEI = securityManager.generateNonce(undefined);
1138
+ const receiverEI = spanState.receiverEI;
1139
+ // While bootstrapping a node, prefer the temporary key, unless the
1140
+ // specific command specifies a security class
1141
+ if (this.securityClass == undefined
1142
+ && securityManager.tempKeys.has(receiverNodeId)) {
1143
+ securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
1144
+ }
1145
+ else {
1146
+ const securityClass = this.securityClass
1147
+ ?? ctx.getHighestSecurityClass(receiverNodeId);
1148
+ if (securityClass == undefined) {
1149
+ throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
1150
+ }
1151
+ securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
1152
+ }
1153
+ // Add or update the SPAN extension
1154
+ let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
1155
+ if (spanExtension) {
1156
+ spanExtension.senderEI = senderEI;
1157
+ }
1158
+ else {
1159
+ spanExtension = new SPANExtension({ senderEI });
1160
+ this.extensions.push(spanExtension);
1161
+ }
1162
+ }
1163
+ }
1164
+ serialize(ctx) {
1165
+ const securityManager = assertSecurityTX(ctx, this.nodeId);
1166
+ this.ensureSequenceNumber(securityManager);
1167
+ // Include Sender EI in the command if we only have the receiver's EI
1168
+ this.maybeAddSPANExtension(ctx, securityManager);
1169
+ const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
1170
+ const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
1171
+ const unencryptedPayload = Bytes.concat([
1172
+ Bytes.from([
1173
+ this.sequenceNumber,
1174
+ (encryptedExtensions.length > 0 ? 0b10 : 0)
1175
+ | (unencryptedExtensions.length > 0 ? 1 : 0),
1176
+ ]),
1177
+ ...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
1178
+ ]);
1179
+ const serializedCC = this.encapsulated?.serialize(ctx)
1180
+ ?? new Bytes();
1181
+ const plaintextPayload = Bytes.concat([
1182
+ ...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
1183
+ serializedCC,
1184
+ ]);
1185
+ // Generate the authentication data for CCM encryption
1186
+ const destinationTag = getDestinationIDTX.call(this);
1187
+ const messageLength = this.computeEncapsulationOverhead()
1188
+ + serializedCC.length;
1189
+ const authData = getAuthenticationData(ctx.ownNodeId, destinationTag, ctx.homeId, messageLength, unencryptedPayload);
1190
+ let key;
1191
+ let iv;
1192
+ if (this.isSinglecast()) {
1193
+ // Singlecast:
1194
+ // Generate a nonce for encryption, and remember it to attempt decryption
1195
+ // of potential in-flight messages from the target node.
1196
+ iv = securityManager.nextNonce(this.nodeId, true);
1197
+ const { keyCCM } =
1198
+ // Prefer the overridden security class if it was given
1199
+ this.securityClass != undefined
1200
+ ? securityManager.getKeysForSecurityClass(this.securityClass)
1201
+ : securityManager.getKeysForNode(this.nodeId);
1202
+ key = keyCCM;
1203
+ }
1204
+ else {
1205
+ // Multicast:
1206
+ const keyAndIV = securityManager.getMulticastKeyAndIV(destinationTag);
1207
+ key = keyAndIV.key;
1208
+ iv = keyAndIV.iv;
1209
+ }
1210
+ const { ciphertext: ciphertextPayload, authTag } = encryptAES128CCM(key, iv, plaintextPayload, authData, SECURITY_S2_AUTH_TAG_LENGTH);
1211
+ // Remember key and IV for debugging purposes
1212
+ this.key = key;
1213
+ this.iv = iv;
1214
+ this.authData = authData;
1215
+ this.authTag = authTag;
1216
+ this.ciphertext = ciphertextPayload;
1217
+ this.payload = Bytes.concat([
1218
+ unencryptedPayload,
1219
+ ciphertextPayload,
1220
+ authTag,
1221
+ ]);
1222
+ return super.serialize(ctx);
1223
+ }
1224
+ computeEncapsulationOverhead() {
1225
+ // Security S2 adds:
1226
+ // * 1 byte sequence number
1227
+ // * 1 byte control
1228
+ // * N bytes extensions
1229
+ // * SECURITY_S2_AUTH_TAG_LENGTH bytes auth tag
1230
+ const extensionBytes = this.extensions
1231
+ .map((e) => e.computeLength())
1232
+ .reduce((a, b) => a + b, 0);
1233
+ return (super.computeEncapsulationOverhead()
1234
+ + 2
1235
+ + SECURITY_S2_AUTH_TAG_LENGTH
1236
+ + extensionBytes);
1237
+ }
1238
+ toLogEntry(ctx) {
1239
+ const message = {
1240
+ "sequence number": this.sequenceNumber ?? "(not set)",
1241
+ };
1242
+ if (this.extensions.length > 0) {
1243
+ message.extensions = this.extensions
1244
+ .map((e) => e.toLogEntry())
1245
+ .join("");
1246
+ }
1247
+ // Log the used keys in integration tests
1248
+ if (process.env.NODE_ENV === "test"
1249
+ || process.env.NODE_ENV === "development") {
1250
+ if (this.key) {
1251
+ message.key = buffer2hex(this.key);
1252
+ }
1253
+ if (this.iv) {
1254
+ message.IV = buffer2hex(this.iv);
1255
+ }
1256
+ if (this.ciphertext) {
1257
+ message.ciphertext = buffer2hex(this.ciphertext);
1258
+ }
1259
+ else if (this.plaintext) {
1260
+ message.plaintext = buffer2hex(this.plaintext);
1261
+ }
1262
+ if (this.authData) {
1263
+ message["auth data"] = buffer2hex(this.authData);
1264
+ }
1265
+ if (this.authTag) {
1266
+ message["auth tag"] = buffer2hex(this.authTag);
1267
+ }
1268
+ }
1269
+ if (this.securityClass != undefined) {
1270
+ message["security class"] = getEnumMemberName(SecurityClass, this.securityClass);
1271
+ }
1272
+ return {
1273
+ ...super.toLogEntry(ctx),
1274
+ message,
1275
+ };
1276
+ }
1277
+ };
1278
+ Security2CCMessageEncapsulation = Security2CCMessageEncapsulation_1 = __decorate([
1279
+ CCCommand(Security2Command.MessageEncapsulation),
1280
+ expectedCCResponse(getCCResponseForMessageEncapsulation, testCCResponseForMessageEncapsulation)
1281
+ ], Security2CCMessageEncapsulation);
1282
+ export { Security2CCMessageEncapsulation };
1283
+ let Security2CCNonceReport = Security2CCNonceReport_1 = class Security2CCNonceReport extends Security2CC {
1284
+ constructor(options) {
1285
+ super(options);
1286
+ this.SOS = options.SOS;
1287
+ this.MOS = options.MOS;
1288
+ this.sequenceNumber = options.sequenceNumber;
1289
+ if (options.SOS)
1290
+ this.receiverEI = options.receiverEI;
1291
+ }
1292
+ static from(raw, ctx) {
1293
+ // Make sure that we can send/receive secure commands
1294
+ const securityManager = assertSecurityRX(ctx);
1295
+ validatePayload(raw.payload.length >= 2);
1296
+ const sequenceNumber = raw.payload[0];
1297
+ // Don't accept duplicate commands
1298
+ validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
1299
+ const MOS = !!(raw.payload[1] & 0b10);
1300
+ const SOS = !!(raw.payload[1] & 0b1);
1301
+ if (SOS) {
1302
+ // If the SOS flag is set, the REI field MUST be included in the command
1303
+ validatePayload(raw.payload.length >= 18);
1304
+ const receiverEI = raw.payload.subarray(2, 18);
1305
+ // In that case we also need to store it, so the next sent command
1306
+ // can use it for encryption
1307
+ securityManager.storeRemoteEI(ctx.sourceNodeId, receiverEI);
1308
+ return new Security2CCNonceReport_1({
1309
+ nodeId: ctx.sourceNodeId,
1310
+ sequenceNumber,
1311
+ MOS,
1312
+ SOS,
1313
+ receiverEI,
1314
+ });
1315
+ }
1316
+ else if (MOS) {
1317
+ return new Security2CCNonceReport_1({
1318
+ nodeId: ctx.sourceNodeId,
1319
+ sequenceNumber,
1320
+ MOS,
1321
+ SOS: false,
1322
+ });
1323
+ }
1324
+ else {
1325
+ validatePayload.fail("Either MOS or SOS must be set");
1326
+ }
1327
+ }
1328
+ sequenceNumber;
1329
+ ensureSequenceNumber(securityManager) {
1330
+ if (this.sequenceNumber == undefined) {
1331
+ this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
1332
+ }
1333
+ }
1334
+ SOS;
1335
+ MOS;
1336
+ receiverEI;
1337
+ serialize(ctx) {
1338
+ const securityManager = assertSecurityTX(ctx, this.nodeId);
1339
+ this.ensureSequenceNumber(securityManager);
1340
+ this.payload = Bytes.from([
1341
+ this.sequenceNumber,
1342
+ (this.MOS ? 0b10 : 0) + (this.SOS ? 0b1 : 0),
1343
+ ]);
1344
+ if (this.SOS) {
1345
+ this.payload = Bytes.concat([this.payload, this.receiverEI]);
1346
+ }
1347
+ return super.serialize(ctx);
1348
+ }
1349
+ toLogEntry(ctx) {
1350
+ const message = {
1351
+ "sequence number": this.sequenceNumber ?? "(not set)",
1352
+ SOS: this.SOS,
1353
+ MOS: this.MOS,
1354
+ };
1355
+ if (this.receiverEI) {
1356
+ message["receiver entropy"] = buffer2hex(this.receiverEI);
1357
+ }
1358
+ return {
1359
+ ...super.toLogEntry(ctx),
1360
+ message,
1361
+ };
1362
+ }
1363
+ };
1364
+ Security2CCNonceReport = Security2CCNonceReport_1 = __decorate([
1365
+ CCCommand(Security2Command.NonceReport)
1366
+ ], Security2CCNonceReport);
1367
+ export { Security2CCNonceReport };
1368
+ let Security2CCNonceGet = Security2CCNonceGet_1 = class Security2CCNonceGet extends Security2CC {
1369
+ // TODO: A node sending this command MUST accept a delay up to <Previous Round-trip-time to peer node> +
1370
+ // 250 ms before receiving the Security 2 Nonce Report Command.
1371
+ constructor(options) {
1372
+ super(options);
1373
+ this.sequenceNumber = options.sequenceNumber;
1374
+ }
1375
+ static from(raw, ctx) {
1376
+ const securityManager = assertSecurityRX(ctx);
1377
+ validatePayload(raw.payload.length >= 1);
1378
+ const sequenceNumber = raw.payload[0];
1379
+ // Don't accept duplicate commands
1380
+ validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
1381
+ return new Security2CCNonceGet_1({
1382
+ nodeId: ctx.sourceNodeId,
1383
+ sequenceNumber,
1384
+ });
1385
+ }
1386
+ sequenceNumber;
1387
+ ensureSequenceNumber(securityManager) {
1388
+ if (this.sequenceNumber == undefined) {
1389
+ this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
1390
+ }
1391
+ }
1392
+ serialize(ctx) {
1393
+ const securityManager = assertSecurityTX(ctx, this.nodeId);
1394
+ this.ensureSequenceNumber(securityManager);
1395
+ this.payload = Bytes.from([this.sequenceNumber]);
1396
+ return super.serialize(ctx);
1397
+ }
1398
+ toLogEntry(ctx) {
1399
+ return {
1400
+ ...super.toLogEntry(ctx),
1401
+ message: {
1402
+ "sequence number": this.sequenceNumber ?? "(not set)",
1403
+ },
1404
+ };
1405
+ }
1406
+ };
1407
+ Security2CCNonceGet = Security2CCNonceGet_1 = __decorate([
1408
+ CCCommand(Security2Command.NonceGet),
1409
+ expectedCCResponse(Security2CCNonceReport)
1410
+ ], Security2CCNonceGet);
1411
+ export { Security2CCNonceGet };
1412
+ let Security2CCKEXReport = Security2CCKEXReport_1 = class Security2CCKEXReport extends Security2CC {
1413
+ constructor(options) {
1414
+ super(options);
1415
+ this.requestCSA = options.requestCSA;
1416
+ this.echo = options.echo;
1417
+ this._reserved = options._reserved ?? 0;
1418
+ this.supportedKEXSchemes = options.supportedKEXSchemes;
1419
+ this.supportedECDHProfiles = options.supportedECDHProfiles;
1420
+ this.requestedKeys = options.requestedKeys;
1421
+ }
1422
+ static from(raw, ctx) {
1423
+ validatePayload(raw.payload.length >= 4);
1424
+ const requestCSA = !!(raw.payload[0] & 0b10);
1425
+ const echo = !!(raw.payload[0] & 0b1);
1426
+ // Remember the reserved bits for the echo
1427
+ const _reserved = raw.payload[0] & 0b1111_1100;
1428
+ // The bit mask starts at 0, but bit 0 is not used
1429
+ const supportedKEXSchemes = parseBitMask(raw.payload.subarray(1, 2), 0).filter((s) => s !== 0);
1430
+ const supportedECDHProfiles = parseBitMask(raw.payload.subarray(2, 3), ECDHProfiles.Curve25519);
1431
+ const requestedKeys = parseBitMask(raw.payload.subarray(3, 4), SecurityClass.S2_Unauthenticated);
1432
+ return new Security2CCKEXReport_1({
1433
+ nodeId: ctx.sourceNodeId,
1434
+ requestCSA,
1435
+ echo,
1436
+ _reserved,
1437
+ supportedKEXSchemes,
1438
+ supportedECDHProfiles,
1439
+ requestedKeys,
1440
+ });
1441
+ }
1442
+ _reserved;
1443
+ requestCSA;
1444
+ echo;
1445
+ supportedKEXSchemes;
1446
+ supportedECDHProfiles;
1447
+ requestedKeys;
1448
+ serialize(ctx) {
1449
+ this.payload = Bytes.concat([
1450
+ Bytes.from([
1451
+ this._reserved
1452
+ + (this.requestCSA ? 0b10 : 0)
1453
+ + (this.echo ? 0b1 : 0),
1454
+ ]),
1455
+ // The bit mask starts at 0, but bit 0 is not used
1456
+ encodeBitMask(this.supportedKEXSchemes, 7, 0),
1457
+ encodeBitMask(this.supportedECDHProfiles, 7, ECDHProfiles.Curve25519),
1458
+ encodeBitMask(this.requestedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
1459
+ ]);
1460
+ return super.serialize(ctx);
1461
+ }
1462
+ toLogEntry(ctx) {
1463
+ return {
1464
+ ...super.toLogEntry(ctx),
1465
+ message: {
1466
+ echo: this.echo,
1467
+ "supported schemes": this.supportedKEXSchemes
1468
+ .map((s) => `\n· ${getEnumMemberName(KEXSchemes, s)}`)
1469
+ .join(""),
1470
+ "supported ECDH profiles": this.supportedECDHProfiles
1471
+ .map((s) => `\n· ${getEnumMemberName(ECDHProfiles, s)}`)
1472
+ .join(""),
1473
+ "CSA requested": this.requestCSA,
1474
+ "requested security classes": this.requestedKeys
1475
+ .map((s) => `\n· ${getEnumMemberName(SecurityClass, s)}`)
1476
+ .join(""),
1477
+ },
1478
+ };
1479
+ }
1480
+ };
1481
+ Security2CCKEXReport = Security2CCKEXReport_1 = __decorate([
1482
+ CCCommand(Security2Command.KEXReport)
1483
+ ], Security2CCKEXReport);
1484
+ export { Security2CCKEXReport };
1485
+ let Security2CCKEXGet = class Security2CCKEXGet extends Security2CC {
1486
+ };
1487
+ Security2CCKEXGet = __decorate([
1488
+ CCCommand(Security2Command.KEXGet),
1489
+ expectedCCResponse(Security2CCKEXReport)
1490
+ ], Security2CCKEXGet);
1491
+ export { Security2CCKEXGet };
1492
+ function getExpectedResponseForKEXSet(sent) {
1493
+ if (sent.echo) {
1494
+ return [Security2CCKEXReport, Security2CCKEXFail];
1495
+ }
1496
+ else {
1497
+ return undefined;
1498
+ }
1499
+ }
1500
+ function testExpectedResponseForKEXSet(sent, received) {
1501
+ if (sent.echo) {
1502
+ if (received instanceof Security2CCKEXReport) {
1503
+ return received.echo;
1504
+ }
1505
+ else if (received instanceof Security2CCKEXFail) {
1506
+ return true;
1507
+ }
1508
+ }
1509
+ return false;
1510
+ }
1511
+ let Security2CCKEXSet = Security2CCKEXSet_1 = class Security2CCKEXSet extends Security2CC {
1512
+ constructor(options) {
1513
+ super(options);
1514
+ this.permitCSA = options.permitCSA;
1515
+ this.echo = options.echo;
1516
+ this._reserved = options._reserved ?? 0;
1517
+ this.selectedKEXScheme = options.selectedKEXScheme;
1518
+ this.selectedECDHProfile = options.selectedECDHProfile;
1519
+ this.grantedKeys = options.grantedKeys;
1520
+ }
1521
+ static from(raw, ctx) {
1522
+ validatePayload(raw.payload.length >= 4);
1523
+ const _reserved = raw.payload[0] & 0b1111_1100;
1524
+ const permitCSA = !!(raw.payload[0] & 0b10);
1525
+ const echo = !!(raw.payload[0] & 0b1);
1526
+ // The bit mask starts at 0, but bit 0 is not used
1527
+ const selectedKEXSchemes = parseBitMask(raw.payload.subarray(1, 2), 0).filter((s) => s !== 0);
1528
+ validatePayload(selectedKEXSchemes.length === 1);
1529
+ const selectedKEXScheme = selectedKEXSchemes[0];
1530
+ const selectedECDHProfiles = parseBitMask(raw.payload.subarray(2, 3), ECDHProfiles.Curve25519);
1531
+ validatePayload(selectedECDHProfiles.length === 1);
1532
+ const selectedECDHProfile = selectedECDHProfiles[0];
1533
+ const grantedKeys = parseBitMask(raw.payload.subarray(3, 4), SecurityClass.S2_Unauthenticated);
1534
+ return new Security2CCKEXSet_1({
1535
+ nodeId: ctx.sourceNodeId,
1536
+ _reserved,
1537
+ permitCSA,
1538
+ echo,
1539
+ selectedKEXScheme,
1540
+ selectedECDHProfile,
1541
+ grantedKeys,
1542
+ });
1543
+ }
1544
+ _reserved;
1545
+ permitCSA;
1546
+ echo;
1547
+ selectedKEXScheme;
1548
+ selectedECDHProfile;
1549
+ grantedKeys;
1550
+ serialize(ctx) {
1551
+ this.payload = Bytes.concat([
1552
+ Bytes.from([
1553
+ this._reserved
1554
+ + (this.permitCSA ? 0b10 : 0)
1555
+ + (this.echo ? 0b1 : 0),
1556
+ ]),
1557
+ // The bit mask starts at 0, but bit 0 is not used
1558
+ encodeBitMask([this.selectedKEXScheme], 7, 0),
1559
+ encodeBitMask([this.selectedECDHProfile], 7, ECDHProfiles.Curve25519),
1560
+ encodeBitMask(this.grantedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
1561
+ ]);
1562
+ return super.serialize(ctx);
1563
+ }
1564
+ toLogEntry(ctx) {
1565
+ return {
1566
+ ...super.toLogEntry(ctx),
1567
+ message: {
1568
+ echo: this.echo,
1569
+ "selected scheme": getEnumMemberName(KEXSchemes, this.selectedKEXScheme),
1570
+ "selected ECDH profile": getEnumMemberName(ECDHProfiles, this.selectedECDHProfile),
1571
+ "CSA permitted": this.permitCSA,
1572
+ "granted security classes": this.grantedKeys
1573
+ .map((s) => `\n· ${getEnumMemberName(SecurityClass, s)}`)
1574
+ .join(""),
1575
+ },
1576
+ };
1577
+ }
1578
+ };
1579
+ Security2CCKEXSet = Security2CCKEXSet_1 = __decorate([
1580
+ CCCommand(Security2Command.KEXSet),
1581
+ expectedCCResponse(getExpectedResponseForKEXSet, testExpectedResponseForKEXSet)
1582
+ ], Security2CCKEXSet);
1583
+ export { Security2CCKEXSet };
1584
+ let Security2CCKEXFail = Security2CCKEXFail_1 = class Security2CCKEXFail extends Security2CC {
1585
+ constructor(options) {
1586
+ super(options);
1587
+ this.failType = options.failType;
1588
+ }
1589
+ static from(raw, ctx) {
1590
+ validatePayload(raw.payload.length >= 1);
1591
+ const failType = raw.payload[0];
1592
+ return new Security2CCKEXFail_1({
1593
+ nodeId: ctx.sourceNodeId,
1594
+ failType,
1595
+ });
1596
+ }
1597
+ failType;
1598
+ serialize(ctx) {
1599
+ this.payload = Bytes.from([this.failType]);
1600
+ return super.serialize(ctx);
1601
+ }
1602
+ toLogEntry(ctx) {
1603
+ return {
1604
+ ...super.toLogEntry(ctx),
1605
+ message: { reason: getEnumMemberName(KEXFailType, this.failType) },
1606
+ };
1607
+ }
1608
+ };
1609
+ Security2CCKEXFail = Security2CCKEXFail_1 = __decorate([
1610
+ CCCommand(Security2Command.KEXFail)
1611
+ ], Security2CCKEXFail);
1612
+ export { Security2CCKEXFail };
1613
+ let Security2CCPublicKeyReport = Security2CCPublicKeyReport_1 = class Security2CCPublicKeyReport extends Security2CC {
1614
+ constructor(options) {
1615
+ super(options);
1616
+ this.includingNode = options.includingNode;
1617
+ this.publicKey = options.publicKey;
1618
+ }
1619
+ static from(raw, ctx) {
1620
+ validatePayload(raw.payload.length >= 17);
1621
+ const includingNode = !!(raw.payload[0] & 0b1);
1622
+ const publicKey = raw.payload.subarray(1);
1623
+ return new Security2CCPublicKeyReport_1({
1624
+ nodeId: ctx.sourceNodeId,
1625
+ includingNode,
1626
+ publicKey,
1627
+ });
1628
+ }
1629
+ includingNode;
1630
+ publicKey;
1631
+ serialize(ctx) {
1632
+ this.payload = Bytes.concat([
1633
+ Bytes.from([this.includingNode ? 1 : 0]),
1634
+ this.publicKey,
1635
+ ]);
1636
+ return super.serialize(ctx);
1637
+ }
1638
+ toLogEntry(ctx) {
1639
+ return {
1640
+ ...super.toLogEntry(ctx),
1641
+ message: {
1642
+ "is including node": this.includingNode,
1643
+ "public key": buffer2hex(this.publicKey),
1644
+ },
1645
+ };
1646
+ }
1647
+ };
1648
+ Security2CCPublicKeyReport = Security2CCPublicKeyReport_1 = __decorate([
1649
+ CCCommand(Security2Command.PublicKeyReport)
1650
+ ], Security2CCPublicKeyReport);
1651
+ export { Security2CCPublicKeyReport };
1652
+ let Security2CCNetworkKeyReport = Security2CCNetworkKeyReport_1 = class Security2CCNetworkKeyReport extends Security2CC {
1653
+ constructor(options) {
1654
+ super(options);
1655
+ this.grantedKey = options.grantedKey;
1656
+ this.networkKey = options.networkKey;
1657
+ }
1658
+ static from(raw, ctx) {
1659
+ validatePayload(raw.payload.length >= 17);
1660
+ const grantedKey = bitMaskToSecurityClass(raw.payload, 0);
1661
+ const networkKey = raw.payload.subarray(1, 17);
1662
+ return new Security2CCNetworkKeyReport_1({
1663
+ nodeId: ctx.sourceNodeId,
1664
+ grantedKey,
1665
+ networkKey,
1666
+ });
1667
+ }
1668
+ grantedKey;
1669
+ networkKey;
1670
+ serialize(ctx) {
1671
+ this.payload = Bytes.concat([
1672
+ securityClassToBitMask(this.grantedKey),
1673
+ this.networkKey,
1674
+ ]);
1675
+ return super.serialize(ctx);
1676
+ }
1677
+ toLogEntry(ctx) {
1678
+ return {
1679
+ ...super.toLogEntry(ctx),
1680
+ message: {
1681
+ "security class": getEnumMemberName(SecurityClass, this.grantedKey),
1682
+ // This shouldn't be logged, so users can safely post their logs online
1683
+ // "network key": buffer2hex(this.networkKey),
1684
+ },
1685
+ };
1686
+ }
1687
+ };
1688
+ Security2CCNetworkKeyReport = Security2CCNetworkKeyReport_1 = __decorate([
1689
+ CCCommand(Security2Command.NetworkKeyReport)
1690
+ ], Security2CCNetworkKeyReport);
1691
+ export { Security2CCNetworkKeyReport };
1692
+ let Security2CCNetworkKeyGet = Security2CCNetworkKeyGet_1 = class Security2CCNetworkKeyGet extends Security2CC {
1693
+ constructor(options) {
1694
+ super(options);
1695
+ this.requestedKey = options.requestedKey;
1696
+ }
1697
+ static from(raw, ctx) {
1698
+ validatePayload(raw.payload.length >= 1);
1699
+ const requestedKey = bitMaskToSecurityClass(raw.payload, 0);
1700
+ return new Security2CCNetworkKeyGet_1({
1701
+ nodeId: ctx.sourceNodeId,
1702
+ requestedKey,
1703
+ });
1704
+ }
1705
+ requestedKey;
1706
+ serialize(ctx) {
1707
+ this.payload = securityClassToBitMask(this.requestedKey);
1708
+ return super.serialize(ctx);
1709
+ }
1710
+ toLogEntry(ctx) {
1711
+ return {
1712
+ ...super.toLogEntry(ctx),
1713
+ message: {
1714
+ "security class": getEnumMemberName(SecurityClass, this.requestedKey),
1715
+ },
1716
+ };
1717
+ }
1718
+ };
1719
+ Security2CCNetworkKeyGet = Security2CCNetworkKeyGet_1 = __decorate([
1720
+ CCCommand(Security2Command.NetworkKeyGet)
1721
+ // Don't expect a response - we need to distinguish between Report and Fail
1722
+ // FIXME: maybe use the dynamic @expectedCCResponse instead?
1723
+ ], Security2CCNetworkKeyGet);
1724
+ export { Security2CCNetworkKeyGet };
1725
+ let Security2CCNetworkKeyVerify = class Security2CCNetworkKeyVerify extends Security2CC {
1726
+ };
1727
+ Security2CCNetworkKeyVerify = __decorate([
1728
+ CCCommand(Security2Command.NetworkKeyVerify)
1729
+ ], Security2CCNetworkKeyVerify);
1730
+ export { Security2CCNetworkKeyVerify };
1731
+ let Security2CCTransferEnd = Security2CCTransferEnd_1 = class Security2CCTransferEnd extends Security2CC {
1732
+ constructor(options) {
1733
+ super(options);
1734
+ this.keyVerified = options.keyVerified;
1735
+ this.keyRequestComplete = options.keyRequestComplete;
1736
+ }
1737
+ static from(raw, ctx) {
1738
+ validatePayload(raw.payload.length >= 1);
1739
+ const keyVerified = !!(raw.payload[0] & 0b10);
1740
+ const keyRequestComplete = !!(raw.payload[0] & 0b1);
1741
+ return new Security2CCTransferEnd_1({
1742
+ nodeId: ctx.sourceNodeId,
1743
+ keyVerified,
1744
+ keyRequestComplete,
1745
+ });
1746
+ }
1747
+ keyVerified;
1748
+ keyRequestComplete;
1749
+ serialize(ctx) {
1750
+ this.payload = Bytes.from([
1751
+ (this.keyVerified ? 0b10 : 0) + (this.keyRequestComplete ? 0b1 : 0),
1752
+ ]);
1753
+ return super.serialize(ctx);
1754
+ }
1755
+ toLogEntry(ctx) {
1756
+ return {
1757
+ ...super.toLogEntry(ctx),
1758
+ message: {
1759
+ "key verified": this.keyVerified,
1760
+ "request complete": this.keyRequestComplete,
1761
+ },
1762
+ };
1763
+ }
1764
+ };
1765
+ Security2CCTransferEnd = Security2CCTransferEnd_1 = __decorate([
1766
+ CCCommand(Security2Command.TransferEnd)
1767
+ ], Security2CCTransferEnd);
1768
+ export { Security2CCTransferEnd };
1769
+ let Security2CCCommandsSupportedReport = Security2CCCommandsSupportedReport_1 = class Security2CCCommandsSupportedReport extends Security2CC {
1770
+ constructor(options) {
1771
+ super(options);
1772
+ this.supportedCCs = options.supportedCCs;
1773
+ }
1774
+ static from(raw, ctx) {
1775
+ const CCs = parseCCList(raw.payload);
1776
+ // SDS13783: A sending node MAY terminate the list of supported command classes with the
1777
+ // COMMAND_CLASS_MARK command class identifier.
1778
+ // A receiving node MUST stop parsing the list of supported command classes if it detects the
1779
+ // COMMAND_CLASS_MARK command class identifier in the Security 2 Commands Supported Report
1780
+ const supportedCCs = CCs.supportedCCs;
1781
+ return new Security2CCCommandsSupportedReport_1({
1782
+ nodeId: ctx.sourceNodeId,
1783
+ supportedCCs,
1784
+ });
1785
+ }
1786
+ supportedCCs;
1787
+ serialize(ctx) {
1788
+ this.payload = encodeCCList(this.supportedCCs, []);
1789
+ return super.serialize(ctx);
1790
+ }
1791
+ toLogEntry(ctx) {
1792
+ return {
1793
+ ...super.toLogEntry(ctx),
1794
+ message: {
1795
+ "supported CCs": this.supportedCCs
1796
+ .map((cc) => getCCName(cc))
1797
+ .map((cc) => `\n· ${cc}`)
1798
+ .join(""),
1799
+ },
1800
+ };
1801
+ }
1802
+ };
1803
+ Security2CCCommandsSupportedReport = Security2CCCommandsSupportedReport_1 = __decorate([
1804
+ CCCommand(Security2Command.CommandsSupportedReport)
1805
+ ], Security2CCCommandsSupportedReport);
1806
+ export { Security2CCCommandsSupportedReport };
1807
+ let Security2CCCommandsSupportedGet = class Security2CCCommandsSupportedGet extends Security2CC {
1808
+ };
1809
+ Security2CCCommandsSupportedGet = __decorate([
1810
+ CCCommand(Security2Command.CommandsSupportedGet),
1811
+ expectedCCResponse(Security2CCCommandsSupportedReport)
1812
+ ], Security2CCCommandsSupportedGet);
1813
+ export { Security2CCCommandsSupportedGet };
1814
+ //# sourceMappingURL=Security2CC.js.map