@zwave-js/cc 14.3.10 → 15.0.0-beta.1

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 (523) hide show
  1. package/build/cjs/cc/AlarmSensorCC.d.ts +68 -68
  2. package/build/cjs/cc/AlarmSensorCC.js +12 -50
  3. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  4. package/build/cjs/cc/AssociationCC.d.ts +72 -73
  5. package/build/cjs/cc/AssociationCC.js +9 -26
  6. package/build/cjs/cc/AssociationCC.js.map +2 -2
  7. package/build/cjs/cc/AssociationGroupInfoCC.d.ts +71 -71
  8. package/build/cjs/cc/AssociationGroupInfoCC.js +11 -22
  9. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  10. package/build/cjs/cc/BarrierOperatorCC.d.ts +66 -72
  11. package/build/cjs/cc/BarrierOperatorCC.js +12 -44
  12. package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
  13. package/build/cjs/cc/BasicCC.d.ts +64 -65
  14. package/build/cjs/cc/BasicCC.js +15 -46
  15. package/build/cjs/cc/BasicCC.js.map +2 -2
  16. package/build/cjs/cc/BatteryCC.d.ts +162 -165
  17. package/build/cjs/cc/BatteryCC.js +7 -84
  18. package/build/cjs/cc/BatteryCC.js.map +2 -2
  19. package/build/cjs/cc/BinarySensorCC.d.ts +36 -36
  20. package/build/cjs/cc/BinarySensorCC.js +9 -29
  21. package/build/cjs/cc/BinarySensorCC.js.map +2 -2
  22. package/build/cjs/cc/BinarySwitchCC.d.ts +34 -34
  23. package/build/cjs/cc/BinarySwitchCC.js +6 -22
  24. package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
  25. package/build/cjs/cc/CRC16CC.d.ts +4 -8
  26. package/build/cjs/cc/CRC16CC.js +4 -27
  27. package/build/cjs/cc/CRC16CC.js.map +2 -2
  28. package/build/cjs/cc/CentralSceneCC.d.ts +74 -74
  29. package/build/cjs/cc/CentralSceneCC.js +7 -30
  30. package/build/cjs/cc/CentralSceneCC.js.map +2 -2
  31. package/build/cjs/cc/ClimateControlScheduleCC.d.ts +38 -40
  32. package/build/cjs/cc/ClimateControlScheduleCC.js +5 -24
  33. package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
  34. package/build/cjs/cc/ClockCC.d.ts +3 -3
  35. package/build/cjs/cc/ClockCC.js.map +2 -2
  36. package/build/cjs/cc/ColorSwitchCC.d.ts +117 -117
  37. package/build/cjs/cc/ColorSwitchCC.js +23 -75
  38. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  39. package/build/cjs/cc/ConfigurationCC._validateArgs.js +1 -1
  40. package/build/cjs/cc/ConfigurationCC._validateArgs.js.map +1 -1
  41. package/build/cjs/cc/ConfigurationCC.d.ts +48 -52
  42. package/build/cjs/cc/ConfigurationCC.js +11 -39
  43. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  44. package/build/cjs/cc/DeviceResetLocallyCC.d.ts +1 -1
  45. package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
  46. package/build/cjs/cc/DoorLockCC._validateArgs.js +1 -1
  47. package/build/cjs/cc/DoorLockCC._validateArgs.js.map +1 -1
  48. package/build/cjs/cc/DoorLockCC.d.ts +362 -361
  49. package/build/cjs/cc/DoorLockCC.js +51 -156
  50. package/build/cjs/cc/DoorLockCC.js.map +2 -2
  51. package/build/cjs/cc/DoorLockLoggingCC.d.ts +14 -14
  52. package/build/cjs/cc/DoorLockLoggingCC.js +4 -8
  53. package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
  54. package/build/cjs/cc/EnergyProductionCC.d.ts +16 -16
  55. package/build/cjs/cc/EnergyProductionCC.js +5 -17
  56. package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
  57. package/build/cjs/cc/EntryControlCC.d.ts +71 -71
  58. package/build/cjs/cc/EntryControlCC.js +9 -36
  59. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  60. package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +2 -0
  61. package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.js +26 -0
  62. package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.js.map +1 -1
  63. package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +101 -88
  64. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +159 -34
  65. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
  66. package/build/cjs/cc/HumidityControlModeCC.d.ts +31 -33
  67. package/build/cjs/cc/HumidityControlModeCC.js +6 -15
  68. package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
  69. package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +9 -11
  70. package/build/cjs/cc/HumidityControlOperatingStateCC.js +4 -12
  71. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
  72. package/build/cjs/cc/HumidityControlSetpointCC.d.ts +50 -50
  73. package/build/cjs/cc/HumidityControlSetpointCC.js +10 -28
  74. package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
  75. package/build/cjs/cc/InclusionControllerCC.d.ts +4 -4
  76. package/build/cjs/cc/InclusionControllerCC.js.map +2 -2
  77. package/build/cjs/cc/IndicatorCC.d.ts +119 -119
  78. package/build/cjs/cc/IndicatorCC.js +15 -61
  79. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  80. package/build/cjs/cc/IrrigationCC.d.ts +581 -585
  81. package/build/cjs/cc/IrrigationCC.js +29 -233
  82. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  83. package/build/cjs/cc/LanguageCC.d.ts +21 -21
  84. package/build/cjs/cc/LanguageCC.js +4 -15
  85. package/build/cjs/cc/LanguageCC.js.map +2 -2
  86. package/build/cjs/cc/LockCC.d.ts +9 -9
  87. package/build/cjs/cc/LockCC.js +4 -12
  88. package/build/cjs/cc/LockCC.js.map +2 -2
  89. package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +2 -2
  90. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  91. package/build/cjs/cc/ManufacturerSpecificCC.d.ts +67 -67
  92. package/build/cjs/cc/ManufacturerSpecificCC.js +5 -26
  93. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  94. package/build/cjs/cc/MeterCC.d.ts +120 -119
  95. package/build/cjs/cc/MeterCC.js +25 -69
  96. package/build/cjs/cc/MeterCC.js.map +2 -2
  97. package/build/cjs/cc/MultiChannelAssociationCC.d.ts +71 -73
  98. package/build/cjs/cc/MultiChannelAssociationCC.js +10 -28
  99. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  100. package/build/cjs/cc/MultiChannelCC.d.ts +136 -146
  101. package/build/cjs/cc/MultiChannelCC.js +26 -118
  102. package/build/cjs/cc/MultiChannelCC.js.map +2 -2
  103. package/build/cjs/cc/MultiCommandCC.d.ts +4 -8
  104. package/build/cjs/cc/MultiCommandCC.js +4 -37
  105. package/build/cjs/cc/MultiCommandCC.js.map +2 -2
  106. package/build/cjs/cc/MultilevelSensorCC.d.ts +50 -49
  107. package/build/cjs/cc/MultilevelSensorCC.js +12 -33
  108. package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
  109. package/build/cjs/cc/MultilevelSwitchCC.d.ts +146 -146
  110. package/build/cjs/cc/MultilevelSwitchCC.js +13 -107
  111. package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
  112. package/build/cjs/cc/NodeNamingCC.d.ts +30 -30
  113. package/build/cjs/cc/NodeNamingCC.js +5 -16
  114. package/build/cjs/cc/NodeNamingCC.js.map +2 -2
  115. package/build/cjs/cc/NotificationCC.d.ts +210 -208
  116. package/build/cjs/cc/NotificationCC.js +41 -113
  117. package/build/cjs/cc/NotificationCC.js.map +2 -2
  118. package/build/cjs/cc/PowerlevelCC.d.ts +6 -6
  119. package/build/cjs/cc/PowerlevelCC.js.map +2 -2
  120. package/build/cjs/cc/ProtectionCC.d.ts +117 -121
  121. package/build/cjs/cc/ProtectionCC.js +15 -50
  122. package/build/cjs/cc/ProtectionCC.js.map +2 -2
  123. package/build/cjs/cc/SceneActivationCC.d.ts +29 -29
  124. package/build/cjs/cc/SceneActivationCC.js +4 -17
  125. package/build/cjs/cc/SceneActivationCC.js.map +2 -2
  126. package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +35 -35
  127. package/build/cjs/cc/SceneActuatorConfigurationCC.js +9 -21
  128. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
  129. package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +36 -35
  130. package/build/cjs/cc/SceneControllerConfigurationCC.js +10 -22
  131. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  132. package/build/cjs/cc/ScheduleEntryLockCC.d.ts +109 -109
  133. package/build/cjs/cc/ScheduleEntryLockCC.js +13 -30
  134. package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
  135. package/build/cjs/cc/Security2CC.d.ts +15 -21
  136. package/build/cjs/cc/Security2CC.js +32 -347
  137. package/build/cjs/cc/Security2CC.js.map +3 -3
  138. package/build/cjs/cc/SecurityCC.d.ts +12 -19
  139. package/build/cjs/cc/SecurityCC.js +12 -106
  140. package/build/cjs/cc/SecurityCC.js.map +2 -2
  141. package/build/cjs/cc/SoundSwitchCC.d.ts +58 -58
  142. package/build/cjs/cc/SoundSwitchCC.js +11 -43
  143. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  144. package/build/cjs/cc/SupervisionCC.d.ts +21 -25
  145. package/build/cjs/cc/SupervisionCC.js +8 -38
  146. package/build/cjs/cc/SupervisionCC.js.map +2 -2
  147. package/build/cjs/cc/ThermostatFanModeCC.d.ts +37 -39
  148. package/build/cjs/cc/ThermostatFanModeCC.js +8 -21
  149. package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
  150. package/build/cjs/cc/ThermostatFanStateCC.d.ts +9 -11
  151. package/build/cjs/cc/ThermostatFanStateCC.js +4 -12
  152. package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
  153. package/build/cjs/cc/ThermostatModeCC.d.ts +39 -41
  154. package/build/cjs/cc/ThermostatModeCC.js +8 -21
  155. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  156. package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +9 -11
  157. package/build/cjs/cc/ThermostatOperatingStateCC.js +4 -12
  158. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  159. package/build/cjs/cc/ThermostatSetbackCC.d.ts +4 -4
  160. package/build/cjs/cc/ThermostatSetbackCC.js.map +2 -2
  161. package/build/cjs/cc/ThermostatSetpointCC.d.ts +51 -51
  162. package/build/cjs/cc/ThermostatSetpointCC.js +10 -25
  163. package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
  164. package/build/cjs/cc/TimeCC.d.ts +6 -6
  165. package/build/cjs/cc/TimeCC.js.map +2 -2
  166. package/build/cjs/cc/TimeParametersCC.d.ts +9 -9
  167. package/build/cjs/cc/TimeParametersCC.js +4 -11
  168. package/build/cjs/cc/TimeParametersCC.js.map +2 -2
  169. package/build/cjs/cc/TransportServiceCC.d.ts +7 -12
  170. package/build/cjs/cc/TransportServiceCC.js +3 -20
  171. package/build/cjs/cc/TransportServiceCC.js.map +2 -2
  172. package/build/cjs/cc/UserCodeCC._validateArgs.js +1 -1
  173. package/build/cjs/cc/UserCodeCC._validateArgs.js.map +1 -1
  174. package/build/cjs/cc/UserCodeCC.d.ts +236 -236
  175. package/build/cjs/cc/UserCodeCC.js +33 -98
  176. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  177. package/build/cjs/cc/VersionCC.d.ts +210 -212
  178. package/build/cjs/cc/VersionCC.js +7 -98
  179. package/build/cjs/cc/VersionCC.js.map +2 -2
  180. package/build/cjs/cc/WakeUpCC.d.ts +44 -44
  181. package/build/cjs/cc/WakeUpCC.js +6 -26
  182. package/build/cjs/cc/WakeUpCC.js.map +2 -2
  183. package/build/cjs/cc/WindowCoveringCC.d.ts +118 -122
  184. package/build/cjs/cc/WindowCoveringCC.js +16 -128
  185. package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
  186. package/build/cjs/cc/ZWavePlusCC.d.ts +74 -74
  187. package/build/cjs/cc/ZWavePlusCC.js +4 -25
  188. package/build/cjs/cc/ZWavePlusCC.js.map +2 -2
  189. package/build/cjs/cc/ZWaveProtocolCC.d.ts +28 -28
  190. package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
  191. package/build/cjs/cc/_CCValues.generated.d.ts +15814 -0
  192. package/build/cjs/cc/_CCValues.generated.js +8723 -0
  193. package/build/cjs/cc/_CCValues.generated.js.map +7 -0
  194. package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +4 -4
  195. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
  196. package/build/cjs/index.d.ts +1 -0
  197. package/build/cjs/index.js.map +1 -1
  198. package/build/cjs/index_browser.d.ts +9 -0
  199. package/build/cjs/index_browser.js +41 -1
  200. package/build/cjs/index_browser.js.map +2 -2
  201. package/build/cjs/lib/API.d.ts +7 -5
  202. package/build/cjs/lib/API.js +1 -1
  203. package/build/cjs/lib/API.js.map +2 -2
  204. package/build/cjs/lib/CCValueUtils.d.ts +14 -0
  205. package/build/cjs/lib/CCValueUtils.js +93 -0
  206. package/build/cjs/lib/CCValueUtils.js.map +7 -0
  207. package/build/cjs/lib/CommandClass.d.ts +10 -21
  208. package/build/cjs/lib/CommandClass.js +51 -106
  209. package/build/cjs/lib/CommandClass.js.map +3 -3
  210. package/build/cjs/lib/CommandClassDecorators.d.ts +1 -1
  211. package/build/cjs/lib/CommandClassDecorators.js +3 -3
  212. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  213. package/build/cjs/lib/Values.d.ts +7 -106
  214. package/build/cjs/lib/Values.js +13 -107
  215. package/build/cjs/lib/Values.js.map +3 -3
  216. package/build/cjs/lib/traits.d.ts +94 -0
  217. package/build/cjs/lib/traits.js +17 -0
  218. package/build/cjs/lib/traits.js.map +7 -0
  219. package/build/cjs/lib/utils.d.ts +2 -2
  220. package/build/cjs/lib/utils.js.map +2 -2
  221. package/build/esm/cc/AlarmSensorCC.d.ts +68 -68
  222. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  223. package/build/esm/cc/AlarmSensorCC.js +2 -40
  224. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  225. package/build/esm/cc/AssociationCC.d.ts +72 -73
  226. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  227. package/build/esm/cc/AssociationCC.js +2 -27
  228. package/build/esm/cc/AssociationCC.js.map +1 -1
  229. package/build/esm/cc/AssociationGroupInfoCC.d.ts +71 -71
  230. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  231. package/build/esm/cc/AssociationGroupInfoCC.js +2 -19
  232. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  233. package/build/esm/cc/BarrierOperatorCC.d.ts +66 -72
  234. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  235. package/build/esm/cc/BarrierOperatorCC.js +2 -37
  236. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  237. package/build/esm/cc/BasicCC.d.ts +64 -65
  238. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  239. package/build/esm/cc/BasicCC.js +2 -34
  240. package/build/esm/cc/BasicCC.js.map +1 -1
  241. package/build/esm/cc/BatteryCC.d.ts +162 -165
  242. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  243. package/build/esm/cc/BatteryCC.js +3 -80
  244. package/build/esm/cc/BatteryCC.js.map +1 -1
  245. package/build/esm/cc/BinarySensorCC.d.ts +36 -36
  246. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  247. package/build/esm/cc/BinarySensorCC.js +2 -19
  248. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  249. package/build/esm/cc/BinarySwitchCC.d.ts +34 -34
  250. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  251. package/build/esm/cc/BinarySwitchCC.js +2 -19
  252. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  253. package/build/esm/cc/CRC16CC.d.ts +4 -8
  254. package/build/esm/cc/CRC16CC.d.ts.map +1 -1
  255. package/build/esm/cc/CRC16CC.js +4 -34
  256. package/build/esm/cc/CRC16CC.js.map +1 -1
  257. package/build/esm/cc/CentralSceneCC.d.ts +74 -74
  258. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  259. package/build/esm/cc/CentralSceneCC.js +2 -27
  260. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  261. package/build/esm/cc/ClimateControlScheduleCC.d.ts +38 -40
  262. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  263. package/build/esm/cc/ClimateControlScheduleCC.js +2 -26
  264. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  265. package/build/esm/cc/ClockCC.d.ts +3 -3
  266. package/build/esm/cc/ClockCC.d.ts.map +1 -1
  267. package/build/esm/cc/ClockCC.js +0 -1
  268. package/build/esm/cc/ClockCC.js.map +1 -1
  269. package/build/esm/cc/ColorSwitchCC.d.ts +117 -117
  270. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  271. package/build/esm/cc/ColorSwitchCC.js +2 -58
  272. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  273. package/build/esm/cc/ConfigurationCC._validateArgs.js +1 -1
  274. package/build/esm/cc/ConfigurationCC._validateArgs.js.map +1 -1
  275. package/build/esm/cc/ConfigurationCC.d.ts +48 -52
  276. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  277. package/build/esm/cc/ConfigurationCC.js +2 -40
  278. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  279. package/build/esm/cc/DeviceResetLocallyCC.d.ts +1 -1
  280. package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
  281. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  282. package/build/esm/cc/DoorLockCC._validateArgs.js +1 -1
  283. package/build/esm/cc/DoorLockCC._validateArgs.js.map +1 -1
  284. package/build/esm/cc/DoorLockCC.d.ts +362 -361
  285. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  286. package/build/esm/cc/DoorLockCC.js +9 -129
  287. package/build/esm/cc/DoorLockCC.js.map +1 -1
  288. package/build/esm/cc/DoorLockLoggingCC.d.ts +14 -14
  289. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  290. package/build/esm/cc/DoorLockLoggingCC.js +2 -6
  291. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  292. package/build/esm/cc/EnergyProductionCC.d.ts +16 -16
  293. package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
  294. package/build/esm/cc/EnergyProductionCC.js +2 -15
  295. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  296. package/build/esm/cc/EntryControlCC.d.ts +71 -71
  297. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  298. package/build/esm/cc/EntryControlCC.js +2 -29
  299. package/build/esm/cc/EntryControlCC.js.map +1 -1
  300. package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +2 -0
  301. package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts.map +1 -1
  302. package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.js +20 -0
  303. package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.js.map +1 -1
  304. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +101 -88
  305. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  306. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +160 -53
  307. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  308. package/build/esm/cc/HumidityControlModeCC.d.ts +31 -33
  309. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  310. package/build/esm/cc/HumidityControlModeCC.js +2 -11
  311. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  312. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +9 -11
  313. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  314. package/build/esm/cc/HumidityControlOperatingStateCC.js +2 -9
  315. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  316. package/build/esm/cc/HumidityControlSetpointCC.d.ts +50 -50
  317. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  318. package/build/esm/cc/HumidityControlSetpointCC.js +2 -23
  319. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  320. package/build/esm/cc/InclusionControllerCC.d.ts +4 -4
  321. package/build/esm/cc/InclusionControllerCC.d.ts.map +1 -1
  322. package/build/esm/cc/InclusionControllerCC.js +0 -2
  323. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  324. package/build/esm/cc/IndicatorCC.d.ts +119 -119
  325. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  326. package/build/esm/cc/IndicatorCC.js +2 -50
  327. package/build/esm/cc/IndicatorCC.js.map +1 -1
  328. package/build/esm/cc/IrrigationCC.d.ts +581 -585
  329. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  330. package/build/esm/cc/IrrigationCC.js +3 -231
  331. package/build/esm/cc/IrrigationCC.js.map +1 -1
  332. package/build/esm/cc/LanguageCC.d.ts +21 -21
  333. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  334. package/build/esm/cc/LanguageCC.js +2 -13
  335. package/build/esm/cc/LanguageCC.js.map +1 -1
  336. package/build/esm/cc/LockCC.d.ts +9 -9
  337. package/build/esm/cc/LockCC.d.ts.map +1 -1
  338. package/build/esm/cc/LockCC.js +2 -10
  339. package/build/esm/cc/LockCC.js.map +1 -1
  340. package/build/esm/cc/ManufacturerProprietaryCC.d.ts +2 -2
  341. package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  342. package/build/esm/cc/ManufacturerProprietaryCC.js +0 -2
  343. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  344. package/build/esm/cc/ManufacturerSpecificCC.d.ts +67 -67
  345. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  346. package/build/esm/cc/ManufacturerSpecificCC.js +2 -26
  347. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  348. package/build/esm/cc/MeterCC.d.ts +120 -119
  349. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  350. package/build/esm/cc/MeterCC.js +3 -53
  351. package/build/esm/cc/MeterCC.js.map +1 -1
  352. package/build/esm/cc/MultiChannelAssociationCC.d.ts +71 -73
  353. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  354. package/build/esm/cc/MultiChannelAssociationCC.js +2 -30
  355. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  356. package/build/esm/cc/MultiChannelCC.d.ts +136 -146
  357. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  358. package/build/esm/cc/MultiChannelCC.js +10 -131
  359. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  360. package/build/esm/cc/MultiCommandCC.d.ts +4 -8
  361. package/build/esm/cc/MultiCommandCC.d.ts.map +1 -1
  362. package/build/esm/cc/MultiCommandCC.js +4 -38
  363. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  364. package/build/esm/cc/MultilevelSensorCC.d.ts +50 -49
  365. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  366. package/build/esm/cc/MultilevelSensorCC.js +2 -27
  367. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  368. package/build/esm/cc/MultilevelSwitchCC.d.ts +146 -146
  369. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  370. package/build/esm/cc/MultilevelSwitchCC.js +5 -105
  371. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  372. package/build/esm/cc/NodeNamingCC.d.ts +30 -30
  373. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  374. package/build/esm/cc/NodeNamingCC.js +2 -14
  375. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  376. package/build/esm/cc/NotificationCC.d.ts +210 -208
  377. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  378. package/build/esm/cc/NotificationCC.js +21 -97
  379. package/build/esm/cc/NotificationCC.js.map +1 -1
  380. package/build/esm/cc/PowerlevelCC.d.ts +6 -6
  381. package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
  382. package/build/esm/cc/PowerlevelCC.js +0 -4
  383. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  384. package/build/esm/cc/ProtectionCC.d.ts +117 -121
  385. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  386. package/build/esm/cc/ProtectionCC.js +2 -39
  387. package/build/esm/cc/ProtectionCC.js.map +1 -1
  388. package/build/esm/cc/SceneActivationCC.d.ts +29 -29
  389. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  390. package/build/esm/cc/SceneActivationCC.js +2 -15
  391. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  392. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +35 -35
  393. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  394. package/build/esm/cc/SceneActuatorConfigurationCC.js +2 -16
  395. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  396. package/build/esm/cc/SceneControllerConfigurationCC.d.ts +36 -35
  397. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  398. package/build/esm/cc/SceneControllerConfigurationCC.js +2 -16
  399. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  400. package/build/esm/cc/ScheduleEntryLockCC.d.ts +109 -109
  401. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  402. package/build/esm/cc/ScheduleEntryLockCC.js +2 -31
  403. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  404. package/build/esm/cc/Security2CC.d.ts +15 -21
  405. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  406. package/build/esm/cc/Security2CC.js +27 -475
  407. package/build/esm/cc/Security2CC.js.map +1 -1
  408. package/build/esm/cc/SecurityCC.d.ts +12 -19
  409. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  410. package/build/esm/cc/SecurityCC.js +13 -138
  411. package/build/esm/cc/SecurityCC.js.map +1 -1
  412. package/build/esm/cc/SoundSwitchCC.d.ts +58 -58
  413. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  414. package/build/esm/cc/SoundSwitchCC.js +2 -40
  415. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  416. package/build/esm/cc/SupervisionCC.d.ts +21 -25
  417. package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
  418. package/build/esm/cc/SupervisionCC.js +6 -41
  419. package/build/esm/cc/SupervisionCC.js.map +1 -1
  420. package/build/esm/cc/ThermostatFanModeCC.d.ts +37 -39
  421. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  422. package/build/esm/cc/ThermostatFanModeCC.js +2 -15
  423. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  424. package/build/esm/cc/ThermostatFanStateCC.d.ts +9 -11
  425. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  426. package/build/esm/cc/ThermostatFanStateCC.js +2 -9
  427. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  428. package/build/esm/cc/ThermostatModeCC.d.ts +39 -41
  429. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  430. package/build/esm/cc/ThermostatModeCC.js +2 -17
  431. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  432. package/build/esm/cc/ThermostatOperatingStateCC.d.ts +9 -11
  433. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  434. package/build/esm/cc/ThermostatOperatingStateCC.js +2 -9
  435. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  436. package/build/esm/cc/ThermostatSetbackCC.d.ts +4 -4
  437. package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
  438. package/build/esm/cc/ThermostatSetbackCC.js +0 -2
  439. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  440. package/build/esm/cc/ThermostatSetpointCC.d.ts +51 -51
  441. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  442. package/build/esm/cc/ThermostatSetpointCC.js +2 -22
  443. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  444. package/build/esm/cc/TimeCC.d.ts +6 -6
  445. package/build/esm/cc/TimeCC.d.ts.map +1 -1
  446. package/build/esm/cc/TimeCC.js +0 -4
  447. package/build/esm/cc/TimeCC.js.map +1 -1
  448. package/build/esm/cc/TimeParametersCC.d.ts +9 -9
  449. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  450. package/build/esm/cc/TimeParametersCC.js +2 -9
  451. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  452. package/build/esm/cc/TransportServiceCC.d.ts +7 -12
  453. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  454. package/build/esm/cc/TransportServiceCC.js +5 -38
  455. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  456. package/build/esm/cc/UserCodeCC._validateArgs.js +1 -1
  457. package/build/esm/cc/UserCodeCC._validateArgs.js.map +1 -1
  458. package/build/esm/cc/UserCodeCC.d.ts +236 -236
  459. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  460. package/build/esm/cc/UserCodeCC.js +2 -72
  461. package/build/esm/cc/UserCodeCC.js.map +1 -1
  462. package/build/esm/cc/VersionCC.d.ts +210 -212
  463. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  464. package/build/esm/cc/VersionCC.js +2 -96
  465. package/build/esm/cc/VersionCC.js.map +1 -1
  466. package/build/esm/cc/WakeUpCC.d.ts +44 -44
  467. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  468. package/build/esm/cc/WakeUpCC.js +2 -22
  469. package/build/esm/cc/WakeUpCC.js.map +1 -1
  470. package/build/esm/cc/WindowCoveringCC.d.ts +118 -122
  471. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  472. package/build/esm/cc/WindowCoveringCC.js +3 -108
  473. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  474. package/build/esm/cc/ZWavePlusCC.d.ts +74 -74
  475. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  476. package/build/esm/cc/ZWavePlusCC.js +2 -26
  477. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  478. package/build/esm/cc/ZWaveProtocolCC.d.ts +28 -28
  479. package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
  480. package/build/esm/cc/ZWaveProtocolCC.js +0 -27
  481. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  482. package/build/esm/cc/_CCValues.generated.d.ts +15814 -0
  483. package/build/esm/cc/_CCValues.generated.d.ts.map +1 -0
  484. package/build/esm/cc/_CCValues.generated.js +9187 -0
  485. package/build/esm/cc/_CCValues.generated.js.map +1 -0
  486. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +4 -4
  487. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
  488. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +0 -3
  489. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  490. package/build/esm/index.d.ts +1 -0
  491. package/build/esm/index.d.ts.map +1 -1
  492. package/build/esm/index_browser.d.ts +9 -0
  493. package/build/esm/index_browser.d.ts.map +1 -1
  494. package/build/esm/index_browser.js +8 -1
  495. package/build/esm/index_browser.js.map +1 -1
  496. package/build/esm/lib/API.d.ts +7 -5
  497. package/build/esm/lib/API.d.ts.map +1 -1
  498. package/build/esm/lib/API.js +1 -1
  499. package/build/esm/lib/API.js.map +1 -1
  500. package/build/esm/lib/CCValueUtils.d.ts +14 -0
  501. package/build/esm/lib/CCValueUtils.d.ts.map +1 -0
  502. package/build/esm/lib/CCValueUtils.js +62 -0
  503. package/build/esm/lib/CCValueUtils.js.map +1 -0
  504. package/build/esm/lib/CommandClass.d.ts +10 -21
  505. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  506. package/build/esm/lib/CommandClass.js +8 -101
  507. package/build/esm/lib/CommandClass.js.map +1 -1
  508. package/build/esm/lib/CommandClassDecorators.d.ts +1 -1
  509. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  510. package/build/esm/lib/CommandClassDecorators.js +1 -1
  511. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  512. package/build/esm/lib/Values.d.ts +7 -106
  513. package/build/esm/lib/Values.d.ts.map +1 -1
  514. package/build/esm/lib/Values.js +7 -104
  515. package/build/esm/lib/Values.js.map +1 -1
  516. package/build/esm/lib/traits.d.ts +94 -0
  517. package/build/esm/lib/traits.d.ts.map +1 -0
  518. package/build/esm/lib/traits.js +2 -0
  519. package/build/esm/lib/traits.js.map +1 -0
  520. package/build/esm/lib/utils.d.ts +2 -2
  521. package/build/esm/lib/utils.d.ts.map +1 -1
  522. package/build/esm/lib/utils.js.map +1 -1
  523. package/package.json +16 -14
