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

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