@zwave-js/cc 14.0.0-beta.4 → 14.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -52,13 +52,45 @@ var import_CRC16CC = require("./CRC16CC.js");
|
|
|
52
52
|
var import_MultiChannelCC = require("./MultiChannelCC.js");
|
|
53
53
|
var import_SecurityCC = require("./SecurityCC.js");
|
|
54
54
|
var import_TransportServiceCC = require("./TransportServiceCC.js");
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
56
|
+
function accept(f) {
|
|
57
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
58
|
+
return f;
|
|
59
|
+
}
|
|
60
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
61
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
62
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
63
|
+
var _, done = false;
|
|
64
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
65
|
+
var context = {};
|
|
66
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
67
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
68
|
+
context.addInitializer = function(f) {
|
|
69
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
70
|
+
extraInitializers.push(accept(f || null));
|
|
71
|
+
};
|
|
72
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
73
|
+
if (kind === "accessor") {
|
|
74
|
+
if (result === void 0) continue;
|
|
75
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
76
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
77
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
78
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
79
|
+
} else if (_ = accept(result)) {
|
|
80
|
+
if (kind === "field") initializers.unshift(_);
|
|
81
|
+
else descriptor[key] = _;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
85
|
+
done = true;
|
|
86
|
+
};
|
|
87
|
+
var __runInitializers = function(thisArg, initializers, value) {
|
|
88
|
+
var useValue = arguments.length > 2;
|
|
89
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
90
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
91
|
+
}
|
|
92
|
+
return useValue ? value : void 0;
|
|
60
93
|
};
|
|
61
|
-
var Security2CC_1, Security2CCMessageEncapsulation_1, Security2CCNonceReport_1, Security2CCNonceGet_1, Security2CCKEXReport_1, Security2CCKEXSet_1, Security2CCKEXFail_1, Security2CCPublicKeyReport_1, Security2CCNetworkKeyReport_1, Security2CCNetworkKeyGet_1, Security2CCTransferEnd_1, Security2CCCommandsSupportedReport_1;
|
|
62
94
|
function securityClassToBitMask(key) {
|
|
63
95
|
return (0, import_core.encodeBitMask)([key], import_core.SecurityClass.S0_Legacy, import_core.SecurityClass.S2_Unauthenticated);
|
|
64
96
|
}
|
|
@@ -229,487 +261,516 @@ function getSenderEI(extensions) {
|
|
|
229
261
|
const spanExtension = extensions.find((e) => e instanceof import_Extension.SPANExtension);
|
|
230
262
|
return spanExtension?.senderEI;
|
|
231
263
|
}
|
|
232
|
-
let Security2CCAPI =
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
let Security2CCAPI = (() => {
|
|
265
|
+
let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["Security 2"])];
|
|
266
|
+
let _classDescriptor;
|
|
267
|
+
let _classExtraInitializers = [];
|
|
268
|
+
let _classThis;
|
|
269
|
+
let _classSuper = import_API.CCAPI;
|
|
270
|
+
var Security2CCAPI2 = class extends _classSuper {
|
|
271
|
+
static {
|
|
272
|
+
_classThis = this;
|
|
273
|
+
}
|
|
274
|
+
static {
|
|
275
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
276
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
277
|
+
Security2CCAPI2 = _classThis = _classDescriptor.value;
|
|
278
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
279
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
280
|
+
}
|
|
281
|
+
supportsCommand(_cmd) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Sends a nonce to the node, either in response to a NonceGet request or a message that failed to decrypt. The message is sent without any retransmission etc.
|
|
286
|
+
* The return value indicates whether a nonce was successfully sent
|
|
287
|
+
*/
|
|
288
|
+
async sendNonce() {
|
|
289
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NonceReport);
|
|
290
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
291
|
+
const securityManager = getSecurityManager(this.host.ownNodeId, this.host, this.endpoint.nodeId);
|
|
292
|
+
if (!securityManager) {
|
|
293
|
+
throw new import_core.ZWaveError(`Nonces can only be sent if secure communication is set up!`, import_core.ZWaveErrorCodes.Driver_NoSecurity);
|
|
294
|
+
}
|
|
295
|
+
const receiverEI = securityManager.generateNonce(this.endpoint.nodeId);
|
|
296
|
+
const cc = new Security2CCNonceReport({
|
|
297
|
+
nodeId: this.endpoint.nodeId,
|
|
298
|
+
endpointIndex: this.endpoint.index,
|
|
299
|
+
SOS: true,
|
|
300
|
+
MOS: false,
|
|
301
|
+
receiverEI
|
|
267
302
|
});
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
303
|
+
try {
|
|
304
|
+
await this.host.sendCommand(cc, {
|
|
305
|
+
...this.commandOptions,
|
|
306
|
+
// Seems we need these options or some nodes won't accept the nonce
|
|
307
|
+
transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
|
|
308
|
+
// Only try sending a nonce once
|
|
309
|
+
maxSendAttempts: 1,
|
|
310
|
+
// Nonce requests must be handled immediately
|
|
311
|
+
priority: import_core.MessagePriority.Immediate,
|
|
312
|
+
// We don't want failures causing us to treat the node as asleep or dead
|
|
313
|
+
changeNodeStatusOnMissingACK: false
|
|
314
|
+
// And we need to react to
|
|
315
|
+
});
|
|
316
|
+
} catch (e) {
|
|
317
|
+
if ((0, import_core.isTransmissionError)(e)) {
|
|
318
|
+
securityManager.deleteNonce(this.endpoint.nodeId);
|
|
319
|
+
return false;
|
|
320
|
+
} else {
|
|
321
|
+
throw e;
|
|
322
|
+
}
|
|
274
323
|
}
|
|
324
|
+
return true;
|
|
275
325
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
SOS: false,
|
|
286
|
-
MOS: true
|
|
287
|
-
});
|
|
288
|
-
try {
|
|
289
|
-
await this.host.sendCommand(cc, {
|
|
290
|
-
...this.commandOptions,
|
|
291
|
-
// Seems we need these options or some nodes won't accept the nonce
|
|
292
|
-
transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
|
|
293
|
-
// Only try sending a nonce once
|
|
294
|
-
maxSendAttempts: 1,
|
|
295
|
-
// Nonce requests must be handled immediately
|
|
296
|
-
priority: import_core.MessagePriority.Immediate,
|
|
297
|
-
// We don't want failures causing us to treat the node as asleep or dead
|
|
298
|
-
changeNodeStatusOnMissingACK: false
|
|
326
|
+
/** Notifies the target node that the MPAN state is out of sync */
|
|
327
|
+
async sendMOS() {
|
|
328
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NonceReport);
|
|
329
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
330
|
+
const cc = new Security2CCNonceReport({
|
|
331
|
+
nodeId: this.endpoint.nodeId,
|
|
332
|
+
endpointIndex: this.endpoint.index,
|
|
333
|
+
SOS: false,
|
|
334
|
+
MOS: true
|
|
299
335
|
});
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
336
|
+
try {
|
|
337
|
+
await this.host.sendCommand(cc, {
|
|
338
|
+
...this.commandOptions,
|
|
339
|
+
// Seems we need these options or some nodes won't accept the nonce
|
|
340
|
+
transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
|
|
341
|
+
// Only try sending a nonce once
|
|
342
|
+
maxSendAttempts: 1,
|
|
343
|
+
// Nonce requests must be handled immediately
|
|
344
|
+
priority: import_core.MessagePriority.Immediate,
|
|
345
|
+
// We don't want failures causing us to treat the node as asleep or dead
|
|
346
|
+
changeNodeStatusOnMissingACK: false
|
|
347
|
+
});
|
|
348
|
+
} catch (e) {
|
|
349
|
+
if ((0, import_core.isTransmissionError)(e)) {
|
|
350
|
+
return false;
|
|
351
|
+
} else {
|
|
352
|
+
throw e;
|
|
353
|
+
}
|
|
305
354
|
}
|
|
355
|
+
return true;
|
|
306
356
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
357
|
+
/** Sends the given MPAN to the node */
|
|
358
|
+
async sendMPAN(groupId, innerMPANState) {
|
|
359
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.MessageEncapsulation);
|
|
360
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
361
|
+
const cc = new Security2CCMessageEncapsulation({
|
|
362
|
+
nodeId: this.endpoint.nodeId,
|
|
363
|
+
endpointIndex: this.endpoint.index,
|
|
364
|
+
extensions: [
|
|
365
|
+
new import_Extension.MPANExtension({
|
|
366
|
+
groupId,
|
|
367
|
+
innerMPANState
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
});
|
|
371
|
+
try {
|
|
372
|
+
await this.host.sendCommand(cc, {
|
|
373
|
+
...this.commandOptions,
|
|
374
|
+
// Seems we need these options or some nodes won't accept the nonce
|
|
375
|
+
transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
|
|
376
|
+
// Only try sending a nonce once
|
|
377
|
+
maxSendAttempts: 1,
|
|
378
|
+
// Nonce requests must be handled immediately
|
|
379
|
+
priority: import_core.MessagePriority.Immediate,
|
|
380
|
+
// We don't want failures causing us to treat the node as asleep or dead
|
|
381
|
+
changeNodeStatusOnMissingACK: false
|
|
382
|
+
});
|
|
383
|
+
} catch (e) {
|
|
384
|
+
if ((0, import_core.isTransmissionError)(e)) {
|
|
385
|
+
return false;
|
|
386
|
+
} else {
|
|
387
|
+
throw e;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Queries the securely supported commands for the current security class
|
|
394
|
+
* @param securityClass Can be used to overwrite the security class to use. If this doesn't match the current one, new nonces will need to be exchanged.
|
|
395
|
+
*/
|
|
396
|
+
async getSupportedCommands(securityClass) {
|
|
397
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.CommandsSupportedGet);
|
|
398
|
+
let cc = new Security2CCCommandsSupportedGet({
|
|
399
|
+
nodeId: this.endpoint.nodeId,
|
|
400
|
+
endpointIndex: this.endpoint.index
|
|
401
|
+
});
|
|
402
|
+
if (import_MultiChannelCC.MultiChannelCC.requiresEncapsulation(cc)) {
|
|
403
|
+
const multiChannelCCVersion = this.host.getSupportedCCVersion(import_core.CommandClasses["Multi Channel"], this.endpoint.nodeId);
|
|
404
|
+
cc = multiChannelCCVersion === 1 ? import_MultiChannelCC.MultiChannelCC.encapsulateV1(cc) : import_MultiChannelCC.MultiChannelCC.encapsulate(cc);
|
|
405
|
+
}
|
|
406
|
+
cc = Security2CC.encapsulate(cc, this.host.ownNodeId, this.host, { securityClass });
|
|
407
|
+
const response = await this.host.sendCommand(cc, {
|
|
325
408
|
...this.commandOptions,
|
|
326
|
-
|
|
327
|
-
transmitOptions: import_core.TransmitOptions.ACK | import_core.TransmitOptions.AutoRoute,
|
|
328
|
-
// Only try sending a nonce once
|
|
329
|
-
maxSendAttempts: 1,
|
|
330
|
-
// Nonce requests must be handled immediately
|
|
331
|
-
priority: import_core.MessagePriority.Immediate,
|
|
332
|
-
// We don't want failures causing us to treat the node as asleep or dead
|
|
333
|
-
changeNodeStatusOnMissingACK: false
|
|
409
|
+
autoEncapsulate: false
|
|
334
410
|
});
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
411
|
+
return response?.supportedCCs;
|
|
412
|
+
}
|
|
413
|
+
async reportSupportedCommands(supportedCCs) {
|
|
414
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.CommandsSupportedReport);
|
|
415
|
+
const cc = new Security2CCCommandsSupportedReport({
|
|
416
|
+
nodeId: this.endpoint.nodeId,
|
|
417
|
+
endpointIndex: this.endpoint.index,
|
|
418
|
+
supportedCCs
|
|
419
|
+
});
|
|
420
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
421
|
+
}
|
|
422
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
423
|
+
async getKeyExchangeParameters() {
|
|
424
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXGet);
|
|
425
|
+
const cc = new Security2CCKEXGet({
|
|
426
|
+
nodeId: this.endpoint.nodeId,
|
|
427
|
+
endpointIndex: this.endpoint.index
|
|
428
|
+
});
|
|
429
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
430
|
+
if (response) {
|
|
431
|
+
return (0, import_safe3.pick)(response, [
|
|
432
|
+
"requestCSA",
|
|
433
|
+
"echo",
|
|
434
|
+
"supportedKEXSchemes",
|
|
435
|
+
"supportedECDHProfiles",
|
|
436
|
+
"requestedKeys",
|
|
437
|
+
"_reserved"
|
|
438
|
+
]);
|
|
340
439
|
}
|
|
341
440
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
endpointIndex: this.endpoint.index
|
|
353
|
-
});
|
|
354
|
-
if (import_MultiChannelCC.MultiChannelCC.requiresEncapsulation(cc)) {
|
|
355
|
-
const multiChannelCCVersion = this.host.getSupportedCCVersion(import_core.CommandClasses["Multi Channel"], this.endpoint.nodeId);
|
|
356
|
-
cc = multiChannelCCVersion === 1 ? import_MultiChannelCC.MultiChannelCC.encapsulateV1(cc) : import_MultiChannelCC.MultiChannelCC.encapsulate(cc);
|
|
357
|
-
}
|
|
358
|
-
cc = Security2CC.encapsulate(cc, this.host.ownNodeId, this.host, { securityClass });
|
|
359
|
-
const response = await this.host.sendCommand(cc, {
|
|
360
|
-
...this.commandOptions,
|
|
361
|
-
autoEncapsulate: false
|
|
362
|
-
});
|
|
363
|
-
return response?.supportedCCs;
|
|
364
|
-
}
|
|
365
|
-
async reportSupportedCommands(supportedCCs) {
|
|
366
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.CommandsSupportedReport);
|
|
367
|
-
const cc = new Security2CCCommandsSupportedReport({
|
|
368
|
-
nodeId: this.endpoint.nodeId,
|
|
369
|
-
endpointIndex: this.endpoint.index,
|
|
370
|
-
supportedCCs
|
|
371
|
-
});
|
|
372
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
373
|
-
}
|
|
374
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
375
|
-
async getKeyExchangeParameters() {
|
|
376
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXGet);
|
|
377
|
-
const cc = new Security2CCKEXGet({
|
|
378
|
-
nodeId: this.endpoint.nodeId,
|
|
379
|
-
endpointIndex: this.endpoint.index
|
|
380
|
-
});
|
|
381
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
382
|
-
if (response) {
|
|
383
|
-
return (0, import_safe3.pick)(response, [
|
|
384
|
-
"requestCSA",
|
|
385
|
-
"echo",
|
|
386
|
-
"supportedKEXSchemes",
|
|
387
|
-
"supportedECDHProfiles",
|
|
388
|
-
"requestedKeys",
|
|
389
|
-
"_reserved"
|
|
390
|
-
]);
|
|
441
|
+
/** Requests the given keys from an including node */
|
|
442
|
+
async requestKeys(params) {
|
|
443
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXReport);
|
|
444
|
+
const cc = new Security2CCKEXReport({
|
|
445
|
+
nodeId: this.endpoint.nodeId,
|
|
446
|
+
endpointIndex: this.endpoint.index,
|
|
447
|
+
...params,
|
|
448
|
+
echo: false
|
|
449
|
+
});
|
|
450
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
391
451
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
echo: false
|
|
401
|
-
});
|
|
402
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
403
|
-
}
|
|
404
|
-
/** Grants the joining node the given keys */
|
|
405
|
-
async grantKeys(params) {
|
|
406
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXSet);
|
|
407
|
-
const cc = new Security2CCKEXSet({
|
|
408
|
-
nodeId: this.endpoint.nodeId,
|
|
409
|
-
endpointIndex: this.endpoint.index,
|
|
410
|
-
...params,
|
|
411
|
-
echo: false
|
|
412
|
-
});
|
|
413
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
414
|
-
}
|
|
415
|
-
/** Confirms the keys that were requested by a node */
|
|
416
|
-
async confirmRequestedKeys(params) {
|
|
417
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXReport);
|
|
418
|
-
const cc = new Security2CCKEXReport({
|
|
419
|
-
nodeId: this.endpoint.nodeId,
|
|
420
|
-
endpointIndex: this.endpoint.index,
|
|
421
|
-
...params,
|
|
422
|
-
echo: true
|
|
423
|
-
});
|
|
424
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
425
|
-
}
|
|
426
|
-
/** Confirms the keys that were granted by the including node */
|
|
427
|
-
async confirmGrantedKeys(params) {
|
|
428
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXSet);
|
|
429
|
-
const cc = new Security2CCKEXSet({
|
|
430
|
-
nodeId: this.endpoint.nodeId,
|
|
431
|
-
endpointIndex: this.endpoint.index,
|
|
432
|
-
...params,
|
|
433
|
-
echo: true
|
|
434
|
-
});
|
|
435
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
436
|
-
}
|
|
437
|
-
/** Notifies the other node that the ongoing key exchange was aborted */
|
|
438
|
-
async abortKeyExchange(failType) {
|
|
439
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXFail);
|
|
440
|
-
const cc = new Security2CCKEXFail({
|
|
441
|
-
nodeId: this.endpoint.nodeId,
|
|
442
|
-
endpointIndex: this.endpoint.index,
|
|
443
|
-
failType
|
|
444
|
-
});
|
|
445
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
446
|
-
}
|
|
447
|
-
async sendPublicKey(publicKey, includingNode = true) {
|
|
448
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.PublicKeyReport);
|
|
449
|
-
const cc = new Security2CCPublicKeyReport({
|
|
450
|
-
nodeId: this.endpoint.nodeId,
|
|
451
|
-
endpointIndex: this.endpoint.index,
|
|
452
|
-
includingNode,
|
|
453
|
-
publicKey
|
|
454
|
-
});
|
|
455
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
456
|
-
}
|
|
457
|
-
async requestNetworkKey(securityClass) {
|
|
458
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NetworkKeyGet);
|
|
459
|
-
const cc = new Security2CCNetworkKeyGet({
|
|
460
|
-
nodeId: this.endpoint.nodeId,
|
|
461
|
-
endpointIndex: this.endpoint.index,
|
|
462
|
-
requestedKey: securityClass
|
|
463
|
-
});
|
|
464
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
465
|
-
}
|
|
466
|
-
async sendNetworkKey(securityClass, networkKey) {
|
|
467
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NetworkKeyReport);
|
|
468
|
-
const cc = new Security2CCNetworkKeyReport({
|
|
469
|
-
nodeId: this.endpoint.nodeId,
|
|
470
|
-
endpointIndex: this.endpoint.index,
|
|
471
|
-
grantedKey: securityClass,
|
|
472
|
-
networkKey
|
|
473
|
-
});
|
|
474
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
475
|
-
}
|
|
476
|
-
async verifyNetworkKey() {
|
|
477
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NetworkKeyVerify);
|
|
478
|
-
const cc = new Security2CCNetworkKeyVerify({
|
|
479
|
-
nodeId: this.endpoint.nodeId,
|
|
480
|
-
endpointIndex: this.endpoint.index
|
|
481
|
-
});
|
|
482
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
483
|
-
}
|
|
484
|
-
async confirmKeyVerification() {
|
|
485
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.TransferEnd);
|
|
486
|
-
const cc = new Security2CCTransferEnd({
|
|
487
|
-
nodeId: this.endpoint.nodeId,
|
|
488
|
-
endpointIndex: this.endpoint.index,
|
|
489
|
-
keyVerified: true,
|
|
490
|
-
keyRequestComplete: false
|
|
491
|
-
});
|
|
492
|
-
await this.host.sendCommand(cc, {
|
|
493
|
-
...this.commandOptions,
|
|
494
|
-
// Don't wait for an ACK from the node
|
|
495
|
-
transmitOptions: import_core.TransmitOptions.DEFAULT & ~import_core.TransmitOptions.ACK
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
async endKeyExchange() {
|
|
499
|
-
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.TransferEnd);
|
|
500
|
-
const cc = new Security2CCTransferEnd({
|
|
501
|
-
nodeId: this.endpoint.nodeId,
|
|
502
|
-
endpointIndex: this.endpoint.index,
|
|
503
|
-
keyVerified: false,
|
|
504
|
-
keyRequestComplete: true
|
|
505
|
-
});
|
|
506
|
-
await this.host.sendCommand(cc, this.commandOptions);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
Security2CCAPI = __decorate([
|
|
510
|
-
(0, import_CommandClassDecorators.API)(import_core.CommandClasses["Security 2"])
|
|
511
|
-
], Security2CCAPI);
|
|
512
|
-
let Security2CC = Security2CC_1 = class Security2CC2 extends import_CommandClass.CommandClass {
|
|
513
|
-
async interview(ctx) {
|
|
514
|
-
const securityManager = getSecurityManager(ctx.ownNodeId, ctx, this.nodeId);
|
|
515
|
-
const node = this.getNode(ctx);
|
|
516
|
-
const endpoint = this.getEndpoint(ctx);
|
|
517
|
-
const api = import_API.CCAPI.create(import_core.CommandClasses["Security 2"], ctx, endpoint).withOptions({
|
|
518
|
-
priority: import_core.MessagePriority.NodeQuery
|
|
519
|
-
});
|
|
520
|
-
const secClass = node.getHighestSecurityClass();
|
|
521
|
-
let hasReceivedSecureCommands = false;
|
|
522
|
-
let possibleSecurityClasses;
|
|
523
|
-
if ((0, import_core.securityClassIsS2)(secClass)) {
|
|
524
|
-
possibleSecurityClasses = [secClass];
|
|
525
|
-
} else if (endpoint.index === 0) {
|
|
526
|
-
possibleSecurityClasses = [
|
|
527
|
-
import_core.SecurityClass.S2_Unauthenticated,
|
|
528
|
-
import_core.SecurityClass.S2_Authenticated,
|
|
529
|
-
import_core.SecurityClass.S2_AccessControl
|
|
530
|
-
];
|
|
531
|
-
} else {
|
|
532
|
-
ctx.logNode(node.id, {
|
|
533
|
-
endpoint: endpoint.index,
|
|
534
|
-
message: `Cannot query securely supported commands for endpoint because the node's security class isn't known...`,
|
|
535
|
-
level: "error"
|
|
452
|
+
/** Grants the joining node the given keys */
|
|
453
|
+
async grantKeys(params) {
|
|
454
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXSet);
|
|
455
|
+
const cc = new Security2CCKEXSet({
|
|
456
|
+
nodeId: this.endpoint.nodeId,
|
|
457
|
+
endpointIndex: this.endpoint.index,
|
|
458
|
+
...params,
|
|
459
|
+
echo: false
|
|
536
460
|
});
|
|
537
|
-
|
|
461
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
538
462
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
463
|
+
/** Confirms the keys that were requested by a node */
|
|
464
|
+
async confirmRequestedKeys(params) {
|
|
465
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXReport);
|
|
466
|
+
const cc = new Security2CCKEXReport({
|
|
467
|
+
nodeId: this.endpoint.nodeId,
|
|
468
|
+
endpointIndex: this.endpoint.index,
|
|
469
|
+
...params,
|
|
470
|
+
echo: true
|
|
471
|
+
});
|
|
472
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
473
|
+
}
|
|
474
|
+
/** Confirms the keys that were granted by the including node */
|
|
475
|
+
async confirmGrantedKeys(params) {
|
|
476
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXSet);
|
|
477
|
+
const cc = new Security2CCKEXSet({
|
|
478
|
+
nodeId: this.endpoint.nodeId,
|
|
479
|
+
endpointIndex: this.endpoint.index,
|
|
480
|
+
...params,
|
|
481
|
+
echo: true
|
|
482
|
+
});
|
|
483
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
484
|
+
}
|
|
485
|
+
/** Notifies the other node that the ongoing key exchange was aborted */
|
|
486
|
+
async abortKeyExchange(failType) {
|
|
487
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.KEXFail);
|
|
488
|
+
const cc = new Security2CCKEXFail({
|
|
489
|
+
nodeId: this.endpoint.nodeId,
|
|
490
|
+
endpointIndex: this.endpoint.index,
|
|
491
|
+
failType
|
|
492
|
+
});
|
|
493
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
494
|
+
}
|
|
495
|
+
async sendPublicKey(publicKey, includingNode = true) {
|
|
496
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.PublicKeyReport);
|
|
497
|
+
const cc = new Security2CCPublicKeyReport({
|
|
498
|
+
nodeId: this.endpoint.nodeId,
|
|
499
|
+
endpointIndex: this.endpoint.index,
|
|
500
|
+
includingNode,
|
|
501
|
+
publicKey
|
|
502
|
+
});
|
|
503
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
504
|
+
}
|
|
505
|
+
async requestNetworkKey(securityClass) {
|
|
506
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NetworkKeyGet);
|
|
507
|
+
const cc = new Security2CCNetworkKeyGet({
|
|
508
|
+
nodeId: this.endpoint.nodeId,
|
|
509
|
+
endpointIndex: this.endpoint.index,
|
|
510
|
+
requestedKey: securityClass
|
|
511
|
+
});
|
|
512
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
513
|
+
}
|
|
514
|
+
async sendNetworkKey(securityClass, networkKey) {
|
|
515
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NetworkKeyReport);
|
|
516
|
+
const cc = new Security2CCNetworkKeyReport({
|
|
517
|
+
nodeId: this.endpoint.nodeId,
|
|
518
|
+
endpointIndex: this.endpoint.index,
|
|
519
|
+
grantedKey: securityClass,
|
|
520
|
+
networkKey
|
|
521
|
+
});
|
|
522
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
523
|
+
}
|
|
524
|
+
async verifyNetworkKey() {
|
|
525
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.NetworkKeyVerify);
|
|
526
|
+
const cc = new Security2CCNetworkKeyVerify({
|
|
527
|
+
nodeId: this.endpoint.nodeId,
|
|
528
|
+
endpointIndex: this.endpoint.index
|
|
529
|
+
});
|
|
530
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
531
|
+
}
|
|
532
|
+
async confirmKeyVerification() {
|
|
533
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.TransferEnd);
|
|
534
|
+
const cc = new Security2CCTransferEnd({
|
|
535
|
+
nodeId: this.endpoint.nodeId,
|
|
536
|
+
endpointIndex: this.endpoint.index,
|
|
537
|
+
keyVerified: true,
|
|
538
|
+
keyRequestComplete: false
|
|
539
|
+
});
|
|
540
|
+
await this.host.sendCommand(cc, {
|
|
541
|
+
...this.commandOptions,
|
|
542
|
+
// Don't wait for an ACK from the node
|
|
543
|
+
transmitOptions: import_core.TransmitOptions.DEFAULT & ~import_core.TransmitOptions.ACK
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
async endKeyExchange() {
|
|
547
|
+
this.assertSupportsCommand(import_Types.Security2Command, import_Types.Security2Command.TransferEnd);
|
|
548
|
+
const cc = new Security2CCTransferEnd({
|
|
549
|
+
nodeId: this.endpoint.nodeId,
|
|
550
|
+
endpointIndex: this.endpoint.index,
|
|
551
|
+
keyVerified: false,
|
|
552
|
+
keyRequestComplete: true
|
|
553
|
+
});
|
|
554
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
return Security2CCAPI2 = _classThis;
|
|
558
|
+
})();
|
|
559
|
+
let Security2CC = (() => {
|
|
560
|
+
let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["Security 2"]), (0, import_CommandClassDecorators.implementedVersion)(1)];
|
|
561
|
+
let _classDescriptor;
|
|
562
|
+
let _classExtraInitializers = [];
|
|
563
|
+
let _classThis;
|
|
564
|
+
let _classSuper = import_CommandClass.CommandClass;
|
|
565
|
+
var Security2CC2 = class extends _classSuper {
|
|
566
|
+
static {
|
|
567
|
+
_classThis = this;
|
|
568
|
+
}
|
|
569
|
+
static {
|
|
570
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
571
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
572
|
+
Security2CC2 = _classThis = _classDescriptor.value;
|
|
573
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
574
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
575
|
+
}
|
|
576
|
+
async interview(ctx) {
|
|
577
|
+
const securityManager = getSecurityManager(ctx.ownNodeId, ctx, this.nodeId);
|
|
578
|
+
const node = this.getNode(ctx);
|
|
579
|
+
const endpoint = this.getEndpoint(ctx);
|
|
580
|
+
const api = import_API.CCAPI.create(import_core.CommandClasses["Security 2"], ctx, endpoint).withOptions({
|
|
581
|
+
priority: import_core.MessagePriority.NodeQuery
|
|
582
|
+
});
|
|
583
|
+
const secClass = node.getHighestSecurityClass();
|
|
584
|
+
let hasReceivedSecureCommands = false;
|
|
585
|
+
let possibleSecurityClasses;
|
|
586
|
+
if ((0, import_core.securityClassIsS2)(secClass)) {
|
|
587
|
+
possibleSecurityClasses = [secClass];
|
|
588
|
+
} else if (endpoint.index === 0) {
|
|
589
|
+
possibleSecurityClasses = [
|
|
590
|
+
import_core.SecurityClass.S2_Unauthenticated,
|
|
591
|
+
import_core.SecurityClass.S2_Authenticated,
|
|
592
|
+
import_core.SecurityClass.S2_AccessControl
|
|
593
|
+
];
|
|
594
|
+
} else {
|
|
543
595
|
ctx.logNode(node.id, {
|
|
544
596
|
endpoint: endpoint.index,
|
|
545
|
-
message: `Cannot query securely supported commands
|
|
546
|
-
level: "
|
|
597
|
+
message: `Cannot query securely supported commands for endpoint because the node's security class isn't known...`,
|
|
598
|
+
level: "error"
|
|
547
599
|
});
|
|
548
|
-
|
|
600
|
+
return;
|
|
549
601
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
} catch (e) {
|
|
561
|
-
if ((0, import_core.isZWaveError)(e) && e.code === import_core.ZWaveErrorCodes.Security2CC_CannotDecode) {
|
|
562
|
-
supportedCCs = void 0;
|
|
563
|
-
} else {
|
|
564
|
-
throw e;
|
|
565
|
-
}
|
|
602
|
+
for (const secClass2 of possibleSecurityClasses) {
|
|
603
|
+
if (node.hasSecurityClass(secClass2) === false)
|
|
604
|
+
continue;
|
|
605
|
+
if (!securityManager?.hasKeysForSecurityClass(secClass2)) {
|
|
606
|
+
ctx.logNode(node.id, {
|
|
607
|
+
endpoint: endpoint.index,
|
|
608
|
+
message: `Cannot query securely supported commands (${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)}) - network key is not configured...`,
|
|
609
|
+
level: "warn"
|
|
610
|
+
});
|
|
611
|
+
continue;
|
|
566
612
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
613
|
+
ctx.logNode(node.id, {
|
|
614
|
+
endpoint: endpoint.index,
|
|
615
|
+
message: `Querying securely supported commands (${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)})...`,
|
|
616
|
+
direction: "outbound"
|
|
617
|
+
});
|
|
618
|
+
let supportedCCs;
|
|
619
|
+
const MAX_ATTEMPTS = this.endpointIndex === 0 ? 3 : 1;
|
|
620
|
+
for (let attempts = 1; attempts <= MAX_ATTEMPTS; attempts++) {
|
|
621
|
+
try {
|
|
622
|
+
supportedCCs = await api.getSupportedCommands(secClass2);
|
|
623
|
+
} catch (e) {
|
|
624
|
+
if ((0, import_core.isZWaveError)(e) && e.code === import_core.ZWaveErrorCodes.Security2CC_CannotDecode) {
|
|
625
|
+
supportedCCs = void 0;
|
|
626
|
+
} else {
|
|
627
|
+
throw e;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (supportedCCs == void 0 && possibleSecurityClasses.length === 1) {
|
|
631
|
+
if (attempts < MAX_ATTEMPTS) {
|
|
632
|
+
ctx.logNode(node.id, {
|
|
633
|
+
endpoint: endpoint.index,
|
|
634
|
+
message: `Querying securely supported commands (${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)}), attempt ${attempts}/${MAX_ATTEMPTS} failed. Retrying in 500ms...`,
|
|
635
|
+
level: "warn"
|
|
636
|
+
});
|
|
637
|
+
await (0, import_async.wait)(500);
|
|
638
|
+
continue;
|
|
639
|
+
} else if (endpoint.index > 0) {
|
|
640
|
+
ctx.logNode(node.id, {
|
|
641
|
+
endpoint: endpoint.index,
|
|
642
|
+
message: `Querying securely supported commands (${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)}) failed. Assuming the endpoint supports all its mandatory CCs securely...`,
|
|
643
|
+
level: "warn"
|
|
644
|
+
});
|
|
645
|
+
for (const [ccId] of endpoint.getCCs()) {
|
|
646
|
+
endpoint.addCC(ccId, { secure: true });
|
|
647
|
+
}
|
|
648
|
+
break;
|
|
649
|
+
} else {
|
|
650
|
+
ctx.logNode(node.id, {
|
|
651
|
+
endpoint: endpoint.index,
|
|
652
|
+
message: `Querying securely supported commands (${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)}) failed. Let's hope for the best...`,
|
|
653
|
+
level: "warn"
|
|
654
|
+
});
|
|
655
|
+
break;
|
|
584
656
|
}
|
|
585
|
-
break;
|
|
586
657
|
} else {
|
|
658
|
+
break;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (supportedCCs == void 0) {
|
|
662
|
+
if (endpoint.index === 0 && possibleSecurityClasses.length > 1) {
|
|
663
|
+
node.setSecurityClass(secClass2, false);
|
|
587
664
|
ctx.logNode(node.id, {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
level: "warn"
|
|
665
|
+
message: `The node was NOT granted the security class ${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)}`,
|
|
666
|
+
direction: "inbound"
|
|
591
667
|
});
|
|
592
|
-
break;
|
|
593
668
|
}
|
|
594
|
-
|
|
595
|
-
break;
|
|
669
|
+
continue;
|
|
596
670
|
}
|
|
597
|
-
}
|
|
598
|
-
if (supportedCCs == void 0) {
|
|
599
671
|
if (endpoint.index === 0 && possibleSecurityClasses.length > 1) {
|
|
600
|
-
node.setSecurityClass(secClass2,
|
|
672
|
+
node.setSecurityClass(secClass2, true);
|
|
601
673
|
ctx.logNode(node.id, {
|
|
602
|
-
message: `The node was
|
|
674
|
+
message: `The node was granted the security class ${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)}`,
|
|
603
675
|
direction: "inbound"
|
|
604
676
|
});
|
|
605
677
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
for (const cc of supportedCCs) {
|
|
630
|
-
if (cc === import_core.CommandClasses.Basic) {
|
|
631
|
-
endpoint.addCC(cc, { secure: true });
|
|
632
|
-
} else {
|
|
633
|
-
endpoint.addCC(cc, {
|
|
634
|
-
isSupported: true,
|
|
635
|
-
secure: true
|
|
636
|
-
});
|
|
678
|
+
if (!hasReceivedSecureCommands && supportedCCs.length > 0) {
|
|
679
|
+
hasReceivedSecureCommands = true;
|
|
680
|
+
const logLines = [
|
|
681
|
+
`received secure commands (${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, secClass2)})`,
|
|
682
|
+
"supported CCs:"
|
|
683
|
+
];
|
|
684
|
+
for (const cc of supportedCCs) {
|
|
685
|
+
logLines.push(`\xB7 ${(0, import_core.getCCName)(cc)}`);
|
|
686
|
+
}
|
|
687
|
+
ctx.logNode(node.id, {
|
|
688
|
+
endpoint: endpoint.index,
|
|
689
|
+
message: logLines.join("\n"),
|
|
690
|
+
direction: "inbound"
|
|
691
|
+
});
|
|
692
|
+
for (const cc of supportedCCs) {
|
|
693
|
+
if (cc === import_core.CommandClasses.Basic) {
|
|
694
|
+
endpoint.addCC(cc, { secure: true });
|
|
695
|
+
} else {
|
|
696
|
+
endpoint.addCC(cc, {
|
|
697
|
+
isSupported: true,
|
|
698
|
+
secure: true
|
|
699
|
+
});
|
|
700
|
+
}
|
|
637
701
|
}
|
|
638
702
|
}
|
|
639
703
|
}
|
|
704
|
+
this.setInterviewComplete(ctx, true);
|
|
640
705
|
}
|
|
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
|
-
return false;
|
|
706
|
+
/** Tests if a command should be sent secure and thus requires encapsulation */
|
|
707
|
+
static requiresEncapsulation(cc) {
|
|
708
|
+
if (!(cc.encapsulationFlags & import_safe.EncapsulationFlags.Security)) {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
if (cc instanceof import_SecurityCC.SecurityCC || cc instanceof import_CRC16CC.CRC16CC || cc instanceof import_TransportServiceCC.TransportServiceCC) {
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
if (cc instanceof Security2CC2) {
|
|
715
|
+
switch (cc.ccCommand) {
|
|
716
|
+
case import_Types.Security2Command.CommandsSupportedGet:
|
|
717
|
+
case import_Types.Security2Command.CommandsSupportedReport:
|
|
718
|
+
case import_Types.Security2Command.NetworkKeyGet:
|
|
719
|
+
case import_Types.Security2Command.NetworkKeyReport:
|
|
720
|
+
case import_Types.Security2Command.NetworkKeyVerify:
|
|
721
|
+
case import_Types.Security2Command.TransferEnd:
|
|
722
|
+
return true;
|
|
723
|
+
case import_Types.Security2Command.KEXSet:
|
|
724
|
+
case import_Types.Security2Command.KEXReport:
|
|
725
|
+
return cc.echo;
|
|
726
|
+
case import_Types.Security2Command.KEXFail: {
|
|
727
|
+
switch (cc.failType) {
|
|
728
|
+
case import_shared.KEXFailType.Decrypt:
|
|
729
|
+
case import_shared.KEXFailType.WrongSecurityLevel:
|
|
730
|
+
case import_shared.KEXFailType.KeyNotGranted:
|
|
731
|
+
case import_shared.KEXFailType.NoVerify:
|
|
732
|
+
return true;
|
|
733
|
+
default:
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
672
736
|
}
|
|
673
737
|
}
|
|
738
|
+
return false;
|
|
674
739
|
}
|
|
675
|
-
return
|
|
740
|
+
return true;
|
|
676
741
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
742
|
+
/** Encapsulates a command that should be sent encrypted */
|
|
743
|
+
static encapsulate(cc, ownNodeId, securityManagers, options) {
|
|
744
|
+
const extensions = [];
|
|
745
|
+
if (options?.multicastOutOfSync) {
|
|
746
|
+
extensions.push(new import_Extension.MOSExtension());
|
|
747
|
+
}
|
|
748
|
+
if (options?.multicastGroupId != void 0) {
|
|
749
|
+
extensions.push(new import_Extension.MGRPExtension({ groupId: options.multicastGroupId }));
|
|
750
|
+
}
|
|
751
|
+
let nodeId;
|
|
752
|
+
if (cc.isMulticast()) {
|
|
753
|
+
if (cc.nodeId.some((nodeId2) => (0, import_core.isLongRangeNodeId)(nodeId2))) {
|
|
754
|
+
nodeId = import_safe.NODE_ID_BROADCAST_LR;
|
|
755
|
+
} else {
|
|
756
|
+
nodeId = import_safe.NODE_ID_BROADCAST;
|
|
757
|
+
}
|
|
692
758
|
} else {
|
|
693
|
-
nodeId =
|
|
759
|
+
nodeId = cc.nodeId;
|
|
694
760
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
};
|
|
709
|
-
Security2CC = Security2CC_1 = __decorate([
|
|
710
|
-
(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["Security 2"]),
|
|
711
|
-
(0, import_CommandClassDecorators.implementedVersion)(1)
|
|
712
|
-
], Security2CC);
|
|
761
|
+
const ret = new Security2CCMessageEncapsulation({
|
|
762
|
+
nodeId,
|
|
763
|
+
encapsulated: cc,
|
|
764
|
+
securityClass: options?.securityClass,
|
|
765
|
+
extensions,
|
|
766
|
+
verifyDelivery: options?.verifyDelivery
|
|
767
|
+
});
|
|
768
|
+
ret.encapsulationFlags = cc.encapsulationFlags & ~import_safe.EncapsulationFlags.Security;
|
|
769
|
+
return ret;
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
return Security2CC2 = _classThis;
|
|
773
|
+
})();
|
|
713
774
|
function failNoSPAN() {
|
|
714
775
|
import_core.validatePayload.fail(import_core.ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
715
776
|
}
|
|
@@ -737,535 +798,607 @@ function testCCResponseForMessageEncapsulation(sent, received) {
|
|
|
737
798
|
return received.SOS && !!received.receiverEI;
|
|
738
799
|
}
|
|
739
800
|
}
|
|
740
|
-
let Security2CCMessageEncapsulation =
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
this.encapsulated = options.encapsulated;
|
|
750
|
-
options.encapsulated.encapsulatingCC = this;
|
|
751
|
-
}
|
|
752
|
-
this.verifyDelivery = options.verifyDelivery !== false;
|
|
753
|
-
this.extensions = options.extensions ?? [];
|
|
754
|
-
if (typeof this.nodeId !== "number" && !this.extensions.some((e) => e instanceof import_Extension.MGRPExtension)) {
|
|
755
|
-
throw new import_core.ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", import_core.ZWaveErrorCodes.Security2CC_MissingExtension);
|
|
801
|
+
let Security2CCMessageEncapsulation = (() => {
|
|
802
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.MessageEncapsulation), (0, import_CommandClassDecorators.expectedCCResponse)(getCCResponseForMessageEncapsulation, testCCResponseForMessageEncapsulation)];
|
|
803
|
+
let _classDescriptor;
|
|
804
|
+
let _classExtraInitializers = [];
|
|
805
|
+
let _classThis;
|
|
806
|
+
let _classSuper = Security2CC;
|
|
807
|
+
var Security2CCMessageEncapsulation2 = class extends _classSuper {
|
|
808
|
+
static {
|
|
809
|
+
_classThis = this;
|
|
756
810
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
break;
|
|
795
|
-
case import_Extension.ValidateS2ExtensionResult.DiscardCommand:
|
|
811
|
+
static {
|
|
812
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
813
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
814
|
+
Security2CCMessageEncapsulation2 = _classThis = _classDescriptor.value;
|
|
815
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
816
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
817
|
+
}
|
|
818
|
+
constructor(options) {
|
|
819
|
+
super(options);
|
|
820
|
+
if (!options.encapsulated && !options.extensions?.length) {
|
|
821
|
+
throw new import_core.ZWaveError("Security S2 encapsulation requires an encapsulated CC and/or extensions", import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
822
|
+
}
|
|
823
|
+
this.sequenceNumber = options.sequenceNumber;
|
|
824
|
+
this.securityClass = options.securityClass;
|
|
825
|
+
if (options.encapsulated) {
|
|
826
|
+
this.encapsulated = options.encapsulated;
|
|
827
|
+
options.encapsulated.encapsulatingCC = this;
|
|
828
|
+
}
|
|
829
|
+
this.verifyDelivery = options.verifyDelivery !== false;
|
|
830
|
+
this.extensions = options.extensions ?? [];
|
|
831
|
+
if (typeof this.nodeId !== "number" && !this.extensions.some((e) => e instanceof import_Extension.MGRPExtension)) {
|
|
832
|
+
throw new import_core.ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", import_core.ZWaveErrorCodes.Security2CC_MissingExtension);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
static from(raw, ctx) {
|
|
836
|
+
const securityManager = assertSecurityRX(ctx);
|
|
837
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
838
|
+
const sequenceNumber = raw.payload[0];
|
|
839
|
+
import_core.validatePayload.withReason("No security class granted")(ctx.getHighestSecurityClass(ctx.sourceNodeId) !== import_core.SecurityClass.None);
|
|
840
|
+
const hasExtensions = !!(raw.payload[1] & 1);
|
|
841
|
+
const hasEncryptedExtensions = !!(raw.payload[1] & 2);
|
|
842
|
+
let offset = 2;
|
|
843
|
+
const extensions = [];
|
|
844
|
+
let mustDiscardCommand = false;
|
|
845
|
+
const parseExtensions = (buffer, wasEncrypted) => {
|
|
846
|
+
while (true) {
|
|
847
|
+
if (buffer.length < offset + 2) {
|
|
796
848
|
mustDiscardCommand = true;
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
const { actual: actualLength, expected: expectedLength } = import_Extension.Security2Extension.getExtensionLength(buffer.subarray(offset));
|
|
852
|
+
const extensionLength = expectedLength ?? actualLength;
|
|
853
|
+
if (extensionLength < 2) {
|
|
854
|
+
mustDiscardCommand = true;
|
|
855
|
+
return;
|
|
856
|
+
} else if (extensionLength > buffer.length - offset - (wasEncrypted ? 0 : import_core.SECURITY_S2_AUTH_TAG_LENGTH)) {
|
|
857
|
+
mustDiscardCommand = true;
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
const extensionData = buffer.subarray(offset, offset + extensionLength);
|
|
861
|
+
offset += extensionLength;
|
|
862
|
+
const ext = import_Extension.Security2Extension.parse(extensionData);
|
|
863
|
+
switch ((0, import_Extension.validateS2Extension)(ext, wasEncrypted)) {
|
|
864
|
+
case import_Extension.ValidateS2ExtensionResult.OK:
|
|
865
|
+
if (expectedLength != void 0 && actualLength !== expectedLength) {
|
|
866
|
+
} else {
|
|
867
|
+
extensions.push(ext);
|
|
868
|
+
}
|
|
869
|
+
break;
|
|
870
|
+
case import_Extension.ValidateS2ExtensionResult.DiscardExtension:
|
|
871
|
+
break;
|
|
872
|
+
case import_Extension.ValidateS2ExtensionResult.DiscardCommand:
|
|
873
|
+
mustDiscardCommand = true;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
if (!ext.moreToFollow)
|
|
797
877
|
break;
|
|
798
878
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
879
|
+
};
|
|
880
|
+
if (hasExtensions)
|
|
881
|
+
parseExtensions(raw.payload, false);
|
|
882
|
+
const mcctx = (() => {
|
|
883
|
+
const multicastGroupId = getMulticastGroupId(extensions);
|
|
884
|
+
if (ctx.frameType === "multicast" || ctx.frameType === "broadcast") {
|
|
885
|
+
if (multicastGroupId == void 0) {
|
|
886
|
+
import_core.validatePayload.fail("Multicast frames without MGRP extension");
|
|
887
|
+
}
|
|
888
|
+
return {
|
|
889
|
+
isMulticast: true,
|
|
890
|
+
groupId: multicastGroupId
|
|
891
|
+
};
|
|
892
|
+
} else {
|
|
893
|
+
return { isMulticast: false, groupId: multicastGroupId };
|
|
810
894
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
895
|
+
})();
|
|
896
|
+
if (mustDiscardCommand) {
|
|
897
|
+
if (mcctx.isMulticast) {
|
|
898
|
+
securityManager.nextPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
899
|
+
} else {
|
|
900
|
+
securityManager.nextNonce(ctx.sourceNodeId);
|
|
901
|
+
}
|
|
902
|
+
import_core.validatePayload.fail("Invalid S2 extension");
|
|
903
|
+
}
|
|
904
|
+
let prevSequenceNumber;
|
|
905
|
+
let mpanState;
|
|
906
|
+
if (mcctx.isMulticast) {
|
|
907
|
+
mpanState = securityManager.getPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
815
908
|
} else {
|
|
816
|
-
|
|
909
|
+
prevSequenceNumber = validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
910
|
+
if (mcctx.groupId == void 0) {
|
|
911
|
+
securityManager.resetOutOfSyncMPANs(ctx.sourceNodeId);
|
|
912
|
+
}
|
|
817
913
|
}
|
|
818
|
-
|
|
819
|
-
|
|
914
|
+
const unencryptedPayload = raw.payload.subarray(0, offset);
|
|
915
|
+
const ciphertext = raw.payload.subarray(offset, -import_core.SECURITY_S2_AUTH_TAG_LENGTH);
|
|
916
|
+
const authTag = raw.payload.subarray(-import_core.SECURITY_S2_AUTH_TAG_LENGTH);
|
|
917
|
+
const messageLength = 2 + raw.payload.length;
|
|
918
|
+
const authData = getAuthenticationData(ctx.sourceNodeId, getDestinationIDRX(ctx, extensions), ctx.homeId, messageLength, unencryptedPayload);
|
|
919
|
+
let decrypt;
|
|
820
920
|
if (mcctx.isMulticast) {
|
|
821
|
-
|
|
921
|
+
if (mpanState?.type !== import_core.MPANState.MPAN) {
|
|
922
|
+
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: import_core.MPANState.OutOfSync });
|
|
923
|
+
failNoMPAN();
|
|
924
|
+
}
|
|
925
|
+
decrypt = () => decryptMulticast(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
|
|
822
926
|
} else {
|
|
823
|
-
securityManager.
|
|
927
|
+
const spanState = securityManager.getSPANState(ctx.sourceNodeId);
|
|
928
|
+
if (spanState.type === import_core.SPANState.None) {
|
|
929
|
+
failNoSPAN();
|
|
930
|
+
} else if (spanState.type === import_core.SPANState.RemoteEI) {
|
|
931
|
+
failNoSPAN();
|
|
932
|
+
}
|
|
933
|
+
decrypt = () => decryptSinglecast(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
824
934
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
935
|
+
let plaintext;
|
|
936
|
+
let authOK = false;
|
|
937
|
+
let key;
|
|
938
|
+
let iv;
|
|
939
|
+
let decryptionSecurityClass;
|
|
940
|
+
const decryptAttempts = mcctx.isMulticast ? MAX_DECRYPT_ATTEMPTS_MULTICAST : mcctx.groupId != void 0 ? MAX_DECRYPT_ATTEMPTS_SC_FOLLOWUP : MAX_DECRYPT_ATTEMPTS_SINGLECAST;
|
|
941
|
+
for (let i = 0; i < decryptAttempts; i++) {
|
|
942
|
+
({
|
|
943
|
+
plaintext,
|
|
944
|
+
authOK,
|
|
945
|
+
key,
|
|
946
|
+
iv,
|
|
947
|
+
securityClass: decryptionSecurityClass
|
|
948
|
+
} = decrypt());
|
|
949
|
+
if (!!authOK && !!plaintext)
|
|
950
|
+
break;
|
|
951
|
+
if (!!getSenderEI(extensions))
|
|
952
|
+
break;
|
|
835
953
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: import_core.MPANState.OutOfSync });
|
|
846
|
-
failNoMPAN();
|
|
954
|
+
if (!authOK || !plaintext) {
|
|
955
|
+
if (mcctx.isMulticast) {
|
|
956
|
+
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: import_core.MPANState.OutOfSync });
|
|
957
|
+
import_core.validatePayload.fail(import_core.ZWaveErrorCodes.Security2CC_CannotDecodeMulticast);
|
|
958
|
+
} else {
|
|
959
|
+
import_core.validatePayload.fail(import_core.ZWaveErrorCodes.Security2CC_CannotDecode);
|
|
960
|
+
}
|
|
961
|
+
} else if (!mcctx.isMulticast && mcctx.groupId != void 0) {
|
|
962
|
+
securityManager.tryIncrementPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
847
963
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
failNoSPAN();
|
|
964
|
+
const securityClass = decryptionSecurityClass;
|
|
965
|
+
offset = 0;
|
|
966
|
+
if (hasEncryptedExtensions)
|
|
967
|
+
parseExtensions(plaintext, true);
|
|
968
|
+
if (mustDiscardCommand) {
|
|
969
|
+
import_core.validatePayload.fail("Invalid extension");
|
|
855
970
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
for (let i = 0; i < decryptAttempts; i++) {
|
|
865
|
-
({
|
|
866
|
-
plaintext,
|
|
867
|
-
authOK,
|
|
868
|
-
key,
|
|
869
|
-
iv,
|
|
870
|
-
securityClass: decryptionSecurityClass
|
|
871
|
-
} = decrypt());
|
|
872
|
-
if (!!authOK && !!plaintext)
|
|
873
|
-
break;
|
|
874
|
-
if (!!getSenderEI(extensions))
|
|
875
|
-
break;
|
|
876
|
-
}
|
|
877
|
-
if (!authOK || !plaintext) {
|
|
878
|
-
if (mcctx.isMulticast) {
|
|
879
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: import_core.MPANState.OutOfSync });
|
|
880
|
-
import_core.validatePayload.fail(import_core.ZWaveErrorCodes.Security2CC_CannotDecodeMulticast);
|
|
881
|
-
} else {
|
|
882
|
-
import_core.validatePayload.fail(import_core.ZWaveErrorCodes.Security2CC_CannotDecode);
|
|
971
|
+
if (!mcctx.isMulticast) {
|
|
972
|
+
const mpanExtension = extensions.find((e) => e instanceof import_Extension.MPANExtension);
|
|
973
|
+
if (mpanExtension) {
|
|
974
|
+
securityManager.storePeerMPAN(ctx.sourceNodeId, mpanExtension.groupId, {
|
|
975
|
+
type: import_core.MPANState.MPAN,
|
|
976
|
+
currentMPAN: mpanExtension.innerMPANState
|
|
977
|
+
});
|
|
978
|
+
}
|
|
883
979
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
if (hasEncryptedExtensions)
|
|
890
|
-
parseExtensions(plaintext, true);
|
|
891
|
-
if (mustDiscardCommand) {
|
|
892
|
-
import_core.validatePayload.fail("Invalid extension");
|
|
893
|
-
}
|
|
894
|
-
if (!mcctx.isMulticast) {
|
|
895
|
-
const mpanExtension = extensions.find((e) => e instanceof import_Extension.MPANExtension);
|
|
896
|
-
if (mpanExtension) {
|
|
897
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mpanExtension.groupId, {
|
|
898
|
-
type: import_core.MPANState.MPAN,
|
|
899
|
-
currentMPAN: mpanExtension.innerMPANState
|
|
900
|
-
});
|
|
980
|
+
const decryptedCCBytes = plaintext.subarray(offset);
|
|
981
|
+
let encapsulated;
|
|
982
|
+
if (decryptedCCBytes.length > 0) {
|
|
983
|
+
(0, import_core.validatePayload)(decryptedCCBytes.length >= 2);
|
|
984
|
+
encapsulated = import_CommandClass.CommandClass.parse(decryptedCCBytes, ctx);
|
|
901
985
|
}
|
|
986
|
+
const ret = new Security2CCMessageEncapsulation2({
|
|
987
|
+
nodeId: ctx.sourceNodeId,
|
|
988
|
+
sequenceNumber,
|
|
989
|
+
securityClass,
|
|
990
|
+
extensions,
|
|
991
|
+
encapsulated
|
|
992
|
+
});
|
|
993
|
+
ret.key = key;
|
|
994
|
+
ret.iv = iv;
|
|
995
|
+
ret.authData = authData;
|
|
996
|
+
ret.authTag = authTag;
|
|
997
|
+
ret.plaintext = decryptedCCBytes;
|
|
998
|
+
return ret;
|
|
902
999
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
return ret;
|
|
922
|
-
}
|
|
923
|
-
securityClass;
|
|
924
|
-
// Only used for testing/debugging purposes
|
|
925
|
-
key;
|
|
926
|
-
iv;
|
|
927
|
-
authData;
|
|
928
|
-
authTag;
|
|
929
|
-
ciphertext;
|
|
930
|
-
plaintext;
|
|
931
|
-
verifyDelivery = true;
|
|
932
|
-
sequenceNumber;
|
|
933
|
-
ensureSequenceNumber(securityManager) {
|
|
934
|
-
if (this.sequenceNumber == void 0) {
|
|
935
|
-
if (this.isSinglecast()) {
|
|
936
|
-
this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
|
|
937
|
-
} else {
|
|
938
|
-
const groupId = getDestinationIDTX.call(this);
|
|
939
|
-
this.sequenceNumber = securityManager.nextMulticastSequenceNumber(groupId);
|
|
1000
|
+
securityClass;
|
|
1001
|
+
// Only used for testing/debugging purposes
|
|
1002
|
+
key;
|
|
1003
|
+
iv;
|
|
1004
|
+
authData;
|
|
1005
|
+
authTag;
|
|
1006
|
+
ciphertext;
|
|
1007
|
+
plaintext;
|
|
1008
|
+
verifyDelivery = true;
|
|
1009
|
+
sequenceNumber;
|
|
1010
|
+
ensureSequenceNumber(securityManager) {
|
|
1011
|
+
if (this.sequenceNumber == void 0) {
|
|
1012
|
+
if (this.isSinglecast()) {
|
|
1013
|
+
this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
|
|
1014
|
+
} else {
|
|
1015
|
+
const groupId = getDestinationIDTX.call(this);
|
|
1016
|
+
this.sequenceNumber = securityManager.nextMulticastSequenceNumber(groupId);
|
|
1017
|
+
}
|
|
940
1018
|
}
|
|
941
1019
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1020
|
+
encapsulated;
|
|
1021
|
+
extensions;
|
|
1022
|
+
prepareRetransmission() {
|
|
1023
|
+
super.prepareRetransmission();
|
|
1024
|
+
this.sequenceNumber = void 0;
|
|
1025
|
+
}
|
|
1026
|
+
hasMOSExtension() {
|
|
1027
|
+
return this.extensions.some((e) => e instanceof import_Extension.MOSExtension);
|
|
1028
|
+
}
|
|
1029
|
+
/** Returns the Sender's Entropy Input if this command contains an SPAN extension */
|
|
1030
|
+
getSenderEI() {
|
|
1031
|
+
return getSenderEI(this.extensions);
|
|
1032
|
+
}
|
|
1033
|
+
/** Returns the multicast group ID if this command contains an MGRP extension */
|
|
1034
|
+
getMulticastGroupId() {
|
|
1035
|
+
return getMulticastGroupId(this.extensions);
|
|
1036
|
+
}
|
|
1037
|
+
maybeAddSPANExtension(ctx, securityManager) {
|
|
1038
|
+
if (!this.isSinglecast())
|
|
1039
|
+
return;
|
|
1040
|
+
const receiverNodeId = this.nodeId;
|
|
1041
|
+
const spanState = securityManager.getSPANState(receiverNodeId);
|
|
1042
|
+
if (spanState.type === import_core.SPANState.None || spanState.type === import_core.SPANState.LocalEI) {
|
|
1043
|
+
throw new import_core.ZWaveError(`Security S2 CC requires the receiver's nonce to be sent!`, import_core.ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1044
|
+
} else if (spanState.type === import_core.SPANState.RemoteEI) {
|
|
1045
|
+
const senderEI = securityManager.generateNonce(void 0);
|
|
1046
|
+
const receiverEI = spanState.receiverEI;
|
|
1047
|
+
if (this.securityClass == void 0 && securityManager.tempKeys.has(receiverNodeId)) {
|
|
1048
|
+
securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
|
|
1049
|
+
} else {
|
|
1050
|
+
const securityClass = this.securityClass ?? ctx.getHighestSecurityClass(receiverNodeId);
|
|
1051
|
+
if (securityClass == void 0) {
|
|
1052
|
+
throw new import_core.ZWaveError("No security class defined for this command!", import_core.ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1053
|
+
}
|
|
1054
|
+
securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
|
|
1055
|
+
}
|
|
1056
|
+
let spanExtension = this.extensions.find((e) => e instanceof import_Extension.SPANExtension);
|
|
1057
|
+
if (spanExtension) {
|
|
1058
|
+
spanExtension.senderEI = senderEI;
|
|
1059
|
+
} else {
|
|
1060
|
+
spanExtension = new import_Extension.SPANExtension({ senderEI });
|
|
1061
|
+
this.extensions.push(spanExtension);
|
|
976
1062
|
}
|
|
977
|
-
securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
|
|
978
1063
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1064
|
+
}
|
|
1065
|
+
serialize(ctx) {
|
|
1066
|
+
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1067
|
+
this.ensureSequenceNumber(securityManager);
|
|
1068
|
+
this.maybeAddSPANExtension(ctx, securityManager);
|
|
1069
|
+
const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
|
|
1070
|
+
const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
|
|
1071
|
+
const unencryptedPayload = import_safe2.Bytes.concat([
|
|
1072
|
+
import_safe2.Bytes.from([
|
|
1073
|
+
this.sequenceNumber,
|
|
1074
|
+
(encryptedExtensions.length > 0 ? 2 : 0) | (unencryptedExtensions.length > 0 ? 1 : 0)
|
|
1075
|
+
]),
|
|
1076
|
+
...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1))
|
|
1077
|
+
]);
|
|
1078
|
+
const serializedCC = this.encapsulated?.serialize(ctx) ?? new import_safe2.Bytes();
|
|
1079
|
+
const plaintextPayload = import_safe2.Bytes.concat([
|
|
1080
|
+
...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
|
|
1081
|
+
serializedCC
|
|
1082
|
+
]);
|
|
1083
|
+
const destinationTag = getDestinationIDTX.call(this);
|
|
1084
|
+
const messageLength = this.computeEncapsulationOverhead() + serializedCC.length;
|
|
1085
|
+
const authData = getAuthenticationData(ctx.ownNodeId, destinationTag, ctx.homeId, messageLength, unencryptedPayload);
|
|
1086
|
+
let key;
|
|
1087
|
+
let iv;
|
|
1088
|
+
if (this.isSinglecast()) {
|
|
1089
|
+
iv = securityManager.nextNonce(this.nodeId, true);
|
|
1090
|
+
const { keyCCM } = (
|
|
1091
|
+
// Prefer the overridden security class if it was given
|
|
1092
|
+
this.securityClass != void 0 ? securityManager.getKeysForSecurityClass(this.securityClass) : securityManager.getKeysForNode(this.nodeId)
|
|
1093
|
+
);
|
|
1094
|
+
key = keyCCM;
|
|
982
1095
|
} else {
|
|
983
|
-
|
|
984
|
-
|
|
1096
|
+
const keyAndIV = securityManager.getMulticastKeyAndIV(destinationTag);
|
|
1097
|
+
key = keyAndIV.key;
|
|
1098
|
+
iv = keyAndIV.iv;
|
|
985
1099
|
}
|
|
1100
|
+
const { ciphertext: ciphertextPayload, authTag } = (0, import_core.encryptAES128CCM)(key, iv, plaintextPayload, authData, import_core.SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1101
|
+
this.key = key;
|
|
1102
|
+
this.iv = iv;
|
|
1103
|
+
this.authData = authData;
|
|
1104
|
+
this.authTag = authTag;
|
|
1105
|
+
this.ciphertext = ciphertextPayload;
|
|
1106
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1107
|
+
unencryptedPayload,
|
|
1108
|
+
ciphertextPayload,
|
|
1109
|
+
authTag
|
|
1110
|
+
]);
|
|
1111
|
+
return super.serialize(ctx);
|
|
986
1112
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
this.ensureSequenceNumber(securityManager);
|
|
991
|
-
this.maybeAddSPANExtension(ctx, securityManager);
|
|
992
|
-
const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
|
|
993
|
-
const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
|
|
994
|
-
const unencryptedPayload = import_safe2.Bytes.concat([
|
|
995
|
-
import_safe2.Bytes.from([
|
|
996
|
-
this.sequenceNumber,
|
|
997
|
-
(encryptedExtensions.length > 0 ? 2 : 0) | (unencryptedExtensions.length > 0 ? 1 : 0)
|
|
998
|
-
]),
|
|
999
|
-
...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1))
|
|
1000
|
-
]);
|
|
1001
|
-
const serializedCC = this.encapsulated?.serialize(ctx) ?? new import_safe2.Bytes();
|
|
1002
|
-
const plaintextPayload = import_safe2.Bytes.concat([
|
|
1003
|
-
...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
|
|
1004
|
-
serializedCC
|
|
1005
|
-
]);
|
|
1006
|
-
const destinationTag = getDestinationIDTX.call(this);
|
|
1007
|
-
const messageLength = this.computeEncapsulationOverhead() + serializedCC.length;
|
|
1008
|
-
const authData = getAuthenticationData(ctx.ownNodeId, destinationTag, ctx.homeId, messageLength, unencryptedPayload);
|
|
1009
|
-
let key;
|
|
1010
|
-
let iv;
|
|
1011
|
-
if (this.isSinglecast()) {
|
|
1012
|
-
iv = securityManager.nextNonce(this.nodeId, true);
|
|
1013
|
-
const { keyCCM } = (
|
|
1014
|
-
// Prefer the overridden security class if it was given
|
|
1015
|
-
this.securityClass != void 0 ? securityManager.getKeysForSecurityClass(this.securityClass) : securityManager.getKeysForNode(this.nodeId)
|
|
1016
|
-
);
|
|
1017
|
-
key = keyCCM;
|
|
1018
|
-
} else {
|
|
1019
|
-
const keyAndIV = securityManager.getMulticastKeyAndIV(destinationTag);
|
|
1020
|
-
key = keyAndIV.key;
|
|
1021
|
-
iv = keyAndIV.iv;
|
|
1022
|
-
}
|
|
1023
|
-
const { ciphertext: ciphertextPayload, authTag } = (0, import_core.encryptAES128CCM)(key, iv, plaintextPayload, authData, import_core.SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1024
|
-
this.key = key;
|
|
1025
|
-
this.iv = iv;
|
|
1026
|
-
this.authData = authData;
|
|
1027
|
-
this.authTag = authTag;
|
|
1028
|
-
this.ciphertext = ciphertextPayload;
|
|
1029
|
-
this.payload = import_safe2.Bytes.concat([
|
|
1030
|
-
unencryptedPayload,
|
|
1031
|
-
ciphertextPayload,
|
|
1032
|
-
authTag
|
|
1033
|
-
]);
|
|
1034
|
-
return super.serialize(ctx);
|
|
1035
|
-
}
|
|
1036
|
-
computeEncapsulationOverhead() {
|
|
1037
|
-
const extensionBytes = this.extensions.map((e) => e.computeLength()).reduce((a, b) => a + b, 0);
|
|
1038
|
-
return super.computeEncapsulationOverhead() + 2 + import_core.SECURITY_S2_AUTH_TAG_LENGTH + extensionBytes;
|
|
1039
|
-
}
|
|
1040
|
-
toLogEntry(ctx) {
|
|
1041
|
-
const message = {
|
|
1042
|
-
"sequence number": this.sequenceNumber ?? "(not set)"
|
|
1043
|
-
};
|
|
1044
|
-
if (this.extensions.length > 0) {
|
|
1045
|
-
message.extensions = this.extensions.map((e) => e.toLogEntry()).join("");
|
|
1113
|
+
computeEncapsulationOverhead() {
|
|
1114
|
+
const extensionBytes = this.extensions.map((e) => e.computeLength()).reduce((a, b) => a + b, 0);
|
|
1115
|
+
return super.computeEncapsulationOverhead() + 2 + import_core.SECURITY_S2_AUTH_TAG_LENGTH + extensionBytes;
|
|
1046
1116
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1117
|
+
toLogEntry(ctx) {
|
|
1118
|
+
const message = {
|
|
1119
|
+
"sequence number": this.sequenceNumber ?? "(not set)"
|
|
1120
|
+
};
|
|
1121
|
+
if (this.extensions.length > 0) {
|
|
1122
|
+
message.extensions = this.extensions.map((e) => e.toLogEntry()).join("");
|
|
1050
1123
|
}
|
|
1051
|
-
if (
|
|
1052
|
-
|
|
1124
|
+
if (process.env.NODE_ENV === "test" || process.env.NODE_ENV === "development") {
|
|
1125
|
+
if (this.key) {
|
|
1126
|
+
message.key = (0, import_safe3.buffer2hex)(this.key);
|
|
1127
|
+
}
|
|
1128
|
+
if (this.iv) {
|
|
1129
|
+
message.IV = (0, import_safe3.buffer2hex)(this.iv);
|
|
1130
|
+
}
|
|
1131
|
+
if (this.ciphertext) {
|
|
1132
|
+
message.ciphertext = (0, import_safe3.buffer2hex)(this.ciphertext);
|
|
1133
|
+
} else if (this.plaintext) {
|
|
1134
|
+
message.plaintext = (0, import_safe3.buffer2hex)(this.plaintext);
|
|
1135
|
+
}
|
|
1136
|
+
if (this.authData) {
|
|
1137
|
+
message["auth data"] = (0, import_safe3.buffer2hex)(this.authData);
|
|
1138
|
+
}
|
|
1139
|
+
if (this.authTag) {
|
|
1140
|
+
message["auth tag"] = (0, import_safe3.buffer2hex)(this.authTag);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
if (this.securityClass != void 0) {
|
|
1144
|
+
message["security class"] = (0, import_safe3.getEnumMemberName)(import_core.SecurityClass, this.securityClass);
|
|
1145
|
+
}
|
|
1146
|
+
return {
|
|
1147
|
+
...super.toLogEntry(ctx),
|
|
1148
|
+
message
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
return Security2CCMessageEncapsulation2 = _classThis;
|
|
1153
|
+
})();
|
|
1154
|
+
let Security2CCNonceReport = (() => {
|
|
1155
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.NonceReport)];
|
|
1156
|
+
let _classDescriptor;
|
|
1157
|
+
let _classExtraInitializers = [];
|
|
1158
|
+
let _classThis;
|
|
1159
|
+
let _classSuper = Security2CC;
|
|
1160
|
+
var Security2CCNonceReport2 = class extends _classSuper {
|
|
1161
|
+
static {
|
|
1162
|
+
_classThis = this;
|
|
1163
|
+
}
|
|
1164
|
+
static {
|
|
1165
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1166
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1167
|
+
Security2CCNonceReport2 = _classThis = _classDescriptor.value;
|
|
1168
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1169
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1170
|
+
}
|
|
1171
|
+
constructor(options) {
|
|
1172
|
+
super(options);
|
|
1173
|
+
this.SOS = options.SOS;
|
|
1174
|
+
this.MOS = options.MOS;
|
|
1175
|
+
this.sequenceNumber = options.sequenceNumber;
|
|
1176
|
+
if (options.SOS)
|
|
1177
|
+
this.receiverEI = options.receiverEI;
|
|
1178
|
+
}
|
|
1179
|
+
static from(raw, ctx) {
|
|
1180
|
+
const securityManager = assertSecurityRX(ctx);
|
|
1181
|
+
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
1182
|
+
const sequenceNumber = raw.payload[0];
|
|
1183
|
+
validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
1184
|
+
const MOS = !!(raw.payload[1] & 2);
|
|
1185
|
+
const SOS = !!(raw.payload[1] & 1);
|
|
1186
|
+
if (SOS) {
|
|
1187
|
+
(0, import_core.validatePayload)(raw.payload.length >= 18);
|
|
1188
|
+
const receiverEI = raw.payload.subarray(2, 18);
|
|
1189
|
+
securityManager.storeRemoteEI(ctx.sourceNodeId, receiverEI);
|
|
1190
|
+
return new this({
|
|
1191
|
+
nodeId: ctx.sourceNodeId,
|
|
1192
|
+
sequenceNumber,
|
|
1193
|
+
MOS,
|
|
1194
|
+
SOS,
|
|
1195
|
+
receiverEI
|
|
1196
|
+
});
|
|
1197
|
+
} else if (MOS) {
|
|
1198
|
+
return new this({
|
|
1199
|
+
nodeId: ctx.sourceNodeId,
|
|
1200
|
+
sequenceNumber,
|
|
1201
|
+
MOS,
|
|
1202
|
+
SOS: false
|
|
1203
|
+
});
|
|
1204
|
+
} else {
|
|
1205
|
+
import_core.validatePayload.fail("Either MOS or SOS must be set");
|
|
1053
1206
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1207
|
+
}
|
|
1208
|
+
sequenceNumber;
|
|
1209
|
+
ensureSequenceNumber(securityManager) {
|
|
1210
|
+
if (this.sequenceNumber == void 0) {
|
|
1211
|
+
this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
|
|
1058
1212
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1213
|
+
}
|
|
1214
|
+
SOS;
|
|
1215
|
+
MOS;
|
|
1216
|
+
receiverEI;
|
|
1217
|
+
serialize(ctx) {
|
|
1218
|
+
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1219
|
+
this.ensureSequenceNumber(securityManager);
|
|
1220
|
+
this.payload = import_safe2.Bytes.from([
|
|
1221
|
+
this.sequenceNumber,
|
|
1222
|
+
(this.MOS ? 2 : 0) + (this.SOS ? 1 : 0)
|
|
1223
|
+
]);
|
|
1224
|
+
if (this.SOS) {
|
|
1225
|
+
this.payload = import_safe2.Bytes.concat([this.payload, this.receiverEI]);
|
|
1061
1226
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1227
|
+
return super.serialize(ctx);
|
|
1228
|
+
}
|
|
1229
|
+
toLogEntry(ctx) {
|
|
1230
|
+
const message = {
|
|
1231
|
+
"sequence number": this.sequenceNumber ?? "(not set)",
|
|
1232
|
+
SOS: this.SOS,
|
|
1233
|
+
MOS: this.MOS
|
|
1234
|
+
};
|
|
1235
|
+
if (this.receiverEI) {
|
|
1236
|
+
message["receiver entropy"] = (0, import_safe3.buffer2hex)(this.receiverEI);
|
|
1064
1237
|
}
|
|
1238
|
+
return {
|
|
1239
|
+
...super.toLogEntry(ctx),
|
|
1240
|
+
message
|
|
1241
|
+
};
|
|
1065
1242
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1243
|
+
};
|
|
1244
|
+
return Security2CCNonceReport2 = _classThis;
|
|
1245
|
+
})();
|
|
1246
|
+
let Security2CCNonceGet = (() => {
|
|
1247
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.NonceGet), (0, import_CommandClassDecorators.expectedCCResponse)(Security2CCNonceReport)];
|
|
1248
|
+
let _classDescriptor;
|
|
1249
|
+
let _classExtraInitializers = [];
|
|
1250
|
+
let _classThis;
|
|
1251
|
+
let _classSuper = Security2CC;
|
|
1252
|
+
var Security2CCNonceGet2 = class extends _classSuper {
|
|
1253
|
+
static {
|
|
1254
|
+
_classThis = this;
|
|
1068
1255
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
static from(raw, ctx) {
|
|
1089
|
-
const securityManager = assertSecurityRX(ctx);
|
|
1090
|
-
(0, import_core.validatePayload)(raw.payload.length >= 2);
|
|
1091
|
-
const sequenceNumber = raw.payload[0];
|
|
1092
|
-
validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
1093
|
-
const MOS = !!(raw.payload[1] & 2);
|
|
1094
|
-
const SOS = !!(raw.payload[1] & 1);
|
|
1095
|
-
if (SOS) {
|
|
1096
|
-
(0, import_core.validatePayload)(raw.payload.length >= 18);
|
|
1097
|
-
const receiverEI = raw.payload.subarray(2, 18);
|
|
1098
|
-
securityManager.storeRemoteEI(ctx.sourceNodeId, receiverEI);
|
|
1099
|
-
return new Security2CCNonceReport_1({
|
|
1100
|
-
nodeId: ctx.sourceNodeId,
|
|
1101
|
-
sequenceNumber,
|
|
1102
|
-
MOS,
|
|
1103
|
-
SOS,
|
|
1104
|
-
receiverEI
|
|
1105
|
-
});
|
|
1106
|
-
} else if (MOS) {
|
|
1107
|
-
return new Security2CCNonceReport_1({
|
|
1256
|
+
static {
|
|
1257
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1258
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1259
|
+
Security2CCNonceGet2 = _classThis = _classDescriptor.value;
|
|
1260
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1261
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1262
|
+
}
|
|
1263
|
+
// TODO: A node sending this command MUST accept a delay up to <Previous Round-trip-time to peer node> +
|
|
1264
|
+
// 250 ms before receiving the Security 2 Nonce Report Command.
|
|
1265
|
+
constructor(options) {
|
|
1266
|
+
super(options);
|
|
1267
|
+
this.sequenceNumber = options.sequenceNumber;
|
|
1268
|
+
}
|
|
1269
|
+
static from(raw, ctx) {
|
|
1270
|
+
const securityManager = assertSecurityRX(ctx);
|
|
1271
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1272
|
+
const sequenceNumber = raw.payload[0];
|
|
1273
|
+
validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
1274
|
+
return new this({
|
|
1108
1275
|
nodeId: ctx.sourceNodeId,
|
|
1109
|
-
sequenceNumber
|
|
1110
|
-
MOS,
|
|
1111
|
-
SOS: false
|
|
1276
|
+
sequenceNumber
|
|
1112
1277
|
});
|
|
1113
|
-
} else {
|
|
1114
|
-
import_core.validatePayload.fail("Either MOS or SOS must be set");
|
|
1115
1278
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1279
|
+
sequenceNumber;
|
|
1280
|
+
ensureSequenceNumber(securityManager) {
|
|
1281
|
+
if (this.sequenceNumber == void 0) {
|
|
1282
|
+
this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
|
|
1283
|
+
}
|
|
1121
1284
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1128
|
-
this.ensureSequenceNumber(securityManager);
|
|
1129
|
-
this.payload = import_safe2.Bytes.from([
|
|
1130
|
-
this.sequenceNumber,
|
|
1131
|
-
(this.MOS ? 2 : 0) + (this.SOS ? 1 : 0)
|
|
1132
|
-
]);
|
|
1133
|
-
if (this.SOS) {
|
|
1134
|
-
this.payload = import_safe2.Bytes.concat([this.payload, this.receiverEI]);
|
|
1135
|
-
}
|
|
1136
|
-
return super.serialize(ctx);
|
|
1137
|
-
}
|
|
1138
|
-
toLogEntry(ctx) {
|
|
1139
|
-
const message = {
|
|
1140
|
-
"sequence number": this.sequenceNumber ?? "(not set)",
|
|
1141
|
-
SOS: this.SOS,
|
|
1142
|
-
MOS: this.MOS
|
|
1143
|
-
};
|
|
1144
|
-
if (this.receiverEI) {
|
|
1145
|
-
message["receiver entropy"] = (0, import_safe3.buffer2hex)(this.receiverEI);
|
|
1285
|
+
serialize(ctx) {
|
|
1286
|
+
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1287
|
+
this.ensureSequenceNumber(securityManager);
|
|
1288
|
+
this.payload = import_safe2.Bytes.from([this.sequenceNumber]);
|
|
1289
|
+
return super.serialize(ctx);
|
|
1146
1290
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.NonceReport)
|
|
1155
|
-
], Security2CCNonceReport);
|
|
1156
|
-
let Security2CCNonceGet = Security2CCNonceGet_1 = class Security2CCNonceGet2 extends Security2CC {
|
|
1157
|
-
// TODO: A node sending this command MUST accept a delay up to <Previous Round-trip-time to peer node> +
|
|
1158
|
-
// 250 ms before receiving the Security 2 Nonce Report Command.
|
|
1159
|
-
constructor(options) {
|
|
1160
|
-
super(options);
|
|
1161
|
-
this.sequenceNumber = options.sequenceNumber;
|
|
1162
|
-
}
|
|
1163
|
-
static from(raw, ctx) {
|
|
1164
|
-
const securityManager = assertSecurityRX(ctx);
|
|
1165
|
-
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1166
|
-
const sequenceNumber = raw.payload[0];
|
|
1167
|
-
validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
1168
|
-
return new Security2CCNonceGet_1({
|
|
1169
|
-
nodeId: ctx.sourceNodeId,
|
|
1170
|
-
sequenceNumber
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
sequenceNumber;
|
|
1174
|
-
ensureSequenceNumber(securityManager) {
|
|
1175
|
-
if (this.sequenceNumber == void 0) {
|
|
1176
|
-
this.sequenceNumber = securityManager.nextSequenceNumber(this.nodeId);
|
|
1291
|
+
toLogEntry(ctx) {
|
|
1292
|
+
return {
|
|
1293
|
+
...super.toLogEntry(ctx),
|
|
1294
|
+
message: {
|
|
1295
|
+
"sequence number": this.sequenceNumber ?? "(not set)"
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1177
1298
|
}
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
};
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
"supported schemes": this.supportedKEXSchemes.map((s) => `
|
|
1299
|
+
};
|
|
1300
|
+
return Security2CCNonceGet2 = _classThis;
|
|
1301
|
+
})();
|
|
1302
|
+
let Security2CCKEXReport = (() => {
|
|
1303
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.KEXReport)];
|
|
1304
|
+
let _classDescriptor;
|
|
1305
|
+
let _classExtraInitializers = [];
|
|
1306
|
+
let _classThis;
|
|
1307
|
+
let _classSuper = Security2CC;
|
|
1308
|
+
var Security2CCKEXReport2 = class extends _classSuper {
|
|
1309
|
+
static {
|
|
1310
|
+
_classThis = this;
|
|
1311
|
+
}
|
|
1312
|
+
static {
|
|
1313
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1314
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1315
|
+
Security2CCKEXReport2 = _classThis = _classDescriptor.value;
|
|
1316
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1317
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1318
|
+
}
|
|
1319
|
+
constructor(options) {
|
|
1320
|
+
super(options);
|
|
1321
|
+
this.requestCSA = options.requestCSA;
|
|
1322
|
+
this.echo = options.echo;
|
|
1323
|
+
this._reserved = options._reserved ?? 0;
|
|
1324
|
+
this.supportedKEXSchemes = options.supportedKEXSchemes;
|
|
1325
|
+
this.supportedECDHProfiles = options.supportedECDHProfiles;
|
|
1326
|
+
this.requestedKeys = options.requestedKeys;
|
|
1327
|
+
}
|
|
1328
|
+
static from(raw, ctx) {
|
|
1329
|
+
(0, import_core.validatePayload)(raw.payload.length >= 4);
|
|
1330
|
+
const requestCSA = !!(raw.payload[0] & 2);
|
|
1331
|
+
const echo = !!(raw.payload[0] & 1);
|
|
1332
|
+
const _reserved = raw.payload[0] & 252;
|
|
1333
|
+
const supportedKEXSchemes = (0, import_core.parseBitMask)(raw.payload.subarray(1, 2), 0).filter((s) => s !== 0);
|
|
1334
|
+
const supportedECDHProfiles = (0, import_core.parseBitMask)(raw.payload.subarray(2, 3), import_shared.ECDHProfiles.Curve25519);
|
|
1335
|
+
const requestedKeys = (0, import_core.parseBitMask)(raw.payload.subarray(3, 4), import_core.SecurityClass.S2_Unauthenticated);
|
|
1336
|
+
return new this({
|
|
1337
|
+
nodeId: ctx.sourceNodeId,
|
|
1338
|
+
requestCSA,
|
|
1339
|
+
echo,
|
|
1340
|
+
_reserved,
|
|
1341
|
+
supportedKEXSchemes,
|
|
1342
|
+
supportedECDHProfiles,
|
|
1343
|
+
requestedKeys
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
_reserved;
|
|
1347
|
+
requestCSA;
|
|
1348
|
+
echo;
|
|
1349
|
+
supportedKEXSchemes;
|
|
1350
|
+
supportedECDHProfiles;
|
|
1351
|
+
requestedKeys;
|
|
1352
|
+
serialize(ctx) {
|
|
1353
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1354
|
+
import_safe2.Bytes.from([
|
|
1355
|
+
this._reserved + (this.requestCSA ? 2 : 0) + (this.echo ? 1 : 0)
|
|
1356
|
+
]),
|
|
1357
|
+
// The bit mask starts at 0, but bit 0 is not used
|
|
1358
|
+
(0, import_core.encodeBitMask)(this.supportedKEXSchemes, 7, 0),
|
|
1359
|
+
(0, import_core.encodeBitMask)(this.supportedECDHProfiles, 7, import_shared.ECDHProfiles.Curve25519),
|
|
1360
|
+
(0, import_core.encodeBitMask)(this.requestedKeys, import_core.SecurityClass.S0_Legacy, import_core.SecurityClass.S2_Unauthenticated)
|
|
1361
|
+
]);
|
|
1362
|
+
return super.serialize(ctx);
|
|
1363
|
+
}
|
|
1364
|
+
toLogEntry(ctx) {
|
|
1365
|
+
return {
|
|
1366
|
+
...super.toLogEntry(ctx),
|
|
1367
|
+
message: {
|
|
1368
|
+
echo: this.echo,
|
|
1369
|
+
"supported schemes": this.supportedKEXSchemes.map((s) => `
|
|
1250
1370
|
\xB7 ${(0, import_safe3.getEnumMemberName)(import_shared.KEXSchemes, s)}`).join(""),
|
|
1251
|
-
|
|
1371
|
+
"supported ECDH profiles": this.supportedECDHProfiles.map((s) => `
|
|
1252
1372
|
\xB7 ${(0, import_safe3.getEnumMemberName)(import_shared.ECDHProfiles, s)}`).join(""),
|
|
1253
|
-
|
|
1254
|
-
|
|
1373
|
+
"CSA requested": this.requestCSA,
|
|
1374
|
+
"requested security classes": this.requestedKeys.map((s) => `
|
|
1255
1375
|
\xB7 ${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, s)}`).join("")
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
let
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
return Security2CCKEXReport2 = _classThis;
|
|
1381
|
+
})();
|
|
1382
|
+
let Security2CCKEXGet = (() => {
|
|
1383
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.KEXGet), (0, import_CommandClassDecorators.expectedCCResponse)(Security2CCKEXReport)];
|
|
1384
|
+
let _classDescriptor;
|
|
1385
|
+
let _classExtraInitializers = [];
|
|
1386
|
+
let _classThis;
|
|
1387
|
+
let _classSuper = Security2CC;
|
|
1388
|
+
var Security2CCKEXGet2 = class extends _classSuper {
|
|
1389
|
+
static {
|
|
1390
|
+
_classThis = this;
|
|
1391
|
+
}
|
|
1392
|
+
static {
|
|
1393
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1394
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1395
|
+
Security2CCKEXGet2 = _classThis = _classDescriptor.value;
|
|
1396
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1397
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
return Security2CCKEXGet2 = _classThis;
|
|
1401
|
+
})();
|
|
1269
1402
|
function getExpectedResponseForKEXSet(sent) {
|
|
1270
1403
|
if (sent.echo) {
|
|
1271
1404
|
return [Security2CCKEXReport, Security2CCKEXFail];
|
|
@@ -1283,290 +1416,421 @@ function testExpectedResponseForKEXSet(sent, received) {
|
|
|
1283
1416
|
}
|
|
1284
1417
|
return false;
|
|
1285
1418
|
}
|
|
1286
|
-
let Security2CCKEXSet =
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1419
|
+
let Security2CCKEXSet = (() => {
|
|
1420
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.KEXSet), (0, import_CommandClassDecorators.expectedCCResponse)(getExpectedResponseForKEXSet, testExpectedResponseForKEXSet)];
|
|
1421
|
+
let _classDescriptor;
|
|
1422
|
+
let _classExtraInitializers = [];
|
|
1423
|
+
let _classThis;
|
|
1424
|
+
let _classSuper = Security2CC;
|
|
1425
|
+
var Security2CCKEXSet2 = class extends _classSuper {
|
|
1426
|
+
static {
|
|
1427
|
+
_classThis = this;
|
|
1428
|
+
}
|
|
1429
|
+
static {
|
|
1430
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1431
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1432
|
+
Security2CCKEXSet2 = _classThis = _classDescriptor.value;
|
|
1433
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1434
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1435
|
+
}
|
|
1436
|
+
constructor(options) {
|
|
1437
|
+
super(options);
|
|
1438
|
+
this.permitCSA = options.permitCSA;
|
|
1439
|
+
this.echo = options.echo;
|
|
1440
|
+
this._reserved = options._reserved ?? 0;
|
|
1441
|
+
this.selectedKEXScheme = options.selectedKEXScheme;
|
|
1442
|
+
this.selectedECDHProfile = options.selectedECDHProfile;
|
|
1443
|
+
this.grantedKeys = options.grantedKeys;
|
|
1444
|
+
}
|
|
1445
|
+
static from(raw, ctx) {
|
|
1446
|
+
(0, import_core.validatePayload)(raw.payload.length >= 4);
|
|
1447
|
+
const _reserved = raw.payload[0] & 252;
|
|
1448
|
+
const permitCSA = !!(raw.payload[0] & 2);
|
|
1449
|
+
const echo = !!(raw.payload[0] & 1);
|
|
1450
|
+
const selectedKEXSchemes = (0, import_core.parseBitMask)(raw.payload.subarray(1, 2), 0).filter((s) => s !== 0);
|
|
1451
|
+
(0, import_core.validatePayload)(selectedKEXSchemes.length === 1);
|
|
1452
|
+
const selectedKEXScheme = selectedKEXSchemes[0];
|
|
1453
|
+
const selectedECDHProfiles = (0, import_core.parseBitMask)(raw.payload.subarray(2, 3), import_shared.ECDHProfiles.Curve25519);
|
|
1454
|
+
(0, import_core.validatePayload)(selectedECDHProfiles.length === 1);
|
|
1455
|
+
const selectedECDHProfile = selectedECDHProfiles[0];
|
|
1456
|
+
const grantedKeys = (0, import_core.parseBitMask)(raw.payload.subarray(3, 4), import_core.SecurityClass.S2_Unauthenticated);
|
|
1457
|
+
return new this({
|
|
1458
|
+
nodeId: ctx.sourceNodeId,
|
|
1459
|
+
_reserved,
|
|
1460
|
+
permitCSA,
|
|
1461
|
+
echo,
|
|
1462
|
+
selectedKEXScheme,
|
|
1463
|
+
selectedECDHProfile,
|
|
1464
|
+
grantedKeys
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
_reserved;
|
|
1468
|
+
permitCSA;
|
|
1469
|
+
echo;
|
|
1470
|
+
selectedKEXScheme;
|
|
1471
|
+
selectedECDHProfile;
|
|
1472
|
+
grantedKeys;
|
|
1473
|
+
serialize(ctx) {
|
|
1474
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1475
|
+
import_safe2.Bytes.from([
|
|
1476
|
+
this._reserved + (this.permitCSA ? 2 : 0) + (this.echo ? 1 : 0)
|
|
1477
|
+
]),
|
|
1478
|
+
// The bit mask starts at 0, but bit 0 is not used
|
|
1479
|
+
(0, import_core.encodeBitMask)([this.selectedKEXScheme], 7, 0),
|
|
1480
|
+
(0, import_core.encodeBitMask)([this.selectedECDHProfile], 7, import_shared.ECDHProfiles.Curve25519),
|
|
1481
|
+
(0, import_core.encodeBitMask)(this.grantedKeys, import_core.SecurityClass.S0_Legacy, import_core.SecurityClass.S2_Unauthenticated)
|
|
1482
|
+
]);
|
|
1483
|
+
return super.serialize(ctx);
|
|
1484
|
+
}
|
|
1485
|
+
toLogEntry(ctx) {
|
|
1486
|
+
return {
|
|
1487
|
+
...super.toLogEntry(ctx),
|
|
1488
|
+
message: {
|
|
1489
|
+
echo: this.echo,
|
|
1490
|
+
"selected scheme": (0, import_safe3.getEnumMemberName)(import_shared.KEXSchemes, this.selectedKEXScheme),
|
|
1491
|
+
"selected ECDH profile": (0, import_safe3.getEnumMemberName)(import_shared.ECDHProfiles, this.selectedECDHProfile),
|
|
1492
|
+
"CSA permitted": this.permitCSA,
|
|
1493
|
+
"granted security classes": this.grantedKeys.map((s) => `
|
|
1345
1494
|
\xB7 ${(0, import_safe3.getEnumMemberName)(import_core.SecurityClass, s)}`).join("")
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
let
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
this
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
]
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
(
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
(
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
};
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1495
|
+
}
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
return Security2CCKEXSet2 = _classThis;
|
|
1500
|
+
})();
|
|
1501
|
+
let Security2CCKEXFail = (() => {
|
|
1502
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.KEXFail)];
|
|
1503
|
+
let _classDescriptor;
|
|
1504
|
+
let _classExtraInitializers = [];
|
|
1505
|
+
let _classThis;
|
|
1506
|
+
let _classSuper = Security2CC;
|
|
1507
|
+
var Security2CCKEXFail2 = class extends _classSuper {
|
|
1508
|
+
static {
|
|
1509
|
+
_classThis = this;
|
|
1510
|
+
}
|
|
1511
|
+
static {
|
|
1512
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1513
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1514
|
+
Security2CCKEXFail2 = _classThis = _classDescriptor.value;
|
|
1515
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1516
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1517
|
+
}
|
|
1518
|
+
constructor(options) {
|
|
1519
|
+
super(options);
|
|
1520
|
+
this.failType = options.failType;
|
|
1521
|
+
}
|
|
1522
|
+
static from(raw, ctx) {
|
|
1523
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1524
|
+
const failType = raw.payload[0];
|
|
1525
|
+
return new this({
|
|
1526
|
+
nodeId: ctx.sourceNodeId,
|
|
1527
|
+
failType
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
failType;
|
|
1531
|
+
serialize(ctx) {
|
|
1532
|
+
this.payload = import_safe2.Bytes.from([this.failType]);
|
|
1533
|
+
return super.serialize(ctx);
|
|
1534
|
+
}
|
|
1535
|
+
toLogEntry(ctx) {
|
|
1536
|
+
return {
|
|
1537
|
+
...super.toLogEntry(ctx),
|
|
1538
|
+
message: { reason: (0, import_safe3.getEnumMemberName)(import_shared.KEXFailType, this.failType) }
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
return Security2CCKEXFail2 = _classThis;
|
|
1543
|
+
})();
|
|
1544
|
+
let Security2CCPublicKeyReport = (() => {
|
|
1545
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.PublicKeyReport)];
|
|
1546
|
+
let _classDescriptor;
|
|
1547
|
+
let _classExtraInitializers = [];
|
|
1548
|
+
let _classThis;
|
|
1549
|
+
let _classSuper = Security2CC;
|
|
1550
|
+
var Security2CCPublicKeyReport2 = class extends _classSuper {
|
|
1551
|
+
static {
|
|
1552
|
+
_classThis = this;
|
|
1553
|
+
}
|
|
1554
|
+
static {
|
|
1555
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1556
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1557
|
+
Security2CCPublicKeyReport2 = _classThis = _classDescriptor.value;
|
|
1558
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1559
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1560
|
+
}
|
|
1561
|
+
constructor(options) {
|
|
1562
|
+
super(options);
|
|
1563
|
+
this.includingNode = options.includingNode;
|
|
1564
|
+
this.publicKey = options.publicKey;
|
|
1565
|
+
}
|
|
1566
|
+
static from(raw, ctx) {
|
|
1567
|
+
(0, import_core.validatePayload)(raw.payload.length >= 17);
|
|
1568
|
+
const includingNode = !!(raw.payload[0] & 1);
|
|
1569
|
+
const publicKey = raw.payload.subarray(1);
|
|
1570
|
+
return new this({
|
|
1571
|
+
nodeId: ctx.sourceNodeId,
|
|
1572
|
+
includingNode,
|
|
1573
|
+
publicKey
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
includingNode;
|
|
1577
|
+
publicKey;
|
|
1578
|
+
serialize(ctx) {
|
|
1579
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1580
|
+
import_safe2.Bytes.from([this.includingNode ? 1 : 0]),
|
|
1581
|
+
this.publicKey
|
|
1582
|
+
]);
|
|
1583
|
+
return super.serialize(ctx);
|
|
1584
|
+
}
|
|
1585
|
+
toLogEntry(ctx) {
|
|
1586
|
+
return {
|
|
1587
|
+
...super.toLogEntry(ctx),
|
|
1588
|
+
message: {
|
|
1589
|
+
"is including node": this.includingNode,
|
|
1590
|
+
"public key": (0, import_safe3.buffer2hex)(this.publicKey)
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
return Security2CCPublicKeyReport2 = _classThis;
|
|
1596
|
+
})();
|
|
1597
|
+
let Security2CCNetworkKeyReport = (() => {
|
|
1598
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.NetworkKeyReport)];
|
|
1599
|
+
let _classDescriptor;
|
|
1600
|
+
let _classExtraInitializers = [];
|
|
1601
|
+
let _classThis;
|
|
1602
|
+
let _classSuper = Security2CC;
|
|
1603
|
+
var Security2CCNetworkKeyReport2 = class extends _classSuper {
|
|
1604
|
+
static {
|
|
1605
|
+
_classThis = this;
|
|
1606
|
+
}
|
|
1607
|
+
static {
|
|
1608
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1609
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1610
|
+
Security2CCNetworkKeyReport2 = _classThis = _classDescriptor.value;
|
|
1611
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1612
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1613
|
+
}
|
|
1614
|
+
constructor(options) {
|
|
1615
|
+
super(options);
|
|
1616
|
+
this.grantedKey = options.grantedKey;
|
|
1617
|
+
this.networkKey = options.networkKey;
|
|
1618
|
+
}
|
|
1619
|
+
static from(raw, ctx) {
|
|
1620
|
+
(0, import_core.validatePayload)(raw.payload.length >= 17);
|
|
1621
|
+
const grantedKey = bitMaskToSecurityClass(raw.payload, 0);
|
|
1622
|
+
const networkKey = raw.payload.subarray(1, 17);
|
|
1623
|
+
return new this({
|
|
1624
|
+
nodeId: ctx.sourceNodeId,
|
|
1625
|
+
grantedKey,
|
|
1626
|
+
networkKey
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
grantedKey;
|
|
1630
|
+
networkKey;
|
|
1631
|
+
serialize(ctx) {
|
|
1632
|
+
this.payload = import_safe2.Bytes.concat([
|
|
1633
|
+
securityClassToBitMask(this.grantedKey),
|
|
1634
|
+
this.networkKey
|
|
1635
|
+
]);
|
|
1636
|
+
return super.serialize(ctx);
|
|
1637
|
+
}
|
|
1638
|
+
toLogEntry(ctx) {
|
|
1639
|
+
return {
|
|
1640
|
+
...super.toLogEntry(ctx),
|
|
1641
|
+
message: {
|
|
1642
|
+
"security class": (0, import_safe3.getEnumMemberName)(import_core.SecurityClass, this.grantedKey)
|
|
1643
|
+
// This shouldn't be logged, so users can safely post their logs online
|
|
1644
|
+
// "network key": buffer2hex(this.networkKey),
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
return Security2CCNetworkKeyReport2 = _classThis;
|
|
1650
|
+
})();
|
|
1651
|
+
let Security2CCNetworkKeyGet = (() => {
|
|
1652
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.NetworkKeyGet)];
|
|
1653
|
+
let _classDescriptor;
|
|
1654
|
+
let _classExtraInitializers = [];
|
|
1655
|
+
let _classThis;
|
|
1656
|
+
let _classSuper = Security2CC;
|
|
1657
|
+
var Security2CCNetworkKeyGet2 = class extends _classSuper {
|
|
1658
|
+
static {
|
|
1659
|
+
_classThis = this;
|
|
1660
|
+
}
|
|
1661
|
+
static {
|
|
1662
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1663
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1664
|
+
Security2CCNetworkKeyGet2 = _classThis = _classDescriptor.value;
|
|
1665
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1666
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1667
|
+
}
|
|
1668
|
+
constructor(options) {
|
|
1669
|
+
super(options);
|
|
1670
|
+
this.requestedKey = options.requestedKey;
|
|
1671
|
+
}
|
|
1672
|
+
static from(raw, ctx) {
|
|
1673
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1674
|
+
const requestedKey = bitMaskToSecurityClass(raw.payload, 0);
|
|
1675
|
+
return new this({
|
|
1676
|
+
nodeId: ctx.sourceNodeId,
|
|
1677
|
+
requestedKey
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
requestedKey;
|
|
1681
|
+
serialize(ctx) {
|
|
1682
|
+
this.payload = securityClassToBitMask(this.requestedKey);
|
|
1683
|
+
return super.serialize(ctx);
|
|
1684
|
+
}
|
|
1685
|
+
toLogEntry(ctx) {
|
|
1686
|
+
return {
|
|
1687
|
+
...super.toLogEntry(ctx),
|
|
1688
|
+
message: {
|
|
1689
|
+
"security class": (0, import_safe3.getEnumMemberName)(import_core.SecurityClass, this.requestedKey)
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
return Security2CCNetworkKeyGet2 = _classThis;
|
|
1695
|
+
})();
|
|
1696
|
+
let Security2CCNetworkKeyVerify = (() => {
|
|
1697
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.NetworkKeyVerify)];
|
|
1698
|
+
let _classDescriptor;
|
|
1699
|
+
let _classExtraInitializers = [];
|
|
1700
|
+
let _classThis;
|
|
1701
|
+
let _classSuper = Security2CC;
|
|
1702
|
+
var Security2CCNetworkKeyVerify2 = class extends _classSuper {
|
|
1703
|
+
static {
|
|
1704
|
+
_classThis = this;
|
|
1705
|
+
}
|
|
1706
|
+
static {
|
|
1707
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1708
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1709
|
+
Security2CCNetworkKeyVerify2 = _classThis = _classDescriptor.value;
|
|
1710
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1711
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
return Security2CCNetworkKeyVerify2 = _classThis;
|
|
1715
|
+
})();
|
|
1716
|
+
let Security2CCTransferEnd = (() => {
|
|
1717
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.TransferEnd)];
|
|
1718
|
+
let _classDescriptor;
|
|
1719
|
+
let _classExtraInitializers = [];
|
|
1720
|
+
let _classThis;
|
|
1721
|
+
let _classSuper = Security2CC;
|
|
1722
|
+
var Security2CCTransferEnd2 = class extends _classSuper {
|
|
1723
|
+
static {
|
|
1724
|
+
_classThis = this;
|
|
1725
|
+
}
|
|
1726
|
+
static {
|
|
1727
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1728
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1729
|
+
Security2CCTransferEnd2 = _classThis = _classDescriptor.value;
|
|
1730
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1731
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1732
|
+
}
|
|
1733
|
+
constructor(options) {
|
|
1734
|
+
super(options);
|
|
1735
|
+
this.keyVerified = options.keyVerified;
|
|
1736
|
+
this.keyRequestComplete = options.keyRequestComplete;
|
|
1737
|
+
}
|
|
1738
|
+
static from(raw, ctx) {
|
|
1739
|
+
(0, import_core.validatePayload)(raw.payload.length >= 1);
|
|
1740
|
+
const keyVerified = !!(raw.payload[0] & 2);
|
|
1741
|
+
const keyRequestComplete = !!(raw.payload[0] & 1);
|
|
1742
|
+
return new this({
|
|
1743
|
+
nodeId: ctx.sourceNodeId,
|
|
1744
|
+
keyVerified,
|
|
1745
|
+
keyRequestComplete
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
keyVerified;
|
|
1749
|
+
keyRequestComplete;
|
|
1750
|
+
serialize(ctx) {
|
|
1751
|
+
this.payload = import_safe2.Bytes.from([
|
|
1752
|
+
(this.keyVerified ? 2 : 0) + (this.keyRequestComplete ? 1 : 0)
|
|
1753
|
+
]);
|
|
1754
|
+
return super.serialize(ctx);
|
|
1755
|
+
}
|
|
1756
|
+
toLogEntry(ctx) {
|
|
1757
|
+
return {
|
|
1758
|
+
...super.toLogEntry(ctx),
|
|
1759
|
+
message: {
|
|
1760
|
+
"key verified": this.keyVerified,
|
|
1761
|
+
"request complete": this.keyRequestComplete
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
return Security2CCTransferEnd2 = _classThis;
|
|
1767
|
+
})();
|
|
1768
|
+
let Security2CCCommandsSupportedReport = (() => {
|
|
1769
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.CommandsSupportedReport)];
|
|
1770
|
+
let _classDescriptor;
|
|
1771
|
+
let _classExtraInitializers = [];
|
|
1772
|
+
let _classThis;
|
|
1773
|
+
let _classSuper = Security2CC;
|
|
1774
|
+
var Security2CCCommandsSupportedReport2 = class extends _classSuper {
|
|
1775
|
+
static {
|
|
1776
|
+
_classThis = this;
|
|
1777
|
+
}
|
|
1778
|
+
static {
|
|
1779
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1780
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1781
|
+
Security2CCCommandsSupportedReport2 = _classThis = _classDescriptor.value;
|
|
1782
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1783
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1784
|
+
}
|
|
1785
|
+
constructor(options) {
|
|
1786
|
+
super(options);
|
|
1787
|
+
this.supportedCCs = options.supportedCCs;
|
|
1788
|
+
}
|
|
1789
|
+
static from(raw, ctx) {
|
|
1790
|
+
const CCs = (0, import_core.parseCCList)(raw.payload);
|
|
1791
|
+
const supportedCCs = CCs.supportedCCs;
|
|
1792
|
+
return new this({
|
|
1793
|
+
nodeId: ctx.sourceNodeId,
|
|
1794
|
+
supportedCCs
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
supportedCCs;
|
|
1798
|
+
serialize(ctx) {
|
|
1799
|
+
this.payload = (0, import_safe.encodeCCList)(this.supportedCCs, []);
|
|
1800
|
+
return super.serialize(ctx);
|
|
1801
|
+
}
|
|
1802
|
+
toLogEntry(ctx) {
|
|
1803
|
+
return {
|
|
1804
|
+
...super.toLogEntry(ctx),
|
|
1805
|
+
message: {
|
|
1806
|
+
"supported CCs": this.supportedCCs.map((cc) => (0, import_core.getCCName)(cc)).map((cc) => `
|
|
1556
1807
|
\xB7 ${cc}`).join("")
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
let
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
return Security2CCCommandsSupportedReport2 = _classThis;
|
|
1813
|
+
})();
|
|
1814
|
+
let Security2CCCommandsSupportedGet = (() => {
|
|
1815
|
+
let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.Security2Command.CommandsSupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(Security2CCCommandsSupportedReport)];
|
|
1816
|
+
let _classDescriptor;
|
|
1817
|
+
let _classExtraInitializers = [];
|
|
1818
|
+
let _classThis;
|
|
1819
|
+
let _classSuper = Security2CC;
|
|
1820
|
+
var Security2CCCommandsSupportedGet2 = class extends _classSuper {
|
|
1821
|
+
static {
|
|
1822
|
+
_classThis = this;
|
|
1823
|
+
}
|
|
1824
|
+
static {
|
|
1825
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1826
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1827
|
+
Security2CCCommandsSupportedGet2 = _classThis = _classDescriptor.value;
|
|
1828
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1829
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1830
|
+
}
|
|
1831
|
+
};
|
|
1832
|
+
return Security2CCCommandsSupportedGet2 = _classThis;
|
|
1833
|
+
})();
|
|
1570
1834
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1571
1835
|
0 && (module.exports = {
|
|
1572
1836
|
Security2CC,
|