@@ -32,7 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
32
32
  }
33
33
  return useValue ? value : void 0;
34
34
  };
35
- import { CommandClasses, MPANState, MessagePriority, SPANState, SecurityClass, TransmitOptions, ZWaveError, ZWaveErrorCodes, decryptAES128CCMAsync, decryptAES128CCMSync, encodeBitMask, encryptAES128CCMAsync, encryptAES128CCMSync, getCCName, highResTimestamp, isLongRangeNodeId, isTransmissionError, isZWaveError, parseBitMask, parseCCList, securityClassIsS2, securityClassOrder, validatePayload, } from "@zwave-js/core";
35
+ import { CommandClasses, MPANState, MessagePriority, SPANState, SecurityClass, TransmitOptions, ZWaveError, ZWaveErrorCodes, decryptAES128CCM, encodeBitMask, encryptAES128CCM, getCCName, highResTimestamp, isLongRangeNodeId, isTransmissionError, isZWaveError, parseBitMask, parseCCList, securityClassIsS2, securityClassOrder, validatePayload, } from "@zwave-js/core";
36
36
  import { EncapsulationFlags, NODE_ID_BROADCAST, NODE_ID_BROADCAST_LR, encodeCCList, } from "@zwave-js/core/safe";
37
37
  import { Bytes } from "@zwave-js/shared/safe";
