@zwave-js/cc 14.3.10 → 15.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AlarmSensorCC.d.ts +68 -68
- package/build/cjs/cc/AlarmSensorCC.js +12 -50
- package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
- package/build/cjs/cc/AssociationCC.d.ts +72 -73
- package/build/cjs/cc/AssociationCC.js +9 -26
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.d.ts +71 -71
- package/build/cjs/cc/AssociationGroupInfoCC.js +11 -22
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.d.ts +66 -72
- package/build/cjs/cc/BarrierOperatorCC.js +12 -44
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.d.ts +64 -65
- package/build/cjs/cc/BasicCC.js +15 -46
- package/build/cjs/cc/BasicCC.js.map +2 -2
- package/build/cjs/cc/BatteryCC.d.ts +162 -165
- package/build/cjs/cc/BatteryCC.js +7 -84
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/BinarySensorCC.d.ts +36 -36
- package/build/cjs/cc/BinarySensorCC.js +9 -29
- package/build/cjs/cc/BinarySensorCC.js.map +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +34 -34
- package/build/cjs/cc/BinarySwitchCC.js +6 -22
- 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 +74 -74
- package/build/cjs/cc/CentralSceneCC.js +7 -30
- package/build/cjs/cc/CentralSceneCC.js.map +2 -2
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +38 -40
- package/build/cjs/cc/ClimateControlScheduleCC.js +5 -24
- 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 +117 -117
- package/build/cjs/cc/ColorSwitchCC.js +23 -75
- 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 +48 -52
- package/build/cjs/cc/ConfigurationCC.js +11 -39
- 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 +362 -361
- package/build/cjs/cc/DoorLockCC.js +51 -156
- package/build/cjs/cc/DoorLockCC.js.map +2 -2
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +14 -14
- package/build/cjs/cc/DoorLockLoggingCC.js +4 -8
- package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
- package/build/cjs/cc/EnergyProductionCC.d.ts +16 -16
- package/build/cjs/cc/EnergyProductionCC.js +5 -17
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +71 -71
- package/build/cjs/cc/EntryControlCC.js +9 -36
- 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 +101 -88
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +159 -34
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.d.ts +31 -33
- package/build/cjs/cc/HumidityControlModeCC.js +6 -15
- package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +9 -11
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +4 -12
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +50 -50
- package/build/cjs/cc/HumidityControlSetpointCC.js +10 -28
- 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 +119 -119
- package/build/cjs/cc/IndicatorCC.js +15 -61
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.d.ts +581 -585
- package/build/cjs/cc/IrrigationCC.js +29 -233
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/LanguageCC.d.ts +21 -21
- package/build/cjs/cc/LanguageCC.js +4 -15
- package/build/cjs/cc/LanguageCC.js.map +2 -2
- package/build/cjs/cc/LockCC.d.ts +9 -9
- package/build/cjs/cc/LockCC.js +4 -12
- 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 +67 -67
- package/build/cjs/cc/ManufacturerSpecificCC.js +5 -26
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.d.ts +120 -119
- package/build/cjs/cc/MeterCC.js +25 -69
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +71 -73
- package/build/cjs/cc/MultiChannelAssociationCC.js +10 -28
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +136 -146
- package/build/cjs/cc/MultiChannelCC.js +26 -118
- 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 +50 -49
- package/build/cjs/cc/MultilevelSensorCC.js +12 -33
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +146 -146
- package/build/cjs/cc/MultilevelSwitchCC.js +13 -107
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.d.ts +30 -30
- package/build/cjs/cc/NodeNamingCC.js +5 -16
- package/build/cjs/cc/NodeNamingCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.d.ts +210 -208
- package/build/cjs/cc/NotificationCC.js +41 -113
- 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 +117 -121
- package/build/cjs/cc/ProtectionCC.js +15 -50
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActivationCC.d.ts +29 -29
- package/build/cjs/cc/SceneActivationCC.js +4 -17
- package/build/cjs/cc/SceneActivationCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +35 -35
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +9 -21
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +36 -35
- package/build/cjs/cc/SceneControllerConfigurationCC.js +10 -22
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.d.ts +109 -109
- package/build/cjs/cc/ScheduleEntryLockCC.js +13 -30
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.d.ts +15 -21
- package/build/cjs/cc/Security2CC.js +32 -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 +58 -58
- package/build/cjs/cc/SoundSwitchCC.js +11 -43
- package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
- package/build/cjs/cc/SupervisionCC.d.ts +21 -25
- package/build/cjs/cc/SupervisionCC.js +8 -38
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.d.ts +37 -39
- package/build/cjs/cc/ThermostatFanModeCC.js +8 -21
- package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +9 -11
- package/build/cjs/cc/ThermostatFanStateCC.js +4 -12
- package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatModeCC.d.ts +39 -41
- package/build/cjs/cc/ThermostatModeCC.js +8 -21
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +9 -11
- package/build/cjs/cc/ThermostatOperatingStateCC.js +4 -12
- 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 +51 -51
- package/build/cjs/cc/ThermostatSetpointCC.js +10 -25
- 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 +9 -9
- package/build/cjs/cc/TimeParametersCC.js +4 -11
- 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 +236 -236
- package/build/cjs/cc/UserCodeCC.js +33 -98
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.d.ts +210 -212
- package/build/cjs/cc/VersionCC.js +7 -98
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WakeUpCC.d.ts +44 -44
- package/build/cjs/cc/WakeUpCC.js +6 -26
- package/build/cjs/cc/WakeUpCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.d.ts +118 -122
- package/build/cjs/cc/WindowCoveringCC.js +16 -128
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.d.ts +74 -74
- package/build/cjs/cc/ZWavePlusCC.js +4 -25
- 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/_CCValues.generated.d.ts +15814 -0
- package/build/cjs/cc/_CCValues.generated.js +8723 -0
- package/build/cjs/cc/_CCValues.generated.js.map +7 -0
- 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/CCValueUtils.d.ts +14 -0
- package/build/cjs/lib/CCValueUtils.js +93 -0
- package/build/cjs/lib/CCValueUtils.js.map +7 -0
- 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 +7 -106
- package/build/cjs/lib/Values.js +13 -107
- package/build/cjs/lib/Values.js.map +3 -3
- 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 +68 -68
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +2 -40
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +72 -73
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +2 -27
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts +71 -71
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +2 -19
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +66 -72
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +2 -37
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +64 -65
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +2 -34
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +162 -165
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +3 -80
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts +36 -36
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +2 -19
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +34 -34
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +2 -19
- 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 +74 -74
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -27
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +38 -40
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +2 -26
- 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 +117 -117
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -58
- 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 +48 -52
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +2 -40
- 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 +362 -361
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +9 -129
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +14 -14
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +2 -6
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts +16 -16
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +2 -15
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +71 -71
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +2 -29
- 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 +101 -88
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +160 -53
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts +31 -33
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +2 -11
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +9 -11
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +2 -9
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +50 -50
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +2 -23
- 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 +119 -119
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +2 -50
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +581 -585
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +3 -231
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +21 -21
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +2 -13
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +9 -9
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +2 -10
- 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 -2
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts +67 -67
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +2 -26
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts +120 -119
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +3 -53
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +71 -73
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +2 -30
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +136 -146
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +10 -131
- 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 +50 -49
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +2 -27
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +146 -146
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +5 -105
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts +30 -30
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +2 -14
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts +210 -208
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +21 -97
- 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 +117 -121
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +2 -39
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts +29 -29
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +2 -15
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +35 -35
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +2 -16
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +36 -35
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +2 -16
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts +109 -109
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +2 -31
- 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 +27 -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 +58 -58
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -40
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +21 -25
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +6 -41
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts +37 -39
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +2 -15
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +9 -11
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +2 -9
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts +39 -41
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -17
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +9 -11
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +2 -9
- 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 +51 -51
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +2 -22
- 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 +9 -9
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +2 -9
- 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 +236 -236
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +2 -72
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +210 -212
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +2 -96
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +44 -44
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +2 -22
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +118 -122
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +3 -108
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts +74 -74
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +2 -26
- 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/_CCValues.generated.d.ts +15814 -0
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -0
- package/build/esm/cc/_CCValues.generated.js +9187 -0
- package/build/esm/cc/_CCValues.generated.js.map +1 -0
- 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/CCValueUtils.d.ts +14 -0
- package/build/esm/lib/CCValueUtils.d.ts.map +1 -0
- package/build/esm/lib/CCValueUtils.js +62 -0
- package/build/esm/lib/CCValueUtils.js.map +1 -0
- 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 +7 -106
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js +7 -104
- 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 +16 -14
|
@@ -32,7 +32,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { CommandClasses, MPANState, MessagePriority, SPANState, SecurityClass, TransmitOptions, ZWaveError, ZWaveErrorCodes,
|
|
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,9 +1070,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1214
1070
|
// For now, do the same as if we didn't have any EI
|
|
1215
1071
|
failNoSPAN();
|
|
1216
1072
|
}
|
|
1217
|
-
decrypt = () =>
|
|
1218
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1219
|
-
decryptSinglecastSync(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
1073
|
+
decrypt = () => decryptSinglecast(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
1220
1074
|
}
|
|
1221
1075
|
let plaintext;
|
|
1222
1076
|
let authOK = false;
|
|
@@ -1241,7 +1095,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1241
1095
|
key,
|
|
1242
1096
|
iv,
|
|
1243
1097
|
securityClass: decryptionSecurityClass,
|
|
1244
|
-
} = decrypt());
|
|
1098
|
+
} = await decrypt());
|
|
1245
1099
|
if (!!authOK && !!plaintext)
|
|
1246
1100
|
break;
|
|
1247
1101
|
// No need to try further SPANs if we just got the sender's EI
|
|
@@ -1283,187 +1137,6 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1283
1137
|
validatePayload.fail("Invalid combination of extensions");
|
|
1284
1138
|
}
|
|
1285
1139
|
// If the MPAN extension was received, store the MPAN
|
|
1286
|
-
if (!mcctx.isMulticast) {
|
|
1287
|
-
if (mpanExtension) {
|
|
1288
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mpanExtension.groupId, {
|
|
1289
|
-
type: MPANState.MPAN,
|
|
1290
|
-
currentMPAN: mpanExtension.innerMPANState,
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
// Not every S2 message includes an encapsulated CC
|
|
1295
|
-
const decryptedCCBytes = plaintext.subarray(offset);
|
|
1296
|
-
let encapsulated;
|
|
1297
|
-
if (decryptedCCBytes.length > 0) {
|
|
1298
|
-
// make sure this contains a complete CC command that's worth splitting
|
|
1299
|
-
validatePayload(decryptedCCBytes.length >= 2);
|
|
1300
|
-
// and deserialize the CC
|
|
1301
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1302
|
-
encapsulated = CommandClass.parse(decryptedCCBytes, ctx);
|
|
1303
|
-
}
|
|
1304
|
-
const ret = new Security2CCMessageEncapsulation({
|
|
1305
|
-
nodeId: ctx.sourceNodeId,
|
|
1306
|
-
sequenceNumber,
|
|
1307
|
-
securityClass,
|
|
1308
|
-
extensions,
|
|
1309
|
-
encapsulated,
|
|
1310
|
-
});
|
|
1311
|
-
// Remember for debugging purposes
|
|
1312
|
-
ret.key = key;
|
|
1313
|
-
ret.iv = iv;
|
|
1314
|
-
ret.authData = authData;
|
|
1315
|
-
ret.authTag = authTag;
|
|
1316
|
-
ret.plaintext = decryptedCCBytes;
|
|
1317
|
-
return ret;
|
|
1318
|
-
}
|
|
1319
|
-
static async fromAsync(raw, ctx) {
|
|
1320
|
-
const securityManager = assertSecurityRX(ctx);
|
|
1321
|
-
validatePayload(raw.payload.length >= 2);
|
|
1322
|
-
// Check the sequence number to avoid duplicates
|
|
1323
|
-
const sequenceNumber = raw.payload[0];
|
|
1324
|
-
// Ensure the node has a security class
|
|
1325
|
-
validatePayload.withReason("No security class granted")(ctx.getHighestSecurityClass(ctx.sourceNodeId) !== SecurityClass.None);
|
|
1326
|
-
const hasExtensions = !!(raw.payload[1] & 0b1);
|
|
1327
|
-
const hasEncryptedExtensions = !!(raw.payload[1] & 0b10);
|
|
1328
|
-
let offset = 2;
|
|
1329
|
-
const extensions = [];
|
|
1330
|
-
let mustDiscardCommand = false;
|
|
1331
|
-
if (hasExtensions) {
|
|
1332
|
-
const parseResult = parseExtensions(raw.payload.subarray(offset), false);
|
|
1333
|
-
extensions.push(...parseResult.extensions);
|
|
1334
|
-
offset += parseResult.bytesRead;
|
|
1335
|
-
mustDiscardCommand = parseResult.mustDiscardCommand;
|
|
1336
|
-
}
|
|
1337
|
-
const mcctx = (() => {
|
|
1338
|
-
const multicastGroupId = getMulticastGroupId(extensions);
|
|
1339
|
-
if (ctx.frameType === "multicast" || ctx.frameType === "broadcast") {
|
|
1340
|
-
if (multicastGroupId == undefined) {
|
|
1341
|
-
validatePayload.fail("Multicast frames without MGRP extension");
|
|
1342
|
-
}
|
|
1343
|
-
return {
|
|
1344
|
-
isMulticast: true,
|
|
1345
|
-
groupId: multicastGroupId,
|
|
1346
|
-
};
|
|
1347
|
-
}
|
|
1348
|
-
else {
|
|
1349
|
-
return { isMulticast: false, groupId: multicastGroupId };
|
|
1350
|
-
}
|
|
1351
|
-
})();
|
|
1352
|
-
// If a command is to be discarded before decryption,
|
|
1353
|
-
// we still need to increment the SPAN or MPAN state
|
|
1354
|
-
if (mustDiscardCommand) {
|
|
1355
|
-
if (mcctx.isMulticast) {
|
|
1356
|
-
await securityManager.nextPeerMPANAsync(ctx.sourceNodeId, mcctx.groupId);
|
|
1357
|
-
}
|
|
1358
|
-
else {
|
|
1359
|
-
await securityManager.nextNonceAsync(ctx.sourceNodeId);
|
|
1360
|
-
}
|
|
1361
|
-
validatePayload.fail("Invalid S2 extension");
|
|
1362
|
-
}
|
|
1363
|
-
let prevSequenceNumber;
|
|
1364
|
-
let mpanState;
|
|
1365
|
-
if (mcctx.isMulticast) {
|
|
1366
|
-
mpanState = securityManager.getPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
1367
|
-
}
|
|
1368
|
-
else {
|
|
1369
|
-
// Don't accept duplicate Singlecast commands
|
|
1370
|
-
prevSequenceNumber = validateSequenceNumber(securityManager, ctx.sourceNodeId, sequenceNumber);
|
|
1371
|
-
// When a node receives a singlecast message after a multicast group was marked out of sync,
|
|
1372
|
-
// it must forget about the group.
|
|
1373
|
-
if (mcctx.groupId == undefined) {
|
|
1374
|
-
securityManager.resetOutOfSyncMPANs(ctx.sourceNodeId);
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
const unencryptedPayload = raw.payload.subarray(0, offset);
|
|
1378
|
-
const ciphertext = raw.payload.subarray(offset, -SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1379
|
-
const authTag = raw.payload.subarray(-SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1380
|
-
const messageLength = 2 /* CommandClass.computeEncapsulationOverhead() */
|
|
1381
|
-
+ raw.payload.length;
|
|
1382
|
-
const authData = getAuthenticationData(ctx.sourceNodeId, getDestinationIDRX(ctx, extensions), ctx.homeId, messageLength, unencryptedPayload);
|
|
1383
|
-
let decrypt;
|
|
1384
|
-
if (mcctx.isMulticast) {
|
|
1385
|
-
// For incoming multicast commands, make sure we have an MPAN
|
|
1386
|
-
if (mpanState?.type !== MPANState.MPAN) {
|
|
1387
|
-
// If we don't, mark the MPAN as out of sync, so we can respond accordingly on the singlecast followup
|
|
1388
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
|
|
1389
|
-
failNoMPAN();
|
|
1390
|
-
}
|
|
1391
|
-
decrypt = () => decryptMulticastAsync(ctx.sourceNodeId, securityManager, mcctx.groupId, ciphertext, authData, authTag);
|
|
1392
|
-
}
|
|
1393
|
-
else {
|
|
1394
|
-
// Decrypt payload and verify integrity
|
|
1395
|
-
const spanState = securityManager.getSPANState(ctx.sourceNodeId);
|
|
1396
|
-
// If we are not able to establish an SPAN yet, fail the decryption
|
|
1397
|
-
if (spanState.type === SPANState.None) {
|
|
1398
|
-
failNoSPAN();
|
|
1399
|
-
}
|
|
1400
|
-
else if (spanState.type === SPANState.RemoteEI) {
|
|
1401
|
-
// TODO: The specs are not clear how to handle this case
|
|
1402
|
-
// For now, do the same as if we didn't have any EI
|
|
1403
|
-
failNoSPAN();
|
|
1404
|
-
}
|
|
1405
|
-
decrypt = () => decryptSinglecastAsync(ctx, securityManager, ctx.sourceNodeId, sequenceNumber, prevSequenceNumber, ciphertext, authData, authTag, spanState, extensions);
|
|
1406
|
-
}
|
|
1407
|
-
let plaintext;
|
|
1408
|
-
let authOK = false;
|
|
1409
|
-
let key;
|
|
1410
|
-
let iv;
|
|
1411
|
-
let decryptionSecurityClass;
|
|
1412
|
-
// If the Receiver is unable to authenticate the singlecast message with the current SPAN,
|
|
1413
|
-
// the Receiver SHOULD try decrypting the message with one or more of the following SPAN values,
|
|
1414
|
-
// stopping when decryption is successful or the maximum number of iterations is reached.
|
|
1415
|
-
// If the Receiver is unable to decrypt the S2 MC frame with the current MPAN, the Receiver MAY try
|
|
1416
|
-
// decrypting the frame with one or more of the subsequent MPAN values, stopping when decryption is
|
|
1417
|
-
// successful or the maximum number of iterations is reached.
|
|
1418
|
-
const decryptAttempts = mcctx.isMulticast
|
|
1419
|
-
? MAX_DECRYPT_ATTEMPTS_MULTICAST
|
|
1420
|
-
: mcctx.groupId != undefined
|
|
1421
|
-
? MAX_DECRYPT_ATTEMPTS_SC_FOLLOWUP
|
|
1422
|
-
: MAX_DECRYPT_ATTEMPTS_SINGLECAST;
|
|
1423
|
-
for (let i = 0; i < decryptAttempts; i++) {
|
|
1424
|
-
({
|
|
1425
|
-
plaintext,
|
|
1426
|
-
authOK,
|
|
1427
|
-
key,
|
|
1428
|
-
iv,
|
|
1429
|
-
securityClass: decryptionSecurityClass,
|
|
1430
|
-
} = await decrypt());
|
|
1431
|
-
if (!!authOK && !!plaintext)
|
|
1432
|
-
break;
|
|
1433
|
-
// No need to try further SPANs if we just got the sender's EI
|
|
1434
|
-
if (!!getSenderEI(extensions))
|
|
1435
|
-
break;
|
|
1436
|
-
}
|
|
1437
|
-
// If authentication fails, do so with an error code that instructs the
|
|
1438
|
-
// applHost to tell the node we have no nonce
|
|
1439
|
-
if (!authOK || !plaintext) {
|
|
1440
|
-
if (mcctx.isMulticast) {
|
|
1441
|
-
// Mark the MPAN as out of sync
|
|
1442
|
-
securityManager.storePeerMPAN(ctx.sourceNodeId, mcctx.groupId, { type: MPANState.OutOfSync });
|
|
1443
|
-
validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecodeMulticast);
|
|
1444
|
-
}
|
|
1445
|
-
else {
|
|
1446
|
-
validatePayload.fail(ZWaveErrorCodes.Security2CC_CannotDecode);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
else if (!mcctx.isMulticast && mcctx.groupId != undefined) {
|
|
1450
|
-
// After reception of a singlecast followup, the MPAN state must be increased
|
|
1451
|
-
securityManager.tryIncrementPeerMPAN(ctx.sourceNodeId, mcctx.groupId);
|
|
1452
|
-
}
|
|
1453
|
-
// Remember which security class was used to decrypt this message, so we can discard it later
|
|
1454
|
-
const securityClass = decryptionSecurityClass;
|
|
1455
|
-
offset = 0;
|
|
1456
|
-
if (hasEncryptedExtensions) {
|
|
1457
|
-
const parseResult = parseExtensions(plaintext, true);
|
|
1458
|
-
extensions.push(...parseResult.extensions);
|
|
1459
|
-
offset += parseResult.bytesRead;
|
|
1460
|
-
mustDiscardCommand = parseResult.mustDiscardCommand;
|
|
1461
|
-
}
|
|
1462
|
-
// Before we can continue, check if the command must be discarded
|
|
1463
|
-
if (mustDiscardCommand) {
|
|
1464
|
-
validatePayload.fail("Invalid extension");
|
|
1465
|
-
}
|
|
1466
|
-
// If the MPAN extension was received, store the MPAN
|
|
1467
1140
|
if (!mcctx.isMulticast) {
|
|
1468
1141
|
const mpanExtension = extensions.find((e) => e instanceof MPANExtension);
|
|
1469
1142
|
if (mpanExtension) {
|
|
@@ -1480,7 +1153,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1480
1153
|
// make sure this contains a complete CC command that's worth splitting
|
|
1481
1154
|
validatePayload(decryptedCCBytes.length >= 2);
|
|
1482
1155
|
// and deserialize the CC
|
|
1483
|
-
encapsulated = await CommandClass.
|
|
1156
|
+
encapsulated = await CommandClass.parse(decryptedCCBytes, ctx);
|
|
1484
1157
|
}
|
|
1485
1158
|
const ret = new Security2CCMessageEncapsulation({
|
|
1486
1159
|
nodeId: ctx.sourceNodeId,
|
|
@@ -1536,51 +1209,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1536
1209
|
getMulticastGroupId() {
|
|
1537
1210
|
return getMulticastGroupId(this.extensions);
|
|
1538
1211
|
}
|
|
1539
|
-
|
|
1540
|
-
maybeAddSPANExtensionSync(ctx, securityManager) {
|
|
1541
|
-
if (!this.isSinglecast())
|
|
1542
|
-
return;
|
|
1543
|
-
const receiverNodeId = this.nodeId;
|
|
1544
|
-
const spanState = securityManager.getSPANState(receiverNodeId);
|
|
1545
|
-
if (spanState.type === SPANState.None
|
|
1546
|
-
|| spanState.type === SPANState.LocalEI) {
|
|
1547
|
-
// Can't do anything here if we don't have the receiver's EI
|
|
1548
|
-
throw new ZWaveError(`Security S2 CC requires the receiver's nonce to be sent!`, ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1549
|
-
}
|
|
1550
|
-
else if (spanState.type === SPANState.RemoteEI) {
|
|
1551
|
-
// We have the receiver's EI, generate our input and send it over
|
|
1552
|
-
// With both, we can create an SPAN
|
|
1553
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1554
|
-
const senderEI = securityManager.generateNonce(undefined);
|
|
1555
|
-
const receiverEI = spanState.receiverEI;
|
|
1556
|
-
// While bootstrapping a node, prefer the temporary key, unless the
|
|
1557
|
-
// specific command specifies a security class
|
|
1558
|
-
if (this.securityClass == undefined
|
|
1559
|
-
&& securityManager.tempKeys.has(receiverNodeId)) {
|
|
1560
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1561
|
-
securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
|
|
1562
|
-
}
|
|
1563
|
-
else {
|
|
1564
|
-
const securityClass = this.securityClass
|
|
1565
|
-
?? ctx.getHighestSecurityClass(receiverNodeId);
|
|
1566
|
-
if (securityClass == undefined) {
|
|
1567
|
-
throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1568
|
-
}
|
|
1569
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1570
|
-
securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
|
|
1571
|
-
}
|
|
1572
|
-
// Add or update the SPAN extension
|
|
1573
|
-
let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
|
|
1574
|
-
if (spanExtension) {
|
|
1575
|
-
spanExtension.senderEI = senderEI;
|
|
1576
|
-
}
|
|
1577
|
-
else {
|
|
1578
|
-
spanExtension = new SPANExtension({ senderEI });
|
|
1579
|
-
this.extensions.push(spanExtension);
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
async maybeAddSPANExtensionAsync(ctx, securityManager) {
|
|
1212
|
+
async maybeAddSPANExtension(ctx, securityManager) {
|
|
1584
1213
|
if (!this.isSinglecast())
|
|
1585
1214
|
return;
|
|
1586
1215
|
const receiverNodeId = this.nodeId;
|
|
@@ -1593,13 +1222,13 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1593
1222
|
else if (spanState.type === SPANState.RemoteEI) {
|
|
1594
1223
|
// We have the receiver's EI, generate our input and send it over
|
|
1595
1224
|
// With both, we can create an SPAN
|
|
1596
|
-
const senderEI = await securityManager.
|
|
1225
|
+
const senderEI = await securityManager.generateNonce(undefined);
|
|
1597
1226
|
const receiverEI = spanState.receiverEI;
|
|
1598
1227
|
// While bootstrapping a node, prefer the temporary key, unless the
|
|
1599
1228
|
// specific command specifies a security class
|
|
1600
1229
|
if (this.securityClass == undefined
|
|
1601
1230
|
&& securityManager.tempKeys.has(receiverNodeId)) {
|
|
1602
|
-
await securityManager.
|
|
1231
|
+
await securityManager.initializeTempSPAN(receiverNodeId, senderEI, receiverEI);
|
|
1603
1232
|
}
|
|
1604
1233
|
else {
|
|
1605
1234
|
const securityClass = this.securityClass
|
|
@@ -1607,7 +1236,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1607
1236
|
if (securityClass == undefined) {
|
|
1608
1237
|
throw new ZWaveError("No security class defined for this command!", ZWaveErrorCodes.Security2CC_NoSPAN);
|
|
1609
1238
|
}
|
|
1610
|
-
await securityManager.
|
|
1239
|
+
await securityManager.initializeSPAN(receiverNodeId, securityClass, senderEI, receiverEI);
|
|
1611
1240
|
}
|
|
1612
1241
|
// Add or update the SPAN extension
|
|
1613
1242
|
let spanExtension = this.extensions.find((e) => e instanceof SPANExtension);
|
|
@@ -1620,13 +1249,11 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1620
1249
|
}
|
|
1621
1250
|
}
|
|
1622
1251
|
}
|
|
1623
|
-
|
|
1624
|
-
serialize(ctx) {
|
|
1252
|
+
async serialize(ctx) {
|
|
1625
1253
|
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1626
1254
|
this.ensureSequenceNumber(securityManager);
|
|
1627
1255
|
// Include Sender EI in the command if we only have the receiver's EI
|
|
1628
|
-
|
|
1629
|
-
this.maybeAddSPANExtensionSync(ctx, securityManager);
|
|
1256
|
+
await this.maybeAddSPANExtension(ctx, securityManager);
|
|
1630
1257
|
const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
|
|
1631
1258
|
const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
|
|
1632
1259
|
const unencryptedPayload = Bytes.concat([
|
|
@@ -1637,8 +1264,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1637
1264
|
]),
|
|
1638
1265
|
...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
|
|
1639
1266
|
]);
|
|
1640
|
-
|
|
1641
|
-
const serializedCC = this.encapsulated?.serialize(ctx)
|
|
1267
|
+
const serializedCC = (await this.encapsulated?.serialize(ctx))
|
|
1642
1268
|
?? new Bytes();
|
|
1643
1269
|
const plaintextPayload = Bytes.concat([
|
|
1644
1270
|
...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
|
|
@@ -1655,8 +1281,7 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1655
1281
|
// Singlecast:
|
|
1656
1282
|
// Generate a nonce for encryption, and remember it to attempt decryption
|
|
1657
1283
|
// of potential in-flight messages from the target node.
|
|
1658
|
-
|
|
1659
|
-
iv = securityManager.nextNonce(this.nodeId, true);
|
|
1284
|
+
iv = await securityManager.nextNonce(this.nodeId, true);
|
|
1660
1285
|
const { keyCCM } =
|
|
1661
1286
|
// Prefer the overridden security class if it was given
|
|
1662
1287
|
this.securityClass != undefined
|
|
@@ -1666,13 +1291,11 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1666
1291
|
}
|
|
1667
1292
|
else {
|
|
1668
1293
|
// Multicast:
|
|
1669
|
-
|
|
1670
|
-
const keyAndIV = securityManager.getMulticastKeyAndIV(destinationTag);
|
|
1294
|
+
const keyAndIV = await securityManager.getMulticastKeyAndIV(destinationTag);
|
|
1671
1295
|
key = keyAndIV.key;
|
|
1672
1296
|
iv = keyAndIV.iv;
|
|
1673
1297
|
}
|
|
1674
|
-
|
|
1675
|
-
const { ciphertext: ciphertextPayload, authTag } = encryptAES128CCMSync(key, iv, plaintextPayload, authData, SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1298
|
+
const { ciphertext: ciphertextPayload, authTag } = await encryptAES128CCM(plaintextPayload, key, iv, authData, SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1676
1299
|
// Remember key and IV for debugging purposes
|
|
1677
1300
|
this.key = key;
|
|
1678
1301
|
this.iv = iv;
|
|
@@ -1684,69 +1307,8 @@ let Security2CCMessageEncapsulation = (() => {
|
|
|
1684
1307
|
ciphertextPayload,
|
|
1685
1308
|
authTag,
|
|
1686
1309
|
]);
|
|
1687
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1688
1310
|
return super.serialize(ctx);
|
|
1689
1311
|
}
|
|
1690
|
-
async serializeAsync(ctx) {
|
|
1691
|
-
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1692
|
-
this.ensureSequenceNumber(securityManager);
|
|
1693
|
-
// Include Sender EI in the command if we only have the receiver's EI
|
|
1694
|
-
await this.maybeAddSPANExtensionAsync(ctx, securityManager);
|
|
1695
|
-
const unencryptedExtensions = this.extensions.filter((e) => !e.isEncrypted());
|
|
1696
|
-
const encryptedExtensions = this.extensions.filter((e) => e.isEncrypted());
|
|
1697
|
-
const unencryptedPayload = Bytes.concat([
|
|
1698
|
-
Bytes.from([
|
|
1699
|
-
this.sequenceNumber,
|
|
1700
|
-
(encryptedExtensions.length > 0 ? 0b10 : 0)
|
|
1701
|
-
| (unencryptedExtensions.length > 0 ? 1 : 0),
|
|
1702
|
-
]),
|
|
1703
|
-
...unencryptedExtensions.map((e, index) => e.serialize(index < unencryptedExtensions.length - 1)),
|
|
1704
|
-
]);
|
|
1705
|
-
const serializedCC = (await this.encapsulated?.serializeAsync(ctx))
|
|
1706
|
-
?? new Bytes();
|
|
1707
|
-
const plaintextPayload = Bytes.concat([
|
|
1708
|
-
...encryptedExtensions.map((e, index) => e.serialize(index < encryptedExtensions.length - 1)),
|
|
1709
|
-
serializedCC,
|
|
1710
|
-
]);
|
|
1711
|
-
// Generate the authentication data for CCM encryption
|
|
1712
|
-
const destinationTag = getDestinationIDTX.call(this);
|
|
1713
|
-
const messageLength = this.computeEncapsulationOverhead()
|
|
1714
|
-
+ serializedCC.length;
|
|
1715
|
-
const authData = getAuthenticationData(ctx.ownNodeId, destinationTag, ctx.homeId, messageLength, unencryptedPayload);
|
|
1716
|
-
let key;
|
|
1717
|
-
let iv;
|
|
1718
|
-
if (this.isSinglecast()) {
|
|
1719
|
-
// Singlecast:
|
|
1720
|
-
// Generate a nonce for encryption, and remember it to attempt decryption
|
|
1721
|
-
// of potential in-flight messages from the target node.
|
|
1722
|
-
iv = await securityManager.nextNonceAsync(this.nodeId, true);
|
|
1723
|
-
const { keyCCM } =
|
|
1724
|
-
// Prefer the overridden security class if it was given
|
|
1725
|
-
this.securityClass != undefined
|
|
1726
|
-
? securityManager.getKeysForSecurityClass(this.securityClass)
|
|
1727
|
-
: securityManager.getKeysForNode(this.nodeId);
|
|
1728
|
-
key = keyCCM;
|
|
1729
|
-
}
|
|
1730
|
-
else {
|
|
1731
|
-
// Multicast:
|
|
1732
|
-
const keyAndIV = await securityManager.getMulticastKeyAndIVAsync(destinationTag);
|
|
1733
|
-
key = keyAndIV.key;
|
|
1734
|
-
iv = keyAndIV.iv;
|
|
1735
|
-
}
|
|
1736
|
-
const { ciphertext: ciphertextPayload, authTag } = await encryptAES128CCMAsync(plaintextPayload, key, iv, authData, SECURITY_S2_AUTH_TAG_LENGTH);
|
|
1737
|
-
// Remember key and IV for debugging purposes
|
|
1738
|
-
this.key = key;
|
|
1739
|
-
this.iv = iv;
|
|
1740
|
-
this.authData = authData;
|
|
1741
|
-
this.authTag = authTag;
|
|
1742
|
-
this.ciphertext = ciphertextPayload;
|
|
1743
|
-
this.payload = Bytes.concat([
|
|
1744
|
-
unencryptedPayload,
|
|
1745
|
-
ciphertextPayload,
|
|
1746
|
-
authTag,
|
|
1747
|
-
]);
|
|
1748
|
-
return super.serializeAsync(ctx);
|
|
1749
|
-
}
|
|
1750
1312
|
computeEncapsulationOverhead() {
|
|
1751
1313
|
// Security S2 adds:
|
|
1752
1314
|
// * 1 byte sequence number
|
|
@@ -1882,7 +1444,6 @@ let Security2CCNonceReport = (() => {
|
|
|
1882
1444
|
if (this.SOS) {
|
|
1883
1445
|
this.payload = Bytes.concat([this.payload, this.receiverEI]);
|
|
1884
1446
|
}
|
|
1885
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1886
1447
|
return super.serialize(ctx);
|
|
1887
1448
|
}
|
|
1888
1449
|
toLogEntry(ctx) {
|
|
@@ -1945,7 +1506,6 @@ let Security2CCNonceGet = (() => {
|
|
|
1945
1506
|
const securityManager = assertSecurityTX(ctx, this.nodeId);
|
|
1946
1507
|
this.ensureSequenceNumber(securityManager);
|
|
1947
1508
|
this.payload = Bytes.from([this.sequenceNumber]);
|
|
1948
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1949
1509
|
return super.serialize(ctx);
|
|
1950
1510
|
}
|
|
1951
1511
|
toLogEntry(ctx) {
|
|
@@ -2022,7 +1582,6 @@ let Security2CCKEXReport = (() => {
|
|
|
2022
1582
|
encodeBitMask(this.supportedECDHProfiles, 7, ECDHProfiles.Curve25519),
|
|
2023
1583
|
encodeBitMask(this.requestedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
|
|
2024
1584
|
]);
|
|
2025
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2026
1585
|
return super.serialize(ctx);
|
|
2027
1586
|
}
|
|
2028
1587
|
toLogEntry(ctx) {
|
|
@@ -2150,7 +1709,6 @@ let Security2CCKEXSet = (() => {
|
|
|
2150
1709
|
encodeBitMask([this.selectedECDHProfile], 7, ECDHProfiles.Curve25519),
|
|
2151
1710
|
encodeBitMask(this.grantedKeys, SecurityClass.S0_Legacy, SecurityClass.S2_Unauthenticated),
|
|
2152
1711
|
]);
|
|
2153
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2154
1712
|
return super.serialize(ctx);
|
|
2155
1713
|
}
|
|
2156
1714
|
toLogEntry(ctx) {
|
|
@@ -2201,7 +1759,6 @@ let Security2CCKEXFail = (() => {
|
|
|
2201
1759
|
failType;
|
|
2202
1760
|
serialize(ctx) {
|
|
2203
1761
|
this.payload = Bytes.from([this.failType]);
|
|
2204
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2205
1762
|
return super.serialize(ctx);
|
|
2206
1763
|
}
|
|
2207
1764
|
toLogEntry(ctx) {
|
|
@@ -2251,7 +1808,6 @@ let Security2CCPublicKeyReport = (() => {
|
|
|
2251
1808
|
Bytes.from([this.includingNode ? 1 : 0]),
|
|
2252
1809
|
this.publicKey,
|
|
2253
1810
|
]);
|
|
2254
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2255
1811
|
return super.serialize(ctx);
|
|
2256
1812
|
}
|
|
2257
1813
|
toLogEntry(ctx) {
|
|
@@ -2304,7 +1860,6 @@ let Security2CCNetworkKeyReport = (() => {
|
|
|
2304
1860
|
securityClassToBitMask(this.grantedKey),
|
|
2305
1861
|
this.networkKey,
|
|
2306
1862
|
]);
|
|
2307
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2308
1863
|
return super.serialize(ctx);
|
|
2309
1864
|
}
|
|
2310
1865
|
toLogEntry(ctx) {
|
|
@@ -2351,7 +1906,6 @@ let Security2CCNetworkKeyGet = (() => {
|
|
|
2351
1906
|
requestedKey;
|
|
2352
1907
|
serialize(ctx) {
|
|
2353
1908
|
this.payload = securityClassToBitMask(this.requestedKey);
|
|
2354
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2355
1909
|
return super.serialize(ctx);
|
|
2356
1910
|
}
|
|
2357
1911
|
toLogEntry(ctx) {
|
|
@@ -2421,7 +1975,6 @@ let Security2CCTransferEnd = (() => {
|
|
|
2421
1975
|
this.payload = Bytes.from([
|
|
2422
1976
|
(this.keyVerified ? 0b10 : 0) + (this.keyRequestComplete ? 0b1 : 0),
|
|
2423
1977
|
]);
|
|
2424
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2425
1978
|
return super.serialize(ctx);
|
|
2426
1979
|
}
|
|
2427
1980
|
toLogEntry(ctx) {
|
|
@@ -2471,7 +2024,6 @@ let Security2CCCommandsSupportedReport = (() => {
|
|
|
2471
2024
|
supportedCCs;
|
|
2472
2025
|
serialize(ctx) {
|
|
2473
2026
|
this.payload = encodeCCList(this.supportedCCs, []);
|
|
2474
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
2475
2027
|
return super.serialize(ctx);
|
|
2476
2028
|
}
|
|
2477
2029
|
toLogEntry(ctx) {
|