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