38
38
  import { buffer2hex, getEnumMemberName, pick } from "@zwave-js/shared/safe";
@@ -111,143 +111,18 @@ function assertSecurityTX(ctx, destination) {
111
111
  }
112
112
  return ret;
113
113
  }
114
- /** @deprecated Use {@link decryptSinglecastAsync} instead */
115
- function decryptSinglecastSync(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
116
- const decryptWithNonce = (nonce) => {
117
- const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
118
- const iv = nonce;
119
- return {
120
- key,
121
- iv,
122
- // eslint-disable-next-line @typescript-eslint/no-deprecated
123
- ...decryptAES128CCMSync(key, iv, ciphertext, authData, authTag),
124
- };
125
- };
126
- const getNonceAndDecrypt = () => {
127
- // eslint-disable-next-line @typescript-eslint/no-deprecated
128
- const iv = securityManager.nextNonce(sendingNodeId);
129
- return decryptWithNonce(iv);
130
- };
131
- if (spanState.type === SPANState.SPAN) {
132
- // There SHOULD be a shared SPAN between both parties. But experience has shown that both could have
133
- // sent a command at roughly the same time, using the same SPAN for encryption.
134
- // To avoid a nasty desync and both nodes trying to resync at the same time, causing message loss,
135
- // we accept commands encrypted with the previous SPAN under very specific circumstances:
136
- if (
137
- // The previous SPAN is still known, i.e. the node didn't send another command that was successfully decrypted
138
- !!spanState.currentSPAN
139
- // it is still valid
140
- && spanState.currentSPAN.expires > highResTimestamp()
141
- // The received command is exactly the next, expected one
142
- && prevSequenceNumber != undefined
143
- && curSequenceNumber === ((prevSequenceNumber + 1) & 0xff)
144
- // And in case of a mock-based test, do this only on the controller
145
- && !ctx.__internalIsMockNode) {
146
- const nonce = spanState.currentSPAN.nonce;
147
- spanState.currentSPAN = undefined;
148
- // If we could decrypt this way, we're done...
149
- const result = decryptWithNonce(nonce);
150
- if (result.authOK) {
151
- return {
152
- ...result,
153
- securityClass: spanState.securityClass,
154
- };
155
- }
156
- // ...otherwise, we need to try the normal way
157
- }
158
- else {
159
- // forgetting the current SPAN shouldn't be necessary but better be safe than sorry
160
- spanState.currentSPAN = undefined;
161
- }
162
- // This can only happen if the security class is known
163
- return {
164
- ...getNonceAndDecrypt(),
165
- securityClass: spanState.securityClass,
166
- };
167
- }
168
- else if (spanState.type === SPANState.LocalEI) {
169
- // We've sent the other our receiver's EI and received its sender's EI,
170
- // meaning we can now establish an SPAN
171
- const senderEI = getSenderEI(extensions);
172
- if (!senderEI)
173
- failNoSPAN();
174
- const receiverEI = spanState.receiverEI;
175
- // How we do this depends on whether we know the security class of the other node
176
- const isBootstrappingNode = securityManager.tempKeys.has(sendingNodeId);
177
- if (isBootstrappingNode) {
178
- // We're currently bootstrapping the node, it might be using a temporary key
179
- // eslint-disable-next-line @typescript-eslint/no-deprecated
180
- securityManager.initializeTempSPAN(sendingNodeId, senderEI, receiverEI);
181
- const ret = getNonceAndDecrypt();
182
- // Decryption with the temporary key worked
183
- if (ret.authOK) {
184
- return {
185
- ...ret,
186
- securityClass: SecurityClass.Temporary,
187
- };
188
- }
189
- // Reset the SPAN state and try with the recently granted security class
190
- securityManager.setSPANState(sendingNodeId, spanState);
191
- }
192
- // When ending up here, one of two situations has occured:
193
- // a) We've taken over an existing network and do not know the node's security class
194
- // b) We know the security class, but we're about to establish a new SPAN. This may happen at a lower
195
- // security class than the one the node normally uses, e.g. when we're being queried for securely
196
- // supported CCs.
197
- // In both cases, we should simply try decoding with multiple security classes, starting from the highest one.
198
- // If this fails, we restore the previous (partial) SPAN state.
199
- // Try all security classes where we do not definitely know that it was not granted
200
- // While bootstrapping a node, we consider the key that is being exchanged (including S0) to be the highest. No need to look at others
201
- const possibleSecurityClasses = isBootstrappingNode
202
- ? [ctx.getHighestSecurityClass(sendingNodeId)]
203
- : securityClassOrder.filter((s) => ctx.hasSecurityClass(sendingNodeId, s)
204
- !== false);
205
- for (const secClass of possibleSecurityClasses) {
206
- // Skip security classes we don't have keys for
207
- if (!securityManager.hasKeysForSecurityClass(secClass)) {
208
- continue;
209
- }
210
- // Initialize an SPAN with that security class
211
- // eslint-disable-next-line @typescript-eslint/no-deprecated
212
- securityManager.initializeSPAN(sendingNodeId, secClass, senderEI, receiverEI);
213
- const ret = getNonceAndDecrypt();
214
- // It worked, return the result
215
- if (ret.authOK) {
216
- // Also if we weren't sure before, we now know that the security class is granted
217
- if (ctx.hasSecurityClass(sendingNodeId, secClass)
218
- === undefined) {
219
- ctx.setSecurityClass(sendingNodeId, secClass, true);
220
- }
221
- return {
222
- ...ret,
223
- securityClass: secClass,
224
- };
225
- }
226
- else {
227
- // Reset the SPAN state and try with the next security class
228
- securityManager.setSPANState(sendingNodeId, spanState);
229
- }
230
- }
231
- }
232
- // Nothing worked, fail the decryption
233
- return {
234
- plaintext: new Uint8Array(),
235
- authOK: false,
236
- securityClass: undefined,
237
- };
238
- }
239
- async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
114
+ async function decryptSinglecast(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
240
115
  const decryptWithNonce = async (nonce) => {
241
116
  const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
242
117
  const iv = nonce;
243
118
  return {
244
119
  key,
245
120
  iv,
246
- ...(await decryptAES128CCMAsync(ciphertext, key, iv, authData, authTag)),
121
+ ...(await decryptAES128CCM(ciphertext, key, iv, authData, authTag)),
247
122
  };
248
123
  };
249
124
  const getNonceAndDecrypt = async () => {
250
- const iv = await securityManager.nextNonceAsync(sendingNodeId);
125
+ const iv = await securityManager.nextNonce(sendingNodeId);
251
126
  return decryptWithNonce(iv);
252
127
  };
253
128
  if (spanState.type === SPANState.SPAN) {
@@ -298,7 +173,7 @@ async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSe
298
173
  const isBootstrappingNode = securityManager.tempKeys.has(sendingNodeId);
299
174
  if (isBootstrappingNode) {
300
175
  // We're currently bootstrapping the node, it might be using a temporary key
301
- await securityManager.initializeTempSPANAsync(sendingNodeId, senderEI, receiverEI);
176
+ await securityManager.initializeTempSPAN(sendingNodeId, senderEI, receiverEI);
302
177
  const ret = await getNonceAndDecrypt();
303
178
  // Decryption with the temporary key worked
304
179
  if (ret.authOK) {
@@ -329,7 +204,7 @@ async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSe
329
204
  continue;
330
205
  }
331
206
  // Initialize an SPAN with that security class
332
- await securityManager.initializeSPANAsync(sendingNodeId, secClass, senderEI, receiverEI);
207
+ await securityManager.initializeSPAN(sendingNodeId, secClass, senderEI, receiverEI);
333
208
  const ret = await getNonceAndDecrypt();
334
209
  // It worked, return the result
335
210
  if (ret.authOK) {
@@ -356,27 +231,13 @@ async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSe
356
231
  securityClass: undefined,
357
232
  };
358
233
  }
359
- /** @deprecated Use {@link decryptMulticastAsync} instead */
360
- function decryptMulticastSync(sendingNodeId, securityManager, groupId, ciphertext, authData, authTag) {
361
- // eslint-disable-next-line @typescript-eslint/no-deprecated
362
- const iv = securityManager.nextPeerMPAN(sendingNodeId, groupId);
363
- const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
364
- return {
365
- key,
366
- iv,
367
- // eslint-disable-next-line @typescript-eslint/no-deprecated
368
- ...decryptAES128CCMSync(key, iv, ciphertext, authData, authTag),
369
- // The security class is irrelevant when decrypting multicast commands
370
- securityClass: undefined,
371
- };
372
- }
373
- async function decryptMulticastAsync(sendingNodeId, securityManager, groupId, ciphertext, authData, authTag) {
374
- const iv = await securityManager.nextPeerMPANAsync(sendingNodeId, groupId);
234
+ async function decryptMulticast(sendingNodeId, securityManager, groupId, ciphertext, authData, authTag) {
235
+ const iv = await securityManager.nextPeerMPAN(sendingNodeId, groupId);
375
236
  const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
376
237
  return {
377
238
  key,
378
239
  iv,
379
- ...(await decryptAES128CCMAsync(ciphertext, key, iv, authData, authTag)),
240
+ ...(await decryptAES128CCM(ciphertext, key, iv, authData, authTag)),
380
241
  // The security class is irrelevant when decrypting multicast commands
381
242
  securityClass: undefined,
382
243
  };
@@ -503,7 +364,7 @@ let Security2CCAPI = (() => {
503
364
  if (!securityManager) {
504
365
  throw new ZWaveError(`Nonces can only be sent if secure communication is set up!`, ZWaveErrorCodes.Driver_NoSecurity);
505
366
  }
506
- const receiverEI = await securityManager.generateNonceAsync(this.endpoint.nodeId);
367
+ const receiverEI = await securityManager.generateNonce(this.endpoint.nodeId);
507
368
  const cc = new Security2CCNonceReport({
508
369
  nodeId: this.endpoint.nodeId,
509
370
  endpointIndex: this.endpoint.index,
@@ -1123,8 +984,7 @@ let Security2CCMessageEncapsulation = (() => {
1123
984
  throw new ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", ZWaveErrorCodes.Security2CC_MissingExtension);
1124
985
  }
1125
986
  }
1126
- /** @deprecated Use {@link fromAsync} instead */
1127
- static from(raw, ctx) {
987
+ static async from(raw, ctx) {
1128
988
  const securityManager = assertSecurityRX(ctx);
1129
989
  validatePayload(raw.payload.length >= 2);
1130
990
  // Check the sequence number to avoid duplicates
@@ -1161,12 +1021,10 @@ let Security2CCMessageEncapsulation = (() => {
1161
1021
  // we still need to increment the SPAN or MPAN state
1162
1022
  if (mustDiscardCommand) {
1163
1023
  if (mcctx.isMulticast) {
1164
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1165
- securityManager.nextPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
1024
+ await securityManager.nextPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
1166
1025
  }
1167
1026
  else {
1168
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1169
- securityManager.nextNonce(ctx.sourceNodeId);
1027
+ await securityManager.nextNonce(ctx.sourceNodeId);
1170
1028
  }
1171
1029
  validatePayload.fail("Invalid S2 extension");
1172
1030
  }
@@ -1198,9 +1056,7 @@ let Security2CCMessageEncapsulation = (() => {
1198
1056
  securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
1199
1057
  failNoMPAN();
1200
1058
  }
1201
- decrypt = () =>
1202
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1203
- decryptMulticastSync(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
1059
+ decrypt = () => decryptMulticast(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
1204
1060
  }
1205
1061
  else {
1206
1062
  // Decrypt payload and verify integrity
@@ -1214,9 +1070,7 @@ let Security2CCMessageEncapsulation = (() => {
1214
1070
  // For now, do the same as if we didn't have any EI
1215
1071
  failNoSPAN();
1216
1072
  }
1217
- decrypt = () =>
1218
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1219
- decryptSinglecastSync(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
1073
+ decrypt = () => decryptSinglecast(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
1220
1074
  }
1221
1075
  let plaintext;
1222
1076
  let authOK = false;
@@ -1241,7 +1095,7 @@ let Security2CCMessageEncapsulation = (() => {
1241
1095
  key,
1242
1096
  iv,
1243
1097
  securityClass: decryptionSecurityClass,
1244
- } = decrypt());
1098
+ } = await decrypt());
1245
1099
  if (!!authOK && !!plaintext)
1246
1100
  break;
1247
1101
  // No need to try further SPANs if we just got the sender's EI
@@ -1283,187 +1137,6 @@ let Security2CCMessageEncapsulation = (() => {
1283
1137
  validatePayload.fail("Invalid combination of extensions");
1284
1138
  }
1285
1139
  // If the MPAN extension was received, store the MPAN
1286
- if (!mcctx.isMulticast) {
1287
- if (mpanExtension) {
1288
- securityManager.storePeerMPAN(ctx.sourceNodeId, mpanExtension.groupId, {
1289
- type: MPANState.MPAN,
1290
- currentMPAN: mpanExtension.innerMPANState,
1291
- });
1292
- }
1293
- }
1294
- // Not every S2 message includes an encapsulated CC
1295
- const decryptedCCBytes = plaintext.subarray(offset);
1296
- let encapsulated;
1297
- if (decryptedCCBytes.length > 0) {
1298
- // make sure this contains a complete CC command that's worth splitting
1299
- validatePayload(decryptedCCBytes.length >= 2);
1300
- // and deserialize the CC
1301
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1302
- encapsulated = CommandClass.parse(decryptedCCBytes, ctx);
1303
- }
1304
- const ret = new Security2CCMessageEncapsulation({
1305
- nodeId: ctx.sourceNodeId,
1306
- sequenceNumber,
1307
- securityClass,
1308
- extensions,
1309
- encapsulated,
1310
- });
1311
- // Remember for debugging purposes
1312
- ret.key = key;
1313
- ret.iv = iv;
1314
- ret.authData = authData;
1315
- ret.authTag = authTag;
1316
- ret.plaintext = decryptedCCBytes;
1317
- return ret;
1318
- }
1319
- static async fromAsync(raw, ctx) {
1320
- const securityManager = assertSecurityRX(ctx);
1321
- validatePayload(raw.payload.length >= 2);
1322
- // Check the sequence number to avoid duplicates
1323
- const sequenceNumber = raw.payload[0];
1324
- // Ensure the node has a security class
1325
- validatePayload.withReason("No security class granted")(ctx.getHighestSecurityClass(ctx.sourceNodeId) !== SecurityClass.None);
1326
- const hasExtensions = !!(raw.payload[1] & 0b1);
1327
- const hasEncryptedExtensions = !!(raw.payload[1] & 0b10);
1328
- let offset = 2;
1329
- const extensions = [];
1330
- let mustDiscardCommand = false;
1331
- if (hasExtensions) {
1332
- const parseResult = parseExtensions(raw.payload.subarray(offset), false);
1333
- extensions.push(...parseResult.extensions);
1334
- offset += parseResult.bytesRead;
1335
- mustDiscardCommand = parseResult.mustDiscardCommand;
1336
- }
1337
- const mcctx = (() => {
1338
- const multicastGroupId = getMulticastGroupId(extensions);
1339
- if (ctx.frameType === "multicast" || ctx.frameType === "broadcast") {
1340
- if (multicastGroupId == undefined) {
1341
- validatePayload.fail("Multicast frames without MGRP extension");
1342
- }
1343
- return {
1344
- isMulticast: true,
1345
- groupId: multicastGroupId,
1346
- };
1347
- }
1348
- else {
1349
- return { isMulticast: false, groupId: multicastGroupId };
1350
- }
1351
- })();
1352
- // If a command is to be discarded before decryption,
1353
- // we still need to increment the SPAN or MPAN state
1354
- if (mustDiscardCommand) {
1355
- if (mcctx.isMulticast) {
1356
- await securityManager.nextPeerMPANAsync(ctx.sourceNodeId, mcctx.groupId);
1357
- }
1358
- else {
1359
- await securityManager.nextNonceAsync(ctx.sourceNodeId);
1360
- }
1361
- validatePayload.fail("Invalid S2 extension");
1362
- }
1363
- let prevSequenceNumber;
1364
- let mpanState;
1365
- if (mcctx.isMulticast) {
1366
- mpanState = securityManager.getPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
1367
- }
1368
- else {
1369
- // Don't accept duplicate Singlecast commands
1370
- prevSequenceNumber = validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
1371
- // When a node receives a singlecast message after a multicast group was marked out of sync,
1372
- // it must forget about the group.
1373
- if (mcctx.groupId == undefined) {
1374
- securityManager.resetOutOfSyncMPANs(ctx.sourceNodeId);
1375
- }
1376
- }
1377
- const unencryptedPayload = raw.payload.subarray(0, offset);
1378
- const ciphertext = raw.payload.subarray(offset, -SECURITY_S2_AUTH_TAG_LENGTH);
1379
- const authTag = raw.payload.subarray(-SECURITY_S2_AUTH_TAG_LENGTH);
1380
- const messageLength = 2 /* CommandClass.computeEncapsulationOverhead() */
1381
- + raw.payload.length;
1382
- const authData = getAuthenticationData(ctx.sourceNodeId, getDestinationIDRX(ctx, extensions), ctx.homeId, messageLength, unencryptedPayload);
1383
- let decrypt;
1384
- if (mcctx.isMulticast) {
1385
- // For incoming multicast commands, make sure we have an MPAN
1386
- if (mpanState?.type !== MPANState.MPAN) {
1387
- // If we don't, mark the MPAN as out of sync, so we can respond accordingly on the singlecast followup
1388
- securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
1389
- failNoMPAN();
1390
- }
1391
- decrypt = () => decryptMulticastAsync(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
1392
- }
1393
- else {
1394
- // Decrypt payload and verify integrity
1395
- const spanState = securityManager.getSPANState(ctx.sourceNodeId);
1396
- // If we are not able to establish an SPAN yet, fail the decryption
1397
- if (spanState.type === SPANState.None) {
1398
- failNoSPAN();
1399
- }
1400
- else if (spanState.type === SPANState.RemoteEI) {
1401
- // TODO: The specs are not clear how to handle this case
1402
- // For now, do the same as if we didn't have any EI
1403
- failNoSPAN();
1404
- }
1405
- decrypt = () => decryptSinglecastAsync(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
1406
- }
1407
- let plaintext;
1408
- let authOK = false;
1409
- let key;
1410
- let iv;
1411
- let decryptionSecurityClass;
1412
- // If the Receiver is unable to authenticate the singlecast message with the current SPAN,
1413
- // the Receiver SHOULD try decrypting the message with one or more of the following SPAN values,
1414
- // stopping when decryption is successful or the maximum number of iterations is reached.
1415
- // If the Receiver is unable to decrypt the S2 MC frame with the current MPAN, the Receiver MAY try
1416
- // decrypting the frame with one or more of the subsequent MPAN values, stopping when decryption is
1417
- // successful or the maximum number of iterations is reached.
1418
- const decryptAttempts = mcctx.isMulticast
1419
- ? MAX_DECRYPT_ATTEMPTS_MULTICAST
1420
- : mcctx.groupId != undefined
1421
- ? MAX_DECRYPT_ATTEMPTS_SC_FOLLOWUP
1422
- : MAX_DECRYPT_ATTEMPTS_SINGLECAST;
1423
- for (let i = 0; i < decryptAttempts; i++) {
1424
- ({
1425
- plaintext,
1426
- authOK,
1427
- key,
1428
- iv,
1429
- securityClass: decryptionSecurityClass,
1430
- } = await decrypt());
1431
- if (!!authOK && !!plaintext)
1432
- break;
1433
- // No need to try further SPANs if we just got the sender's EI
1434
- if (!!getSenderEI(extensions))
1435
- break;
1436
- }
1437
- // If authentication fails, do so with an error code that instructs the
1438
- // applHost to tell the node we have no nonce
1439
- if (!authOK || !plaintext) {
1440
- if (mcctx.isMulticast) {
1441
- // Mark the MPAN as out of sync
1442
- securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
1443
- validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecodeMulticast);
1444
- }
1445
- else {
1446
- validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecode);
1447
- }
1448
- }
1449
- else if (!mcctx.isMulticast && mcctx.groupId != undefined) {
1450
- // After reception of a singlecast followup, the MPAN state must be increased
1451
- securityManager.tryIncrementPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
1452
- }
1453
- // Remember which security class was used to decrypt this message, so we can discard it later
1454
- const securityClass = decryptionSecurityClass;
1455
- offset = 0;
1456
- if (hasEncryptedExtensions) {
1457
- const parseResult = parseExtensions(plaintext, true);
1458
- extensions.push(...parseResult.extensions);
1459
- offset += parseResult.bytesRead;
1460
- mustDiscardCommand = parseResult.mustDiscardCommand;
1461
- }
1462
- // Before we can continue, check if the command must be discarded
1463
- if (mustDiscardCommand) {
1464
- validatePayload.fail("Invalid extension");
1465
- }
1466
- // If the MPAN extension was received, store the MPAN
1467
1140
  if (!mcctx.isMulticast) {
1468
1141
  const mpanExtension = extensions.find((e) => e instanceof MPANExtension);
1469
1142
  if (mpanExtension) {
@@ -1480,7 +1153,7 @@ let Security2CCMessageEncapsulation = (() => {
1480
1153
  // make sure this contains a complete CC command that's worth splitting
1481
1154
  validatePayload(decryptedCCBytes.length >= 2);
1482
1155
  // and deserialize the CC
1483
- encapsulated = await CommandClass.parseAsync(decryptedCCBytes, ctx);
1156
+ encapsulated = await CommandClass.parse(decryptedCCBytes, ctx);
1484
1157
  }
1485
1158
  const ret = new Security2CCMessageEncapsulation({
1486
1159
  nodeId: ctx.sourceNodeId,
@@ -1536,51 +1209,7 @@ let Security2CCMessageEncapsulation = (() => {
1536
1209
  getMulticastGroupId() {
1537
1210
  return getMulticastGroupId(this.extensions);
1538
1211
  }
1539
- /** @deprecated Use {@link maybeAddSPANExtensionAsync} instead */
1540
- maybeAddSPANExtensionSync(ctx, securityManager) {
1541
- if (!this.isSinglecast())
1542
- return;
1543
- const receiverNodeId = this.nodeId;
1544
- const spanState = securityManager.getSPANState(receiverNodeId);
1545
- if (spanState.type === SPANState.None
1546
- || spanState.type === SPANState.LocalEI) {
1547
- // Can't do anything here if we don't have the receiver's EI
1548
- throw new ZWaveError(`Security S2 CC requires the receiver's nonce to be sent!`, ZWaveErrorCodes.Security2CC_NoSPAN);
1549
- }
1550
- else if (spanState.type === SPANState.RemoteEI) {
1551
- // We have the receiver's EI, generate our input and send it over
1552
- // With both, we can create an SPAN
1553
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1554
- const senderEI = securityManager.generateNonce(undefined);
1555
- const receiverEI = spanState.receiverEI;
1556
- // While bootstrapping a node, prefer the temporary key, unless the
1557
- // specific command specifies a security class
1558
- if (this.securityClass == undefined
1559
- && securityManager.tempKeys.has(receiverNodeId)) {
1560
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1561
- securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
1562
- }
1563
- else {
1564
- const securityClass = this.securityClass
1565
- ?? ctx.getHighestSecurityClass(receiverNodeId);
1566
- if (securityClass == undefined) {
1567
- throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
1568
- }
1569
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1570
- securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
1571
- }
1572
- // Add or update the SPAN extension
1573
- let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
1574
- if (spanExtension) {
1575
- spanExtension.senderEI = senderEI;
1576
- }
1577
- else {
1578
- spanExtension = new SPANExtension({ senderEI });
1579
- this.extensions.push(spanExtension);
1580
- }
1581
- }
1582
- }
1583
- async maybeAddSPANExtensionAsync(ctx, securityManager) {
1212
+ async maybeAddSPANExtension(ctx, securityManager) {
1584
1213
  if (!this.isSinglecast())
1585
1214
  return;
1586
1215
  const receiverNodeId = this.nodeId;
@@ -1593,13 +1222,13 @@ let Security2CCMessageEncapsulation = (() => {
1593
1222
  else if (spanState.type === SPANState.RemoteEI) {
1594
1223
  // We have the receiver's EI, generate our input and send it over
1595
1224
  // With both, we can create an SPAN
1596
- const senderEI = await securityManager.generateNonceAsync(undefined);
1225
+ const senderEI = await securityManager.generateNonce(undefined);
1597
1226
  const receiverEI = spanState.receiverEI;
1598
1227
  // While bootstrapping a node, prefer the temporary key, unless the
1599
1228
  // specific command specifies a security class
1600
1229
  if (this.securityClass == undefined
1601
1230
  && securityManager.tempKeys.has(receiverNodeId)) {
1602
- await securityManager.initializeTempSPANAsync(receiverNodeId, senderEI, receiverEI);
1231
+ await securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
1603
1232
  }
1604
1233
  else {
1605
1234
  const securityClass = this.securityClass
@@ -1607,7 +1236,7 @@ let Security2CCMessageEncapsulation = (() => {
1607
1236
  if (securityClass == undefined) {
1608
1237
  throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
1609
1238
  }
1610
- await securityManager.initializeSPANAsync(receiverNodeId, securityClass, senderEI, receiverEI);
1239
+ await securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
1611
1240
  }
1612
1241
  // Add or update the SPAN extension
1613
1242
  let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
@@ -1620,13 +1249,11 @@ let Security2CCMessageEncapsulation = (() => {
1620
1249
  }
1621
1250
  }
1622
1251
  }
1623
- /** @deprecated Use {@link serializeAsync} instead */
1624
- serialize(ctx) {
1252
+ async serialize(ctx) {
1625
1253
  const securityManager = assertSecurityTX(ctx, this.nodeId);
1626
1254
  this.ensureSequenceNumber(securityManager);
1627
1255
  // Include Sender EI in the command if we only have the receiver's EI
1628
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1629
- this.maybeAddSPANExtensionSync(ctx, securityManager);
1256
+ await this.maybeAddSPANExtension(ctx, securityManager);
1630
1257
  const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
1631
1258
  const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
1632
1259
  const unencryptedPayload = Bytes.concat([
@@ -1637,8 +1264,7 @@ let Security2CCMessageEncapsulation = (() => {
1637
1264
  ]),
1638
1265
  ...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
1639
1266
  ]);
1640
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1641
- const serializedCC = this.encapsulated?.serialize(ctx)
1267
+ const serializedCC = (await this.encapsulated?.serialize(ctx))
1642
1268
  ?? new Bytes();
1643
1269
  const plaintextPayload = Bytes.concat([
1644
1270
  ...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
@@ -1655,8 +1281,7 @@ let Security2CCMessageEncapsulation = (() => {
1655
1281
  // Singlecast:
1656
1282
  // Generate a nonce for encryption, and remember it to attempt decryption
1657
1283
  // of potential in-flight messages from the target node.
1658
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1659
- iv = securityManager.nextNonce(this.nodeId, true);
1284
+ iv = await securityManager.nextNonce(this.nodeId, true);
1660
1285
  const { keyCCM } =
1661
1286
  // Prefer the overridden security class if it was given
1662
1287
  this.securityClass != undefined
@@ -1666,13 +1291,11 @@ let Security2CCMessageEncapsulation = (() => {
1666
1291
  }
1667
1292
  else {
1668
1293
  // Multicast:
1669
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1670
- const keyAndIV = securityManager.getMulticastKeyAndIV(destinationTag);
1294
+ const keyAndIV = await securityManager.getMulticastKeyAndIV(destinationTag);
1671
1295
  key = keyAndIV.key;
1672
1296
  iv = keyAndIV.iv;
1673
1297
  }
1674
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1675
- const { ciphertext: ciphertextPayload, authTag } = encryptAES128CCMSync(key, iv, plaintextPayload, authData, SECURITY_S2_AUTH_TAG_LENGTH);
1298
+ const { ciphertext: ciphertextPayload, authTag } = await encryptAES128CCM(plaintextPayload, key, iv, authData, SECURITY_S2_AUTH_TAG_LENGTH);
1676
1299
  // Remember key and IV for debugging purposes
1677
1300
  this.key = key;
1678
1301
  this.iv = iv;
@@ -1684,69 +1307,8 @@ let Security2CCMessageEncapsulation = (() => {
1684
1307
  ciphertextPayload,
1685
1308
  authTag,
1686
1309
  ]);
1687
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1688
1310
  return super.serialize(ctx);
1689
1311
  }
1690
- async serializeAsync(ctx) {
1691
- const securityManager = assertSecurityTX(ctx, this.nodeId);
1692
- this.ensureSequenceNumber(securityManager);
1693
- // Include Sender EI in the command if we only have the receiver's EI
1694
- await this.maybeAddSPANExtensionAsync(ctx, securityManager);
1695
- const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
1696
- const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
1697
- const unencryptedPayload = Bytes.concat([
1698
- Bytes.from([
1699
- this.sequenceNumber,
1700
- (encryptedExtensions.length > 0 ? 0b10 : 0)
1701
- | (unencryptedExtensions.length > 0 ? 1 : 0),
1702
- ]),
1703
- ...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
1704
- ]);
1705
- const serializedCC = (await this.encapsulated?.serializeAsync(ctx))
1706
- ?? new Bytes();
1707
- const plaintextPayload = Bytes.concat([
1708
- ...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
1709
- serializedCC,
1710
- ]);
1711
- // Generate the authentication data for CCM encryption
1712
- const destinationTag = getDestinationIDTX.call(this);
1713
- const messageLength = this.computeEncapsulationOverhead()
1714
- + serializedCC.length;
1715
- const authData = getAuthenticationData(ctx.ownNodeId, destinationTag, ctx.homeId, messageLength, unencryptedPayload);
1716
- let key;
1717
- let iv;
1718
- if (this.isSinglecast()) {
1719
- // Singlecast:
1720
- // Generate a nonce for encryption, and remember it to attempt decryption
1721
- // of potential in-flight messages from the target node.
1722
- iv = await securityManager.nextNonceAsync(this.nodeId, true);
1723
- const { keyCCM } =
1724
- // Prefer the overridden security class if it was given
1725
- this.securityClass != undefined
1726
- ? securityManager.getKeysForSecurityClass(this.securityClass)
1727
- : securityManager.getKeysForNode(this.nodeId);
1728
- key = keyCCM;
1729
- }
1730
- else {
1731
- // Multicast:
1732
- const keyAndIV = await securityManager.getMulticastKeyAndIVAsync(destinationTag);
1733
- key = keyAndIV.key;
1734
- iv = keyAndIV.iv;
1735
- }
1736
- const { ciphertext: ciphertextPayload, authTag } = await encryptAES128CCMAsync(plaintextPayload, key, iv, authData, SECURITY_S2_AUTH_TAG_LENGTH);
1737
- // Remember key and IV for debugging purposes
1738
- this.key = key;
1739
- this.iv = iv;
1740
- this.authData = authData;
1741
- this.authTag = authTag;
1742
- this.ciphertext = ciphertextPayload;
1743
- this.payload = Bytes.concat([
1744
- unencryptedPayload,
1745
- ciphertextPayload,
1746
- authTag,
1747
- ]);
1748
- return super.serializeAsync(ctx);
1749
- }
1750
1312
  computeEncapsulationOverhead() {
1751
1313
  // Security S2 adds:
1752
1314
  // * 1 byte sequence number
@@ -1882,7 +1444,6 @@ let Security2CCNonceReport = (() => {
1882
1444
  if (this.SOS) {
1883
1445
  this.payload = Bytes.concat([this.payload, this.receiverEI]);
1884
1446
  }
1885
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1886
1447
  return super.serialize(ctx);
1887
1448
  }
1888
1449
  toLogEntry(ctx) {
@@ -1945,7 +1506,6 @@ let Security2CCNonceGet = (() => {
1945
1506
  const securityManager = assertSecurityTX(ctx, this.nodeId);
1946
1507
  this.ensureSequenceNumber(securityManager);
1947
1508
  this.payload = Bytes.from([this.sequenceNumber]);
1948
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1949
1509
  return super.serialize(ctx);
1950
1510
  }
1951
1511
  toLogEntry(ctx) {
@@ -2022,7 +1582,6 @@ let Security2CCKEXReport = (() => {
2022
1582
  encodeBitMask(this.supportedECDHProfiles, 7, ECDHProfiles.Curve25519),
2023
1583
  encodeBitMask(this.requestedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
2024
1584
  ]);
2025
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2026
1585
  return super.serialize(ctx);
2027
1586
  }
2028
1587
  toLogEntry(ctx) {
@@ -2150,7 +1709,6 @@ let Security2CCKEXSet = (() => {
2150
1709
  encodeBitMask([this.selectedECDHProfile], 7, ECDHProfiles.Curve25519),
2151
1710
  encodeBitMask(this.grantedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
2152
1711
  ]);
2153
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2154
1712
  return super.serialize(ctx);
2155
1713
  }
2156
1714
  toLogEntry(ctx) {
@@ -2201,7 +1759,6 @@ let Security2CCKEXFail = (() => {
2201
1759
  failType;
2202
1760
  serialize(ctx) {
2203
1761
  this.payload = Bytes.from([this.failType]);
2204
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2205
1762
  return super.serialize(ctx);
2206
1763
  }
2207
1764
  toLogEntry(ctx) {
@@ -2251,7 +1808,6 @@ let Security2CCPublicKeyReport = (() => {
2251
1808
  Bytes.from([this.includingNode ? 1 : 0]),
2252
1809
  this.publicKey,
2253
1810
  ]);
2254
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2255
1811
  return super.serialize(ctx);
2256
1812
  }
2257
1813
  toLogEntry(ctx) {
@@ -2304,7 +1860,6 @@ let Security2CCNetworkKeyReport = (() => {
2304
1860
  securityClassToBitMask(this.grantedKey),
2305
1861
  this.networkKey,
2306
1862
  ]);
2307
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2308
1863
  return super.serialize(ctx);
2309
1864
  }
2310
1865
  toLogEntry(ctx) {
@@ -2351,7 +1906,6 @@ let Security2CCNetworkKeyGet = (() => {
2351
1906
  requestedKey;
2352
1907
  serialize(ctx) {
2353
1908
  this.payload = securityClassToBitMask(this.requestedKey);
2354
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2355
1909
  return super.serialize(ctx);
2356
1910
  }
2357
1911
  toLogEntry(ctx) {
@@ -2421,7 +1975,6 @@ let Security2CCTransferEnd = (() => {
2421
1975
  this.payload = Bytes.from([
2422
1976
  (this.keyVerified ? 0b10 : 0) + (this.keyRequestComplete ? 0b1 : 0),
2423
1977
  ]);
2424
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2425
1978
  return super.serialize(ctx);
2426
1979
  }
2427
1980
  toLogEntry(ctx) {
@@ -2471,7 +2024,6 @@ let Security2CCCommandsSupportedReport = (() => {
2471
2024
  supportedCCs;
2472
2025
  serialize(ctx) {
2473
2026
  this.payload = encodeCCList(this.supportedCCs, []);
2474
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2475
2027
  return super.serialize(ctx);
2476
2028
  }
2477
2029
  toLogEntry(ctx) {