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