@zwave-js/cc 14.3.9 → 15.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.d.ts +139 -57
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationCC.d.ts +178 -43
- package/build/cjs/cc/AssociationCC.js +0 -4
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.d.ts +138 -38
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.d.ts +275 -73
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.d.ts +316 -71
- package/build/cjs/cc/BasicCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.d.ts +759 -164
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySensorCC.d.ts +91 -26
- package/build/cjs/cc/BinarySensorCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +190 -38
- package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
- package/build/cjs/cc/CRC16CC.d.ts +4 -8
- package/build/cjs/cc/CRC16CC.js +4 -27
- package/build/cjs/cc/CRC16CC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.d.ts +272 -53
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +150 -37
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.d.ts +3 -3
- package/build/cjs/cc/ClockCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.d.ts +423 -96
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC._validateArgs.js +1 -1
- package/build/cjs/cc/ConfigurationCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/ConfigurationCC.d.ts +101 -37
- package/build/cjs/cc/ConfigurationCC.js +0 -8
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DeviceResetLocallyCC.d.ts +1 -1
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC._validateArgs.js +1 -1
- package/build/cjs/cc/DoorLockCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/DoorLockCC.d.ts +1731 -419
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +64 -12
- package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
- package/build/cjs/cc/EnergyProductionCC.d.ts +29 -14
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +308 -57
- package/build/cjs/cc/EntryControlCC.js.map +2 -2
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +2 -0
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.js +26 -0
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +393 -67
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +155 -12
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.d.ts +125 -27
- package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +64 -18
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +116 -39
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
- package/build/cjs/cc/InclusionControllerCC.d.ts +4 -4
- package/build/cjs/cc/InclusionControllerCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +325 -83
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.d.ts +2170 -683
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/LanguageCC.d.ts +128 -26
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/LockCC.d.ts +64 -14
- package/build/cjs/cc/LockCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +2 -2
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.d.ts +219 -57
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.d.ts +364 -89
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +138 -40
- package/build/cjs/cc/MultiChannelAssociationCC.js +0 -5
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +469 -99
- package/build/cjs/cc/MultiChannelCC.js +8 -72
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultiCommandCC.d.ts +4 -8
- package/build/cjs/cc/MultiCommandCC.js +4 -37
- package/build/cjs/cc/MultiCommandCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.d.ts +118 -33
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +490 -125
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.d.ts +128 -26
- package/build/cjs/cc/NodeNamingCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.d.ts +603 -161
- package/build/cjs/cc/NotificationCC.js +12 -1
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/PowerlevelCC.d.ts +6 -6
- package/build/cjs/cc/PowerlevelCC.js.map +2 -2
- package/build/cjs/cc/ProtectionCC.d.ts +496 -94
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActivationCC.d.ts +127 -28
- package/build/cjs/cc/SceneActivationCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +52 -25
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +53 -25
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.d.ts +268 -64
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.d.ts +15 -21
- package/build/cjs/cc/Security2CC.js +35 -347
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.d.ts +12 -19
- package/build/cjs/cc/SecurityCC.js +12 -106
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.d.ts +253 -64
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.d.ts +28 -16
- package/build/cjs/cc/SupervisionCC.js +4 -29
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.d.ts +187 -38
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +64 -18
- package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.d.ts +189 -40
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +65 -19
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetbackCC.d.ts +4 -4
- package/build/cjs/cc/ThermostatSetbackCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.d.ts +116 -36
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/TimeCC.d.ts +6 -6
- package/build/cjs/cc/TimeCC.js.map +2 -2
- package/build/cjs/cc/TimeParametersCC.d.ts +63 -12
- package/build/cjs/cc/TimeParametersCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.d.ts +7 -12
- package/build/cjs/cc/TransportServiceCC.js +3 -20
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC._validateArgs.js +1 -1
- package/build/cjs/cc/UserCodeCC._validateArgs.js.map +1 -1
- package/build/cjs/cc/UserCodeCC.d.ts +931 -176
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.d.ts +897 -185
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.d.ts +190 -38
- package/build/cjs/cc/WakeUpCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.d.ts +193 -103
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.d.ts +311 -51
- package/build/cjs/cc/ZWavePlusCC.js.map +2 -2
- package/build/cjs/cc/ZWaveProtocolCC.d.ts +28 -28
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +4 -4
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index_browser.d.ts +9 -0
- package/build/cjs/index_browser.js +41 -1
- package/build/cjs/index_browser.js.map +2 -2
- package/build/cjs/lib/API.d.ts +7 -5
- package/build/cjs/lib/API.js +1 -1
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +10 -21
- package/build/cjs/lib/CommandClass.js +51 -106
- package/build/cjs/lib/CommandClass.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +1 -1
- package/build/cjs/lib/CommandClassDecorators.js +3 -3
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Values.d.ts +2 -2
- package/build/cjs/lib/Values.js.map +2 -2
- package/build/cjs/lib/traits.d.ts +94 -0
- package/build/cjs/lib/traits.js +17 -0
- package/build/cjs/lib/traits.js.map +7 -0
- package/build/cjs/lib/utils.d.ts +2 -2
- package/build/cjs/lib/utils.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.d.ts +139 -57
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +0 -1
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +178 -43
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +0 -13
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts +138 -38
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +0 -6
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +275 -73
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +0 -3
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +316 -71
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +0 -2
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +759 -164
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +1 -2
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts +91 -26
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +0 -3
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +190 -38
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +0 -2
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts +4 -8
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +4 -34
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts +272 -53
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +0 -1
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +150 -37
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +0 -3
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts +3 -3
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +0 -1
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts +423 -96
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +0 -6
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC._validateArgs.js +1 -1
- package/build/esm/cc/ConfigurationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +101 -37
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +0 -25
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC._validateArgs.js +1 -1
- package/build/esm/cc/DoorLockCC._validateArgs.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts +1731 -419
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +0 -2
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +64 -12
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +0 -1
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts +29 -14
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +0 -2
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +308 -57
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +0 -1
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +2 -0
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.js +20 -0
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +393 -67
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +159 -34
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts +125 -27
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +0 -1
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +64 -18
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +116 -39
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +0 -4
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.d.ts +4 -4
- package/build/esm/cc/InclusionControllerCC.d.ts.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js +0 -2
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +325 -83
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +0 -7
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +2170 -683
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +0 -9
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +128 -26
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +0 -1
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +64 -14
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +0 -1
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts +2 -2
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +0 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts +219 -57
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +0 -2
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts +364 -89
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +0 -4
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +138 -40
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +0 -16
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +469 -99
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +8 -101
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.d.ts +4 -8
- package/build/esm/cc/MultiCommandCC.d.ts.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +4 -38
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts +118 -33
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +0 -5
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +490 -125
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +0 -4
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts +128 -26
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +0 -2
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts +603 -161
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +18 -12
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.d.ts +6 -6
- package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +0 -4
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts +496 -94
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +0 -3
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts +127 -28
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +0 -1
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +52 -25
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +0 -2
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +53 -25
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +0 -2
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts +268 -64
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +0 -14
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts +15 -21
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +31 -475
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts +12 -19
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +13 -138
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +253 -64
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +0 -7
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +28 -16
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +4 -34
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts +187 -38
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +0 -1
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +64 -18
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts +189 -40
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +0 -3
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +65 -19
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.d.ts +4 -4
- package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +0 -2
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts +116 -36
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +0 -6
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts +6 -6
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +0 -4
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts +63 -12
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +0 -1
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts +7 -12
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +5 -38
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC._validateArgs.js +1 -1
- package/build/esm/cc/UserCodeCC._validateArgs.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +931 -176
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +0 -12
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +897 -185
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +0 -4
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +190 -38
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +0 -1
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +193 -103
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +0 -5
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts +311 -51
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +0 -1
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts +28 -28
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +0 -27
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +4 -4
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +0 -3
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index_browser.d.ts +9 -0
- package/build/esm/index_browser.d.ts.map +1 -1
- package/build/esm/index_browser.js +8 -1
- package/build/esm/index_browser.js.map +1 -1
- package/build/esm/lib/API.d.ts +7 -5
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +10 -21
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +8 -101
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +1 -1
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Values.d.ts +2 -2
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/traits.d.ts +94 -0
- package/build/esm/lib/traits.d.ts.map +1 -0
- package/build/esm/lib/traits.js +2 -0
- package/build/esm/lib/traits.js.map +1 -0
- package/build/esm/lib/utils.d.ts +2 -2
- package/build/esm/lib/utils.d.ts.map +1 -1
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +13 -13
|
@@ -32,7 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { CommandClasses, MPANState, MessagePriority, SPANState, SecurityClass, TransmitOptions, ZWaveError, ZWaveErrorCodes,
|
|
35
|
+
import { CommandClasses, MPANState, MessagePriority, SPANState, SecurityClass, TransmitOptions, ZWaveError, ZWaveErrorCodes, decryptAES128CCM, encodeBitMask, encryptAES128CCM, getCCName, highResTimestamp, isLongRangeNodeId, isTransmissionError, isZWaveError, parseBitMask, parseCCList, securityClassIsS2, securityClassOrder, validatePayload, } from "@zwave-js/core";
|
|
36
36
|
import { EncapsulationFlags, NODE_ID_BROADCAST, NODE_ID_BROADCAST_LR, encodeCCList, } from "@zwave-js/core/safe";
|
|
37
37
|
import { Bytes } from "@zwave-js/shared/safe";
|
|
38
38
|
import { buffer2hex, getEnumMemberName, pick } from "@zwave-js/shared/safe";
|
|
@@ -111,143 +111,18 @@ function assertSecurityTX(ctx, destination) {
|
|
|
111
111
|
}
|
|
112
112
|
return ret;
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
function decryptSinglecastSync(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
|
|
116
|
-
const decryptWithNonce = (nonce) => {
|
|
117
|
-
const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
|
|
118
|
-
const iv = nonce;
|
|
119
|
-
return {
|
|
120
|
-
key,
|
|
121
|
-
iv,
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
123
|
-
...decryptAES128CCMSync(key, iv, ciphertext, authData, authTag),
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
const getNonceAndDecrypt = () => {
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
128
|
-
const iv = securityManager.nextNonce(sendingNodeId);
|
|
129
|
-
return decryptWithNonce(iv);
|
|
130
|
-
};
|
|
131
|
-
if (spanState.type === SPANState.SPAN) {
|
|
132
|
-
// There SHOULD be a shared SPAN between both parties. But experience has shown that both could have
|
|
133
|
-
// sent a command at roughly the same time, using the same SPAN for encryption.
|
|
134
|
-
// To avoid a nasty desync and both nodes trying to resync at the same time, causing message loss,
|
|
135
|
-
// we accept commands encrypted with the previous SPAN under very specific circumstances:
|
|
136
|
-
if (
|
|
137
|
-
// The previous SPAN is still known, i.e. the node didn't send another command that was successfully decrypted
|
|
138
|
-
!!spanState.currentSPAN
|
|
139
|
-
// it is still valid
|
|
140
|
-
&& spanState.currentSPAN.expires > highResTimestamp()
|
|
141
|
-
// The received command is exactly the next, expected one
|
|
142
|
-
&& prevSequenceNumber != undefined
|
|
143
|
-
&& curSequenceNumber === ((prevSequenceNumber + 1) & 0xff)
|
|
144
|
-
// And in case of a mock-based test, do this only on the controller
|
|
145
|
-
&& !ctx.__internalIsMockNode) {
|
|
146
|
-
const nonce = spanState.currentSPAN.nonce;
|
|
147
|
-
spanState.currentSPAN = undefined;
|
|
148
|
-
// If we could decrypt this way, we're done...
|
|
149
|
-
const result = decryptWithNonce(nonce);
|
|
150
|
-
if (result.authOK) {
|
|
151
|
-
return {
|
|
152
|
-
...result,
|
|
153
|
-
securityClass: spanState.securityClass,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
// ...otherwise, we need to try the normal way
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
// forgetting the current SPAN shouldn't be necessary but better be safe than sorry
|
|
160
|
-
spanState.currentSPAN = undefined;
|
|
161
|
-
}
|
|
162
|
-
// This can only happen if the security class is known
|
|
163
|
-
return {
|
|
164
|
-
...getNonceAndDecrypt(),
|
|
165
|
-
securityClass: spanState.securityClass,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
else if (spanState.type === SPANState.LocalEI) {
|
|
169
|
-
// We've sent the other our receiver's EI and received its sender's EI,
|
|
170
|
-
// meaning we can now establish an SPAN
|
|
171
|
-
const senderEI = getSenderEI(extensions);
|
|
172
|
-
if (!senderEI)
|
|
173
|
-
failNoSPAN();
|
|
174
|
-
const receiverEI = spanState.receiverEI;
|
|
175
|
-
// How we do this depends on whether we know the security class of the other node
|
|
176
|
-
const isBootstrappingNode = securityManager.tempKeys.has(sendingNodeId);
|
|
177
|
-
if (isBootstrappingNode) {
|
|
178
|
-
// We're currently bootstrapping the node, it might be using a temporary key
|
|
179
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
180
|
-
securityManager.initializeTempSPAN(sendingNodeId, senderEI, receiverEI);
|
|
181
|
-
const ret = getNonceAndDecrypt();
|
|
182
|
-
// Decryption with the temporary key worked
|
|
183
|
-
if (ret.authOK) {
|
|
184
|
-
return {
|
|
185
|
-
...ret,
|
|
186
|
-
securityClass: SecurityClass.Temporary,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
// Reset the SPAN state and try with the recently granted security class
|
|
190
|
-
securityManager.setSPANState(sendingNodeId, spanState);
|
|
191
|
-
}
|
|
192
|
-
// When ending up here, one of two situations has occured:
|
|
193
|
-
// a) We've taken over an existing network and do not know the node's security class
|
|
194
|
-
// b) We know the security class, but we're about to establish a new SPAN. This may happen at a lower
|
|
195
|
-
// security class than the one the node normally uses, e.g. when we're being queried for securely
|
|
196
|
-
// supported CCs.
|
|
197
|
-
// In both cases, we should simply try decoding with multiple security classes, starting from the highest one.
|
|
198
|
-
// If this fails, we restore the previous (partial) SPAN state.
|
|
199
|
-
// Try all security classes where we do not definitely know that it was not granted
|
|
200
|
-
// While bootstrapping a node, we consider the key that is being exchanged (including S0) to be the highest. No need to look at others
|
|
201
|
-
const possibleSecurityClasses = isBootstrappingNode
|
|
202
|
-
? [ctx.getHighestSecurityClass(sendingNodeId)]
|
|
203
|
-
: securityClassOrder.filter((s) => ctx.hasSecurityClass(sendingNodeId, s)
|
|
204
|
-
!== false);
|
|
205
|
-
for (const secClass of possibleSecurityClasses) {
|
|
206
|
-
// Skip security classes we don't have keys for
|
|
207
|
-
if (!securityManager.hasKeysForSecurityClass(secClass)) {
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
// Initialize an SPAN with that security class
|
|
211
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
212
|
-
securityManager.initializeSPAN(sendingNodeId, secClass, senderEI, receiverEI);
|
|
213
|
-
const ret = getNonceAndDecrypt();
|
|
214
|
-
// It worked, return the result
|
|
215
|
-
if (ret.authOK) {
|
|
216
|
-
// Also if we weren't sure before, we now know that the security class is granted
|
|
217
|
-
if (ctx.hasSecurityClass(sendingNodeId, secClass)
|
|
218
|
-
=== undefined) {
|
|
219
|
-
ctx.setSecurityClass(sendingNodeId, secClass, true);
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
...ret,
|
|
223
|
-
securityClass: secClass,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
// Reset the SPAN state and try with the next security class
|
|
228
|
-
securityManager.setSPANState(sendingNodeId, spanState);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
// Nothing worked, fail the decryption
|
|
233
|
-
return {
|
|
234
|
-
plaintext: new Uint8Array(),
|
|
235
|
-
authOK: false,
|
|
236
|
-
securityClass: undefined,
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
|
|
114
|
+
async function decryptSinglecast(ctx, securityManager, sendingNodeId, curSequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions) {
|
|
240
115
|
const decryptWithNonce = async (nonce) => {
|
|
241
116
|
const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
|
|
242
117
|
const iv = nonce;
|
|
243
118
|
return {
|
|
244
119
|
key,
|
|
245
120
|
iv,
|
|
246
|
-
...(await
|
|
121
|
+
...(await decryptAES128CCM(ciphertext, key, iv, authData, authTag)),
|
|
247
122
|
};
|
|
248
123
|
};
|
|
249
124
|
const getNonceAndDecrypt = async () => {
|
|
250
|
-
const iv = await securityManager.
|
|
125
|
+
const iv = await securityManager.nextNonce(sendingNodeId);
|
|
251
126
|
return decryptWithNonce(iv);
|
|
252
127
|
};
|
|
253
128
|
if (spanState.type === SPANState.SPAN) {
|
|
@@ -298,7 +173,7 @@ async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSe
|
|
|
298
173
|
const isBootstrappingNode = securityManager.tempKeys.has(sendingNodeId);
|
|
299
174
|
if (isBootstrappingNode) {
|
|
300
175
|
// We're currently bootstrapping the node, it might be using a temporary key
|
|
301
|
-
await securityManager.
|
|
176
|
+
await securityManager.initializeTempSPAN(sendingNodeId, senderEI, receiverEI);
|
|
302
177
|
const ret = await getNonceAndDecrypt();
|
|
303
178
|
// Decryption with the temporary key worked
|
|
304
179
|
if (ret.authOK) {
|
|
@@ -329,7 +204,7 @@ async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSe
|
|
|
329
204
|
continue;
|
|
330
205
|
}
|
|
331
206
|
// Initialize an SPAN with that security class
|
|
332
|
-
await securityManager.
|
|
207
|
+
await securityManager.initializeSPAN(sendingNodeId, secClass, senderEI, receiverEI);
|
|
333
208
|
const ret = await getNonceAndDecrypt();
|
|
334
209
|
// It worked, return the result
|
|
335
210
|
if (ret.authOK) {
|
|
@@ -356,27 +231,13 @@ async function decryptSinglecastAsync(ctx, securityManager, sendingNodeId, curSe
|
|
|
356
231
|
securityClass: undefined,
|
|
357
232
|
};
|
|
358
233
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
362
|
-
const iv = securityManager.nextPeerMPAN(sendingNodeId, groupId);
|
|
363
|
-
const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
|
|
364
|
-
return {
|
|
365
|
-
key,
|
|
366
|
-
iv,
|
|
367
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
368
|
-
...decryptAES128CCMSync(key, iv, ciphertext, authData, authTag),
|
|
369
|
-
// The security class is irrelevant when decrypting multicast commands
|
|
370
|
-
securityClass: undefined,
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
async function decryptMulticastAsync(sendingNodeId, securityManager, groupId, ciphertext, authData, authTag) {
|
|
374
|
-
const iv = await securityManager.nextPeerMPANAsync(sendingNodeId, groupId);
|
|
234
|
+
async function decryptMulticast(sendingNodeId, securityManager, groupId, ciphertext, authData, authTag) {
|
|
235
|
+
const iv = await securityManager.nextPeerMPAN(sendingNodeId, groupId);
|
|
375
236
|
const { keyCCM: key } = securityManager.getKeysForNode(sendingNodeId);
|
|
376
237
|
return {
|
|
377
238
|
key,
|
|
378
239
|
iv,
|
|
379
|
-
...(await
|
|
240
|
+
...(await decryptAES128CCM(ciphertext, key, iv, authData, authTag)),
|
|
380
241
|
// The security class is irrelevant when decrypting multicast commands
|
|
381
242
|
securityClass: undefined,
|
|
382
243
|
};
|
|
@@ -503,7 +364,7 @@ let Security2CCAPI = (() => {
|
|
|
503
364
|
if (!securityManager) {
|
|
504
365
|
throw new ZWaveError(`Nonces can only be sent if secure communication is set up!`, ZWaveErrorCodes.Driver_NoSecurity);
|
|
505
366
|
}
|
|
506
|
-
const receiverEI = await securityManager.
|
|
367
|
+
const receiverEI = await securityManager.generateNonce(this.endpoint.nodeId);
|
|
507
368
|
const cc = new Security2CCNonceReport({
|
|
508
369
|
nodeId: this.endpoint.nodeId,
|
|
509
370
|
endpointIndex: this.endpoint.index,
|
|
@@ -1123,8 +984,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1123
984
|
throw new ZWaveError("Multicast Security S2 encapsulation requires the MGRP extension", ZWaveErrorCodes.Security2CC_MissingExtension);
|
|
1124
985
|
}
|
|
1125
986
|
}
|
|
1126
|
-
|
|
1127
|
-
static from(raw, ctx) {
|
|
987
|
+
static async from(raw, ctx) {
|
|
1128
988
|
const securityManager = assertSecurityRX(ctx);
|
|
1129
989
|
validatePayload(raw.payload.length >= 2);
|
|
1130
990
|
// Check the sequence number to avoid duplicates
|
|
@@ -1161,12 +1021,10 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1161
1021
|
// we still need to increment the SPAN or MPAN state
|
|
1162
1022
|
if (mustDiscardCommand) {
|
|
1163
1023
|
if (mcctx.isMulticast) {
|
|
1164
|
-
|
|
1165
|
-
securityManager.nextPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
1024
|
+
await securityManager.nextPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
1166
1025
|
}
|
|
1167
1026
|
else {
|
|
1168
|
-
|
|
1169
|
-
securityManager.nextNonce(ctx.sourceNodeId);
|
|
1027
|
+
await securityManager.nextNonce(ctx.sourceNodeId);
|
|
1170
1028
|
}
|
|
1171
1029
|
validatePayload.fail("Invalid S2 extension");
|
|
1172
1030
|
}
|
|
@@ -1198,9 +1056,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1198
1056
|
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
|
|
1199
1057
|
failNoMPAN();
|
|
1200
1058
|
}
|
|
1201
|
-
decrypt = () =>
|
|
1202
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1203
|
-
decryptMulticastSync(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
|
|
1059
|
+
decrypt = () => decryptMulticast(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
|
|
1204
1060
|
}
|
|
1205
1061
|
else {
|
|
1206
1062
|
// Decrypt payload and verify integrity
|
|
@@ -1214,191 +1070,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1214
1070
|
// For now, do the same as if we didn't have any EI
|
|
1215
1071
|
failNoSPAN();
|
|
1216
1072
|
}
|
|
1217
|
-
decrypt = () =>
|
|
1218
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1219
|
-
decryptSinglecastSync(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
1220
|
-
}
|
|
1221
|
-
let plaintext;
|
|
1222
|
-
let authOK = false;
|
|
1223
|
-
let key;
|
|
1224
|
-
let iv;
|
|
1225
|
-
let decryptionSecurityClass;
|
|
1226
|
-
// If the Receiver is unable to authenticate the singlecast message with the current SPAN,
|
|
1227
|
-
// the Receiver SHOULD try decrypting the message with one or more of the following SPAN values,
|
|
1228
|
-
// stopping when decryption is successful or the maximum number of iterations is reached.
|
|
1229
|
-
// If the Receiver is unable to decrypt the S2 MC frame with the current MPAN, the Receiver MAY try
|
|
1230
|
-
// decrypting the frame with one or more of the subsequent MPAN values, stopping when decryption is
|
|
1231
|
-
// successful or the maximum number of iterations is reached.
|
|
1232
|
-
const decryptAttempts = mcctx.isMulticast
|
|
1233
|
-
? MAX_DECRYPT_ATTEMPTS_MULTICAST
|
|
1234
|
-
: mcctx.groupId != undefined
|
|
1235
|
-
? MAX_DECRYPT_ATTEMPTS_SC_FOLLOWUP
|
|
1236
|
-
: MAX_DECRYPT_ATTEMPTS_SINGLECAST;
|
|
1237
|
-
for (let i = 0; i < decryptAttempts; i++) {
|
|
1238
|
-
({
|
|
1239
|
-
plaintext,
|
|
1240
|
-
authOK,
|
|
1241
|
-
key,
|
|
1242
|
-
iv,
|
|
1243
|
-
securityClass: decryptionSecurityClass,
|
|
1244
|
-
} = decrypt());
|
|
1245
|
-
if (!!authOK && !!plaintext)
|
|
1246
|
-
break;
|
|
1247
|
-
// No need to try further SPANs if we just got the sender's EI
|
|
1248
|
-
if (!!getSenderEI(extensions))
|
|
1249
|
-
break;
|
|
1250
|
-
}
|
|
1251
|
-
// If authentication fails, do so with an error code that instructs the
|
|
1252
|
-
// applHost to tell the node we have no nonce
|
|
1253
|
-
if (!authOK || !plaintext) {
|
|
1254
|
-
if (mcctx.isMulticast) {
|
|
1255
|
-
// Mark the MPAN as out of sync
|
|
1256
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
|
|
1257
|
-
validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecodeMulticast);
|
|
1258
|
-
}
|
|
1259
|
-
else {
|
|
1260
|
-
validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecode);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
else if (!mcctx.isMulticast && mcctx.groupId != undefined) {
|
|
1264
|
-
// After reception of a singlecast followup, the MPAN state must be increased
|
|
1265
|
-
securityManager.tryIncrementPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
1266
|
-
}
|
|
1267
|
-
// Remember which security class was used to decrypt this message, so we can discard it later
|
|
1268
|
-
const securityClass = decryptionSecurityClass;
|
|
1269
|
-
offset = 0;
|
|
1270
|
-
if (hasEncryptedExtensions) {
|
|
1271
|
-
const parseResult = parseExtensions(plaintext, true);
|
|
1272
|
-
extensions.push(...parseResult.extensions);
|
|
1273
|
-
offset += parseResult.bytesRead;
|
|
1274
|
-
mustDiscardCommand = parseResult.mustDiscardCommand;
|
|
1275
|
-
}
|
|
1276
|
-
// Before we can continue, check if the command must be discarded
|
|
1277
|
-
if (mustDiscardCommand) {
|
|
1278
|
-
validatePayload.fail("Invalid extension");
|
|
1279
|
-
}
|
|
1280
|
-
// If the MPAN extension was received, store the MPAN
|
|
1281
|
-
if (!mcctx.isMulticast) {
|
|
1282
|
-
const mpanExtension = extensions.find((e) => e instanceof MPANExtension);
|
|
1283
|
-
if (mpanExtension) {
|
|
1284
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mpanExtension.groupId, {
|
|
1285
|
-
type: MPANState.MPAN,
|
|
1286
|
-
currentMPAN: mpanExtension.innerMPANState,
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
// Not every S2 message includes an encapsulated CC
|
|
1291
|
-
const decryptedCCBytes = plaintext.subarray(offset);
|
|
1292
|
-
let encapsulated;
|
|
1293
|
-
if (decryptedCCBytes.length > 0) {
|
|
1294
|
-
// make sure this contains a complete CC command that's worth splitting
|
|
1295
|
-
validatePayload(decryptedCCBytes.length >= 2);
|
|
1296
|
-
// and deserialize the CC
|
|
1297
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1298
|
-
encapsulated = CommandClass.parse(decryptedCCBytes, ctx);
|
|
1299
|
-
}
|
|
1300
|
-
const ret = new Security2CCMessageEncapsulation({
|
|
1301
|
-
nodeId: ctx.sourceNodeId,
|
|
1302
|
-
sequenceNumber,
|
|
1303
|
-
securityClass,
|
|
1304
|
-
extensions,
|
|
1305
|
-
encapsulated,
|
|
1306
|
-
});
|
|
1307
|
-
// Remember for debugging purposes
|
|
1308
|
-
ret.key = key;
|
|
1309
|
-
ret.iv = iv;
|
|
1310
|
-
ret.authData = authData;
|
|
1311
|
-
ret.authTag = authTag;
|
|
1312
|
-
ret.plaintext = decryptedCCBytes;
|
|
1313
|
-
return ret;
|
|
1314
|
-
}
|
|
1315
|
-
static async fromAsync(raw, ctx) {
|
|
1316
|
-
const securityManager = assertSecurityRX(ctx);
|
|
1317
|
-
validatePayload(raw.payload.length >= 2);
|
|
1318
|
-
// Check the sequence number to avoid duplicates
|
|
1319
|
-
const sequenceNumber = raw.payload[0];
|
|
1320
|
-
// Ensure the node has a security class
|
|
1321
|
-
validatePayload.withReason("No security class granted")(ctx.getHighestSecurityClass(ctx.sourceNodeId) !== SecurityClass.None);
|
|
1322
|
-
const hasExtensions = !!(raw.payload[1] & 0b1);
|
|
1323
|
-
const hasEncryptedExtensions = !!(raw.payload[1] & 0b10);
|
|
1324
|
-
let offset = 2;
|
|
1325
|
-
const extensions = [];
|
|
1326
|
-
let mustDiscardCommand = false;
|
|
1327
|
-
if (hasExtensions) {
|
|
1328
|
-
const parseResult = parseExtensions(raw.payload.subarray(offset), false);
|
|
1329
|
-
extensions.push(...parseResult.extensions);
|
|
1330
|
-
offset += parseResult.bytesRead;
|
|
1331
|
-
mustDiscardCommand = parseResult.mustDiscardCommand;
|
|
1332
|
-
}
|
|
1333
|
-
const mcctx = (() => {
|
|
1334
|
-
const multicastGroupId = getMulticastGroupId(extensions);
|
|
1335
|
-
if (ctx.frameType === "multicast" || ctx.frameType === "broadcast") {
|
|
1336
|
-
if (multicastGroupId == undefined) {
|
|
1337
|
-
validatePayload.fail("Multicast frames without MGRP extension");
|
|
1338
|
-
}
|
|
1339
|
-
return {
|
|
1340
|
-
isMulticast: true,
|
|
1341
|
-
groupId: multicastGroupId,
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
else {
|
|
1345
|
-
return { isMulticast: false, groupId: multicastGroupId };
|
|
1346
|
-
}
|
|
1347
|
-
})();
|
|
1348
|
-
// If a command is to be discarded before decryption,
|
|
1349
|
-
// we still need to increment the SPAN or MPAN state
|
|
1350
|
-
if (mustDiscardCommand) {
|
|
1351
|
-
if (mcctx.isMulticast) {
|
|
1352
|
-
await securityManager.nextPeerMPANAsync(ctx.sourceNodeId, mcctx.groupId);
|
|
1353
|
-
}
|
|
1354
|
-
else {
|
|
1355
|
-
await securityManager.nextNonceAsync(ctx.sourceNodeId);
|
|
1356
|
-
}
|
|
1357
|
-
validatePayload.fail("Invalid S2 extension");
|
|
1358
|
-
}
|
|
1359
|
-
let prevSequenceNumber;
|
|
1360
|
-
let mpanState;
|
|
1361
|
-
if (mcctx.isMulticast) {
|
|
1362
|
-
mpanState = securityManager.getPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
1363
|
-
}
|
|
1364
|
-
else {
|
|
1365
|
-
// Don't accept duplicate Singlecast commands
|
|
1366
|
-
prevSequenceNumber = validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
1367
|
-
// When a node receives a singlecast message after a multicast group was marked out of sync,
|
|
1368
|
-
// it must forget about the group.
|
|
1369
|
-
if (mcctx.groupId == undefined) {
|
|
1370
|
-
securityManager.resetOutOfSyncMPANs(ctx.sourceNodeId);
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
const unencryptedPayload = raw.payload.subarray(0, offset);
|
|
1374
|
-
const ciphertext = raw.payload.subarray(offset, -SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1375
|
-
const authTag = raw.payload.subarray(-SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1376
|
-
const messageLength = 2 /* CommandClass.computeEncapsulationOverhead() */
|
|
1377
|
-
+ raw.payload.length;
|
|
1378
|
-
const authData = getAuthenticationData(ctx.sourceNodeId, getDestinationIDRX(ctx, extensions), ctx.homeId, messageLength, unencryptedPayload);
|
|
1379
|
-
let decrypt;
|
|
1380
|
-
if (mcctx.isMulticast) {
|
|
1381
|
-
// For incoming multicast commands, make sure we have an MPAN
|
|
1382
|
-
if (mpanState?.type !== MPANState.MPAN) {
|
|
1383
|
-
// If we don't, mark the MPAN as out of sync, so we can respond accordingly on the singlecast followup
|
|
1384
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
|
|
1385
|
-
failNoMPAN();
|
|
1386
|
-
}
|
|
1387
|
-
decrypt = () => decryptMulticastAsync(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
|
|
1388
|
-
}
|
|
1389
|
-
else {
|
|
1390
|
-
// Decrypt payload and verify integrity
|
|
1391
|
-
const spanState = securityManager.getSPANState(ctx.sourceNodeId);
|
|
1392
|
-
// If we are not able to establish an SPAN yet, fail the decryption
|
|
1393
|
-
if (spanState.type === SPANState.None) {
|
|
1394
|
-
failNoSPAN();
|
|
1395
|
-
}
|
|
1396
|
-
else if (spanState.type === SPANState.RemoteEI) {
|
|
1397
|
-
// TODO: The specs are not clear how to handle this case
|
|
1398
|
-
// For now, do the same as if we didn't have any EI
|
|
1399
|
-
failNoSPAN();
|
|
1400
|
-
}
|
|
1401
|
-
decrypt = () => decryptSinglecastAsync(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
1073
|
+
decrypt = () => decryptSinglecast(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
1402
1074
|
}
|
|
1403
1075
|
let plaintext;
|
|
1404
1076
|
let authOK = false;
|
|
@@ -1459,6 +1131,11 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1459
1131
|
if (mustDiscardCommand) {
|
|
1460
1132
|
validatePayload.fail("Invalid extension");
|
|
1461
1133
|
}
|
|
1134
|
+
// The MPAN and MGRP extensions must not be sent together
|
|
1135
|
+
const mpanExtension = extensions.find((e) => e instanceof MPANExtension);
|
|
1136
|
+
if (mcctx.groupId != undefined && mpanExtension) {
|
|
1137
|
+
validatePayload.fail("Invalid combination of extensions");
|
|
1138
|
+
}
|
|
1462
1139
|
// If the MPAN extension was received, store the MPAN
|
|
1463
1140
|
if (!mcctx.isMulticast) {
|
|
1464
1141
|
const mpanExtension = extensions.find((e) => e instanceof MPANExtension);
|
|
@@ -1476,7 +1153,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1476
1153
|
// make sure this contains a complete CC command that's worth splitting
|
|
1477
1154
|
validatePayload(decryptedCCBytes.length >= 2);
|
|
1478
1155
|
// and deserialize the CC
|
|
1479
|
-
encapsulated = await CommandClass.
|
|
1156
|
+
encapsulated = await CommandClass.parse(decryptedCCBytes, ctx);
|
|
1480
1157
|
}
|
|
1481
1158
|
const ret = new Security2CCMessageEncapsulation({
|
|
1482
1159
|
nodeId: ctx.sourceNodeId,
|
|
@@ -1532,51 +1209,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1532
1209
|
getMulticastGroupId() {
|
|
1533
1210
|
return getMulticastGroupId(this.extensions);
|
|
1534
1211
|
}
|
|
1535
|
-
|
|
1536
|
-
maybeAddSPANExtensionSync(ctx, securityManager) {
|
|
1537
|
-
if (!this.isSinglecast())
|
|
1538
|
-
return;
|
|
1539
|
-
const receiverNodeId = this.nodeId;
|
|
1540
|
-
const spanState = securityManager.getSPANState(receiverNodeId);
|
|
1541
|
-
if (spanState.type === SPANState.None
|
|
1542
|
-
|| spanState.type === SPANState.LocalEI) {
|
|
1543
|
-
// Can't do anything here if we don't have the receiver's EI
|
|
1544
|
-
throw new ZWaveError(`Security S2 CC requires the receiver's nonce to be sent!`, ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1545
|
-
}
|
|
1546
|
-
else if (spanState.type === SPANState.RemoteEI) {
|
|
1547
|
-
// We have the receiver's EI, generate our input and send it over
|
|
1548
|
-
// With both, we can create an SPAN
|
|
1549
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1550
|
-
const senderEI = securityManager.generateNonce(undefined);
|
|
1551
|
-
const receiverEI = spanState.receiverEI;
|
|
1552
|
-
// While bootstrapping a node, prefer the temporary key, unless the
|
|
1553
|
-
// specific command specifies a security class
|
|
1554
|
-
if (this.securityClass == undefined
|
|
1555
|
-
&& securityManager.tempKeys.has(receiverNodeId)) {
|
|
1556
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1557
|
-
securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
|
|
1558
|
-
}
|
|
1559
|
-
else {
|
|
1560
|
-
const securityClass = this.securityClass
|
|
1561
|
-
?? ctx.getHighestSecurityClass(receiverNodeId);
|
|
1562
|
-
if (securityClass == undefined) {
|
|
1563
|
-
throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1564
|
-
}
|
|
1565
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1566
|
-
securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
|
|
1567
|
-
}
|
|
1568
|
-
// Add or update the SPAN extension
|
|
1569
|
-
let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
|
|
1570
|
-
if (spanExtension) {
|
|
1571
|
-
spanExtension.senderEI = senderEI;
|
|
1572
|
-
}
|
|
1573
|
-
else {
|
|
1574
|
-
spanExtension = new SPANExtension({ senderEI });
|
|
1575
|
-
this.extensions.push(spanExtension);
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
async maybeAddSPANExtensionAsync(ctx, securityManager) {
|
|
1212
|
+
async maybeAddSPANExtension(ctx, securityManager) {
|
|
1580
1213
|
if (!this.isSinglecast())
|
|
1581
1214
|
return;
|
|
1582
1215
|
const receiverNodeId = this.nodeId;
|
|
@@ -1589,13 +1222,13 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1589
1222
|
else if (spanState.type === SPANState.RemoteEI) {
|
|
1590
1223
|
// We have the receiver's EI, generate our input and send it over
|
|
1591
1224
|
// With both, we can create an SPAN
|
|
1592
|
-
const senderEI = await securityManager.
|
|
1225
|
+
const senderEI = await securityManager.generateNonce(undefined);
|
|
1593
1226
|
const receiverEI = spanState.receiverEI;
|
|
1594
1227
|
// While bootstrapping a node, prefer the temporary key, unless the
|
|
1595
1228
|
// specific command specifies a security class
|
|
1596
1229
|
if (this.securityClass == undefined
|
|
1597
1230
|
&& securityManager.tempKeys.has(receiverNodeId)) {
|
|
1598
|
-
await securityManager.
|
|
1231
|
+
await securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
|
|
1599
1232
|
}
|
|
1600
1233
|
else {
|
|
1601
1234
|
const securityClass = this.securityClass
|
|
@@ -1603,7 +1236,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1603
1236
|
if (securityClass == undefined) {
|
|
1604
1237
|
throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1605
1238
|
}
|
|
1606
|
-
await securityManager.
|
|
1239
|
+
await securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
|
|
1607
1240
|
}
|
|
1608
1241
|
// Add or update the SPAN extension
|
|
1609
1242
|
let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
|
|
@@ -1616,13 +1249,11 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1616
1249
|
}
|
|
1617
1250
|
}
|
|
1618
1251
|
}
|
|
1619
|
-
|
|
1620
|
-
serialize(ctx) {
|
|
1252
|
+
async serialize(ctx) {
|
|
1621
1253
|
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1622
1254
|
this.ensureSequenceNumber(securityManager);
|
|
1623
1255
|
// Include Sender EI in the command if we only have the receiver's EI
|
|
1624
|
-
|
|
1625
|
-
this.maybeAddSPANExtensionSync(ctx, securityManager);
|
|
1256
|
+
await this.maybeAddSPANExtension(ctx, securityManager);
|
|
1626
1257
|
const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
|
|
1627
1258
|
const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
|
|
1628
1259
|
const unencryptedPayload = Bytes.concat([
|
|
@@ -1633,8 +1264,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1633
1264
|
]),
|
|
1634
1265
|
...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
|
|
1635
1266
|
]);
|
|
1636
|
-
|
|
1637
|
-
const serializedCC = this.encapsulated?.serialize(ctx)
|
|
1267
|
+
const serializedCC = (await this.encapsulated?.serialize(ctx))
|
|
1638
1268
|
?? new Bytes();
|
|
1639
1269
|
const plaintextPayload = Bytes.concat([
|
|
1640
1270
|
...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
|
|
@@ -1651,8 +1281,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1651
1281
|
// Singlecast:
|
|
1652
1282
|
// Generate a nonce for encryption, and remember it to attempt decryption
|
|
1653
1283
|
// of potential in-flight messages from the target node.
|
|
1654
|
-
|
|
1655
|
-
iv = securityManager.nextNonce(this.nodeId, true);
|
|
1284
|
+
iv = await securityManager.nextNonce(this.nodeId, true);
|
|
1656
1285
|
const { keyCCM } =
|
|
1657
1286
|
// Prefer the overridden security class if it was given
|
|
1658
1287
|
this.securityClass != undefined
|
|
@@ -1662,13 +1291,11 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1662
1291
|
}
|
|
1663
1292
|
else {
|
|
1664
1293
|
// Multicast:
|
|
1665
|
-
|
|
1666
|
-
const keyAndIV = securityManager.getMulticastKeyAndIV(destinationTag);
|
|
1294
|
+
const keyAndIV = await securityManager.getMulticastKeyAndIV(destinationTag);
|
|
1667
1295
|
key = keyAndIV.key;
|
|
1668
1296
|
iv = keyAndIV.iv;
|
|
1669
1297
|
}
|
|
1670
|
-
|
|
1671
|
-
const { ciphertext: ciphertextPayload, authTag } = encryptAES128CCMSync(key, iv, plaintextPayload, authData, SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1298
|
+
const { ciphertext: ciphertextPayload, authTag } = await encryptAES128CCM(plaintextPayload, key, iv, authData, SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1672
1299
|
// Remember key and IV for debugging purposes
|
|
1673
1300
|
this.key = key;
|
|
1674
1301
|
this.iv = iv;
|
|
@@ -1680,69 +1307,8 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1680
1307
|
ciphertextPayload,
|
|
1681
1308
|
authTag,
|
|
1682
1309
|
]);
|
|
1683
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1684
1310
|
return super.serialize(ctx);
|
|
1685
1311
|
}
|
|
1686
|
-
async serializeAsync(ctx) {
|
|
1687
|
-
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1688
|
-
this.ensureSequenceNumber(securityManager);
|
|
1689
|
-
// Include Sender EI in the command if we only have the receiver's EI
|
|
1690
|
-
await this.maybeAddSPANExtensionAsync(ctx, securityManager);
|
|
1691
|
-
const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
|
|
1692
|
-
const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
|
|
1693
|
-
const unencryptedPayload = Bytes.concat([
|
|
1694
|
-
Bytes.from([
|
|
1695
|
-
this.sequenceNumber,
|
|
1696
|
-
(encryptedExtensions.length > 0 ? 0b10 : 0)
|
|
1697
|
-
| (unencryptedExtensions.length > 0 ? 1 : 0),
|
|
1698
|
-
]),
|
|
1699
|
-
...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
|
|
1700
|
-
]);
|
|
1701
|
-
const serializedCC = (await this.encapsulated?.serializeAsync(ctx))
|
|
1702
|
-
?? new Bytes();
|
|
1703
|
-
const plaintextPayload = Bytes.concat([
|
|
1704
|
-
...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
|
|
1705
|
-
serializedCC,
|
|
1706
|
-
]);
|
|
1707
|
-
// Generate the authentication data for CCM encryption
|
|
1708
|
-
const destinationTag = getDestinationIDTX.call(this);
|
|
1709
|
-
const messageLength = this.computeEncapsulationOverhead()
|
|
1710
|
-
+ serializedCC.length;
|
|
1711
|
-
const authData = getAuthenticationData(ctx.ownNodeId, destinationTag, ctx.homeId, messageLength, unencryptedPayload);
|
|
1712
|
-
let key;
|
|
1713
|
-
let iv;
|
|
1714
|
-
if (this.isSinglecast()) {
|
|
1715
|
-
// Singlecast:
|
|
1716
|
-
// Generate a nonce for encryption, and remember it to attempt decryption
|
|
1717
|
-
// of potential in-flight messages from the target node.
|
|
1718
|
-
iv = await securityManager.nextNonceAsync(this.nodeId, true);
|
|
1719
|
-
const { keyCCM } =
|
|
1720
|
-
// Prefer the overridden security class if it was given
|
|
1721
|
-
this.securityClass != undefined
|
|
1722
|
-
? securityManager.getKeysForSecurityClass(this.securityClass)
|
|
1723
|
-
: securityManager.getKeysForNode(this.nodeId);
|
|
1724
|
-
key = keyCCM;
|
|
1725
|
-
}
|
|
1726
|
-
else {
|
|
1727
|
-
// Multicast:
|
|
1728
|
-
const keyAndIV = await securityManager.getMulticastKeyAndIVAsync(destinationTag);
|
|
1729
|
-
key = keyAndIV.key;
|
|
1730
|
-
iv = keyAndIV.iv;
|
|
1731
|
-
}
|
|
1732
|
-
const { ciphertext: ciphertextPayload, authTag } = await encryptAES128CCMAsync(plaintextPayload, key, iv, authData, SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1733
|
-
// Remember key and IV for debugging purposes
|
|
1734
|
-
this.key = key;
|
|
1735
|
-
this.iv = iv;
|
|
1736
|
-
this.authData = authData;
|
|
1737
|
-
this.authTag = authTag;
|
|
1738
|
-
this.ciphertext = ciphertextPayload;
|
|
1739
|
-
this.payload = Bytes.concat([
|
|
1740
|
-
unencryptedPayload,
|
|
1741
|
-
ciphertextPayload,
|
|
1742
|
-
authTag,
|
|
1743
|
-
]);
|
|
1744
|
-
return super.serializeAsync(ctx);
|
|
1745
|
-
}
|
|
1746
1312
|
computeEncapsulationOverhead() {
|
|
1747
1313
|
// Security S2 adds:
|
|
1748
1314
|
// * 1 byte sequence number
|
|
@@ -1878,7 +1444,6 @@ let Security2CCNonceReport = (() => {
|
|
|
1878
1444
|
if (this.SOS) {
|
|
1879
1445
|
this.payload = Bytes.concat([this.payload, this.receiverEI]);
|
|
1880
1446
|
}
|
|
1881
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1882
1447
|
return super.serialize(ctx);
|
|
1883
1448
|
}
|
|
1884
1449
|
toLogEntry(ctx) {
|
|
@@ -1941,7 +1506,6 @@ let Security2CCNonceGet = (() => {
|
|
|
1941
1506
|
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1942
1507
|
this.ensureSequenceNumber(securityManager);
|
|
1943
1508
|
this.payload = Bytes.from([this.sequenceNumber]);
|
|
1944
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1945
1509
|
return super.serialize(ctx);
|
|
1946
1510
|
}
|
|
1947
1511
|
toLogEntry(ctx) {
|
|
@@ -2018,7 +1582,6 @@ let Security2CCKEXReport = (() => {
|
|
|
2018
1582
|
encodeBitMask(this.supportedECDHProfiles, 7, ECDHProfiles.Curve25519),
|
|
2019
1583
|
encodeBitMask(this.requestedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
|
|
2020
1584
|
]);
|
|
2021
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2022
1585
|
return super.serialize(ctx);
|
|
2023
1586
|
}
|
|
2024
1587
|
toLogEntry(ctx) {
|
|
@@ -2146,7 +1709,6 @@ let Security2CCKEXSet = (() => {
|
|
|
2146
1709
|
encodeBitMask([this.selectedECDHProfile], 7, ECDHProfiles.Curve25519),
|
|
2147
1710
|
encodeBitMask(this.grantedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
|
|
2148
1711
|
]);
|
|
2149
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2150
1712
|
return super.serialize(ctx);
|
|
2151
1713
|
}
|
|
2152
1714
|
toLogEntry(ctx) {
|
|
@@ -2197,7 +1759,6 @@ let Security2CCKEXFail = (() => {
|
|
|
2197
1759
|
failType;
|
|
2198
1760
|
serialize(ctx) {
|
|
2199
1761
|
this.payload = Bytes.from([this.failType]);
|
|
2200
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2201
1762
|
return super.serialize(ctx);
|
|
2202
1763
|
}
|
|
2203
1764
|
toLogEntry(ctx) {
|
|
@@ -2247,7 +1808,6 @@ let Security2CCPublicKeyReport = (() => {
|
|
|
2247
1808
|
Bytes.from([this.includingNode ? 1 : 0]),
|
|
2248
1809
|
this.publicKey,
|
|
2249
1810
|
]);
|
|
2250
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2251
1811
|
return super.serialize(ctx);
|
|
2252
1812
|
}
|
|
2253
1813
|
toLogEntry(ctx) {
|
|
@@ -2300,7 +1860,6 @@ let Security2CCNetworkKeyReport = (() => {
|
|
|
2300
1860
|
securityClassToBitMask(this.grantedKey),
|
|
2301
1861
|
this.networkKey,
|
|
2302
1862
|
]);
|
|
2303
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2304
1863
|
return super.serialize(ctx);
|
|
2305
1864
|
}
|
|
2306
1865
|
toLogEntry(ctx) {
|
|
@@ -2347,7 +1906,6 @@ let Security2CCNetworkKeyGet = (() => {
|
|
|
2347
1906
|
requestedKey;
|
|
2348
1907
|
serialize(ctx) {
|
|
2349
1908
|
this.payload = securityClassToBitMask(this.requestedKey);
|
|
2350
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2351
1909
|
return super.serialize(ctx);
|
|
2352
1910
|
}
|
|
2353
1911
|
toLogEntry(ctx) {
|
|
@@ -2417,7 +1975,6 @@ let Security2CCTransferEnd = (() => {
|
|
|
2417
1975
|
this.payload = Bytes.from([
|
|
2418
1976
|
(this.keyVerified ? 0b10 : 0) + (this.keyRequestComplete ? 0b1 : 0),
|
|
2419
1977
|
]);
|
|
2420
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2421
1978
|
return super.serialize(ctx);
|
|
2422
1979
|
}
|
|
2423
1980
|
toLogEntry(ctx) {
|
|
@@ -2467,7 +2024,6 @@ let Security2CCCommandsSupportedReport = (() => {
|
|
|
2467
2024
|
supportedCCs;
|
|
2468
2025
|
serialize(ctx) {
|
|
2469
2026
|
this.payload = encodeCCList(this.supportedCCs, []);
|
|
2470
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2471
2027
|
return super.serialize(ctx);
|
|
2472
2028
|
}
|
|
2473
2029
|
toLogEntry(ctx) {
|