@zwave-js/cc 15.22.1 → 15.23.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._validateArgs.d.ts +1 -1
- package/build/cjs/cc/AssociationCC._validateArgs.d.ts +8 -8
- package/build/cjs/cc/AssociationGroupInfoCC._validateArgs.d.ts +6 -6
- package/build/cjs/cc/BarrierOperatorCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/BasicCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/BasicWindowCoveringCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/BinarySensorCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/BinarySwitchCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/CentralSceneCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/ClimateControlScheduleCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/ClockCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/ColorSwitchCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/ConfigurationCC._validateArgs.d.ts +9 -9
- package/build/cjs/cc/DoorLockCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/DoorLockLoggingCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/EnergyProductionCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/EntryControlCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +6 -6
- package/build/cjs/cc/HumidityControlModeCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/HumidityControlSetpointCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/IndicatorCC._validateArgs.d.ts +9 -9
- package/build/cjs/cc/IrrigationCC._validateArgs.d.ts +10 -10
- package/build/cjs/cc/LanguageCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/LockCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/ManufacturerProprietaryCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/MeterCC._validateArgs.d.ts +5 -5
- package/build/cjs/cc/MultiChannelAssociationCC._validateArgs.d.ts +5 -5
- package/build/cjs/cc/MultiChannelCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/MultiCommandCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/MultilevelSensorCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/MultilevelSwitchCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/NodeNamingCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/NotificationCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/PowerlevelCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/ProtectionCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/SceneActivationCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/SceneActuatorConfigurationCC._validateArgs.d.ts +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/ScheduleEntryLockCC._validateArgs.d.ts +8 -8
- package/build/cjs/cc/SoundSwitchCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/ThermostatFanModeCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/ThermostatModeCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/ThermostatOperatingStateCC._validateArgs.d.ts +2 -0
- package/build/cjs/cc/ThermostatOperatingStateCC._validateArgs.js +51 -0
- package/build/cjs/cc/ThermostatOperatingStateCC._validateArgs.js.map +7 -0
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +43 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.js +272 -1
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetbackCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/ThermostatSetpointCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/TimeCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/TimeParametersCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/UserCodeCC._validateArgs.d.ts +6 -6
- package/build/cjs/cc/UserCredentialCC._validateArgs.d.ts +24 -0
- package/build/cjs/cc/UserCredentialCC._validateArgs.js +338 -0
- package/build/cjs/cc/UserCredentialCC._validateArgs.js.map +7 -0
- package/build/cjs/cc/UserCredentialCC.d.ts +452 -0
- package/build/cjs/cc/UserCredentialCC.js +2855 -0
- package/build/cjs/cc/UserCredentialCC.js.map +7 -0
- package/build/cjs/cc/VersionCC._validateArgs.d.ts +3 -3
- package/build/cjs/cc/WakeUpCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/WindowCoveringCC._validateArgs.d.ts +4 -4
- package/build/cjs/cc/ZWavePlusCC._validateArgs.d.ts +1 -1
- package/build/cjs/cc/_CCValues.generated.d.ts +4907 -3369
- package/build/cjs/cc/_CCValues.generated.js +828 -0
- package/build/cjs/cc/_CCValues.generated.js.map +2 -2
- package/build/cjs/cc/index.d.ts +6 -3
- package/build/cjs/cc/index.js +106 -0
- package/build/cjs/cc/index.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC._validateArgs.d.ts +2 -2
- package/build/cjs/lib/CommandClass.js +0 -1
- package/build/cjs/lib/CommandClass.js.map +1 -1
- package/build/cjs/lib/Values.d.ts +5 -5
- package/build/cjs/lib/Values.js.map +1 -1
- package/build/cjs/lib/_CCAPI.generated.d.ts +2 -0
- package/build/cjs/lib/_CCAPI.generated.js.map +1 -1
- package/build/cjs/lib/_Types.d.ts +153 -1
- package/build/cjs/lib/_Types.js +163 -0
- package/build/cjs/lib/_Types.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/AlarmSensorCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC._validateArgs.d.ts +8 -8
- package/build/esm/cc/AssociationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC._validateArgs.d.ts +6 -6
- package/build/esm/cc/AssociationGroupInfoCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/BarrierOperatorCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/BasicCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/BasicCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/BasicWindowCoveringCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/BasicWindowCoveringCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/BinarySensorCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/BinarySwitchCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/CentralSceneCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/ClimateControlScheduleCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ClockCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/ClockCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/ColorSwitchCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC._validateArgs.d.ts +9 -9
- package/build/esm/cc/ConfigurationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/DoorLockCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/DoorLockLoggingCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/EnergyProductionCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/EntryControlCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +6 -6
- package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/HumidityControlModeCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/HumidityControlSetpointCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC._validateArgs.d.ts +9 -9
- package/build/esm/cc/IndicatorCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC._validateArgs.d.ts +10 -10
- package/build/esm/cc/IrrigationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/LanguageCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/LockCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/LockCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/ManufacturerProprietaryCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/MeterCC._validateArgs.d.ts +5 -5
- package/build/esm/cc/MeterCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC._validateArgs.d.ts +5 -5
- package/build/esm/cc/MultiChannelAssociationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/MultiChannelCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/MultiCommandCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/MultiCommandCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/MultilevelSensorCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/MultilevelSwitchCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/NodeNamingCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/NotificationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/PowerlevelCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/PowerlevelCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/ProtectionCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/SceneActivationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC._validateArgs.d.ts +8 -8
- package/build/esm/cc/ScheduleEntryLockCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/SoundSwitchCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/ThermostatFanModeCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/ThermostatModeCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.d.ts +2 -0
- package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.d.ts.map +1 -0
- package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.js +12 -0
- package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.js.map +1 -0
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +43 -2
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +253 -6
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/ThermostatSetbackCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/ThermostatSetpointCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/TimeCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/TimeCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/TimeParametersCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC._validateArgs.d.ts +6 -6
- package/build/esm/cc/UserCodeCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCredentialCC._validateArgs.d.ts +24 -0
- package/build/esm/cc/UserCredentialCC._validateArgs.d.ts.map +1 -0
- package/build/esm/cc/UserCredentialCC._validateArgs.js +233 -0
- package/build/esm/cc/UserCredentialCC._validateArgs.js.map +1 -0
- package/build/esm/cc/UserCredentialCC.d.ts +452 -0
- package/build/esm/cc/UserCredentialCC.d.ts.map +1 -0
- package/build/esm/cc/UserCredentialCC.js +2731 -0
- package/build/esm/cc/UserCredentialCC.js.map +1 -0
- package/build/esm/cc/VersionCC._validateArgs.d.ts +3 -3
- package/build/esm/cc/VersionCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/WakeUpCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC._validateArgs.d.ts +4 -4
- package/build/esm/cc/WindowCoveringCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC._validateArgs.d.ts +1 -1
- package/build/esm/cc/ZWavePlusCC._validateArgs.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +4907 -3369
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +898 -0
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/cc/index.d.ts +6 -3
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +39 -2
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC._validateArgs.d.ts +2 -2
- package/build/esm/cc/manufacturerProprietary/FibaroCC._validateArgs.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +1 -3
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/Security2/shared.d.ts.map +1 -1
- package/build/esm/lib/Values.d.ts +5 -5
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js +1 -4
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/_CCAPI.generated.d.ts +2 -0
- package/build/esm/lib/_CCAPI.generated.d.ts.map +1 -1
- package/build/esm/lib/_Types.d.ts +153 -1
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/_Types.js +141 -5
- package/build/esm/lib/_Types.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,2731 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import * as __validateArgs from "./UserCredentialCC._validateArgs.js";
|
|
3
|
+
const { validateArgs_UserCredentialCCAPI_setUser, validateArgs_UserCredentialCCAPI_getUser, validateArgs_UserCredentialCCAPI_setCredential, validateArgs_UserCredentialCCAPI_getCredential, validateArgs_UserCredentialCCAPI_startCredentialLearn, validateArgs_UserCredentialCCAPI_setUserCredentialAssociation, validateArgs_UserCredentialCCAPI_getUserChecksum, validateArgs_UserCredentialCCAPI_getCredentialChecksum, validateArgs_UserCredentialCCAPI_setAdminPinCode, validateArgs_UserCredentialCCAPI_setKeyLockerEntry, validateArgs_UserCredentialCCAPI_getKeyLockerEntry, validateArgs_UserCredentialCCAPI_sendUserCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendCredentialCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendKeyLockerCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendUserReport, validateArgs_UserCredentialCCAPI_sendCredentialReport, validateArgs_UserCredentialCCAPI_sendCredentialLearnReport, validateArgs_UserCredentialCCAPI_sendUserCredentialAssociationReport, validateArgs_UserCredentialCCAPI_sendAllUsersChecksumReport, validateArgs_UserCredentialCCAPI_sendUserChecksumReport, validateArgs_UserCredentialCCAPI_sendCredentialChecksumReport, validateArgs_UserCredentialCCAPI_sendAdminPinCodeReport, validateArgs_UserCredentialCCAPI_sendKeyLockerEntryReport } = __validateArgs;
|
|
4
|
+
import { CommandClasses, MessagePriority, ZWaveError, ZWaveErrorCodes, encodeBitMask, parseBitMask, validatePayload, } from "@zwave-js/core";
|
|
5
|
+
import { Bytes, getEnumMemberName, pick, stringToUint8ArrayUTF16BE, uint8ArrayToStringUTF16BE, } from "@zwave-js/shared";
|
|
6
|
+
import { CCAPI, PhysicalCCAPI } from "../lib/API.js";
|
|
7
|
+
import { CommandClass, } from "../lib/CommandClass.js";
|
|
8
|
+
import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
|
|
9
|
+
import { UserCredentialAdminCodeOperationResult, UserCredentialCommand, UserCredentialCredentialReportType, UserCredentialKeyLockerEntryType, UserCredentialLearnStatus, UserCredentialModifierType, UserCredentialNameEncoding, UserCredentialOperationType, UserCredentialRule, UserCredentialType, UserCredentialUserReportType, UserCredentialUserType, } from "../lib/_Types.js";
|
|
10
|
+
function credentialToLogString(credential) {
|
|
11
|
+
if (credential.length === 0)
|
|
12
|
+
return "(empty)";
|
|
13
|
+
return "*".repeat(credential.length);
|
|
14
|
+
}
|
|
15
|
+
import { UserCredentialCCValues } from "./_CCValues.generated.js";
|
|
16
|
+
export { UserCredentialCCValues };
|
|
17
|
+
// API class
|
|
18
|
+
let UserCredentialCCAPI = (() => {
|
|
19
|
+
let _classDecorators = [API(CommandClasses["User Credential"])];
|
|
20
|
+
let _classDescriptor;
|
|
21
|
+
let _classExtraInitializers = [];
|
|
22
|
+
let _classThis;
|
|
23
|
+
let _classSuper = PhysicalCCAPI;
|
|
24
|
+
let _instanceExtraInitializers = [];
|
|
25
|
+
let _setUser_decorators;
|
|
26
|
+
let _getUser_decorators;
|
|
27
|
+
let _setCredential_decorators;
|
|
28
|
+
let _getCredential_decorators;
|
|
29
|
+
let _startCredentialLearn_decorators;
|
|
30
|
+
let _setUserCredentialAssociation_decorators;
|
|
31
|
+
let _getUserChecksum_decorators;
|
|
32
|
+
let _getCredentialChecksum_decorators;
|
|
33
|
+
let _setAdminPinCode_decorators;
|
|
34
|
+
let _setKeyLockerEntry_decorators;
|
|
35
|
+
let _getKeyLockerEntry_decorators;
|
|
36
|
+
let _sendUserCapabilitiesReport_decorators;
|
|
37
|
+
let _sendCredentialCapabilitiesReport_decorators;
|
|
38
|
+
let _sendKeyLockerCapabilitiesReport_decorators;
|
|
39
|
+
let _sendUserReport_decorators;
|
|
40
|
+
let _sendCredentialReport_decorators;
|
|
41
|
+
let _sendCredentialLearnReport_decorators;
|
|
42
|
+
let _sendUserCredentialAssociationReport_decorators;
|
|
43
|
+
let _sendAllUsersChecksumReport_decorators;
|
|
44
|
+
let _sendUserChecksumReport_decorators;
|
|
45
|
+
let _sendCredentialChecksumReport_decorators;
|
|
46
|
+
let _sendAdminPinCodeReport_decorators;
|
|
47
|
+
let _sendKeyLockerEntryReport_decorators;
|
|
48
|
+
var UserCredentialCCAPI = class extends _classSuper {
|
|
49
|
+
static { _classThis = this; }
|
|
50
|
+
static {
|
|
51
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
52
|
+
_setUser_decorators = [validateArgs_UserCredentialCCAPI_setUser()];
|
|
53
|
+
_getUser_decorators = [validateArgs_UserCredentialCCAPI_getUser()];
|
|
54
|
+
_setCredential_decorators = [validateArgs_UserCredentialCCAPI_setCredential()];
|
|
55
|
+
_getCredential_decorators = [validateArgs_UserCredentialCCAPI_getCredential()];
|
|
56
|
+
_startCredentialLearn_decorators = [validateArgs_UserCredentialCCAPI_startCredentialLearn()];
|
|
57
|
+
_setUserCredentialAssociation_decorators = [validateArgs_UserCredentialCCAPI_setUserCredentialAssociation()];
|
|
58
|
+
_getUserChecksum_decorators = [validateArgs_UserCredentialCCAPI_getUserChecksum()];
|
|
59
|
+
_getCredentialChecksum_decorators = [validateArgs_UserCredentialCCAPI_getCredentialChecksum()];
|
|
60
|
+
_setAdminPinCode_decorators = [validateArgs_UserCredentialCCAPI_setAdminPinCode()];
|
|
61
|
+
_setKeyLockerEntry_decorators = [validateArgs_UserCredentialCCAPI_setKeyLockerEntry()];
|
|
62
|
+
_getKeyLockerEntry_decorators = [validateArgs_UserCredentialCCAPI_getKeyLockerEntry()];
|
|
63
|
+
_sendUserCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserCapabilitiesReport()];
|
|
64
|
+
_sendCredentialCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialCapabilitiesReport()];
|
|
65
|
+
_sendKeyLockerCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendKeyLockerCapabilitiesReport()];
|
|
66
|
+
_sendUserReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserReport()];
|
|
67
|
+
_sendCredentialReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialReport()];
|
|
68
|
+
_sendCredentialLearnReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialLearnReport()];
|
|
69
|
+
_sendUserCredentialAssociationReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserCredentialAssociationReport()];
|
|
70
|
+
_sendAllUsersChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendAllUsersChecksumReport()];
|
|
71
|
+
_sendUserChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserChecksumReport()];
|
|
72
|
+
_sendCredentialChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialChecksumReport()];
|
|
73
|
+
_sendAdminPinCodeReport_decorators = [validateArgs_UserCredentialCCAPI_sendAdminPinCodeReport()];
|
|
74
|
+
_sendKeyLockerEntryReport_decorators = [validateArgs_UserCredentialCCAPI_sendKeyLockerEntryReport()];
|
|
75
|
+
__esDecorate(this, null, _setUser_decorators, { kind: "method", name: "setUser", static: false, private: false, access: { has: obj => "setUser" in obj, get: obj => obj.setUser }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
|
+
__esDecorate(this, null, _getUser_decorators, { kind: "method", name: "getUser", static: false, private: false, access: { has: obj => "getUser" in obj, get: obj => obj.getUser }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
77
|
+
__esDecorate(this, null, _setCredential_decorators, { kind: "method", name: "setCredential", static: false, private: false, access: { has: obj => "setCredential" in obj, get: obj => obj.setCredential }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
78
|
+
__esDecorate(this, null, _getCredential_decorators, { kind: "method", name: "getCredential", static: false, private: false, access: { has: obj => "getCredential" in obj, get: obj => obj.getCredential }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
79
|
+
__esDecorate(this, null, _startCredentialLearn_decorators, { kind: "method", name: "startCredentialLearn", static: false, private: false, access: { has: obj => "startCredentialLearn" in obj, get: obj => obj.startCredentialLearn }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
80
|
+
__esDecorate(this, null, _setUserCredentialAssociation_decorators, { kind: "method", name: "setUserCredentialAssociation", static: false, private: false, access: { has: obj => "setUserCredentialAssociation" in obj, get: obj => obj.setUserCredentialAssociation }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
81
|
+
__esDecorate(this, null, _getUserChecksum_decorators, { kind: "method", name: "getUserChecksum", static: false, private: false, access: { has: obj => "getUserChecksum" in obj, get: obj => obj.getUserChecksum }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
82
|
+
__esDecorate(this, null, _getCredentialChecksum_decorators, { kind: "method", name: "getCredentialChecksum", static: false, private: false, access: { has: obj => "getCredentialChecksum" in obj, get: obj => obj.getCredentialChecksum }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
83
|
+
__esDecorate(this, null, _setAdminPinCode_decorators, { kind: "method", name: "setAdminPinCode", static: false, private: false, access: { has: obj => "setAdminPinCode" in obj, get: obj => obj.setAdminPinCode }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
84
|
+
__esDecorate(this, null, _setKeyLockerEntry_decorators, { kind: "method", name: "setKeyLockerEntry", static: false, private: false, access: { has: obj => "setKeyLockerEntry" in obj, get: obj => obj.setKeyLockerEntry }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
85
|
+
__esDecorate(this, null, _getKeyLockerEntry_decorators, { kind: "method", name: "getKeyLockerEntry", static: false, private: false, access: { has: obj => "getKeyLockerEntry" in obj, get: obj => obj.getKeyLockerEntry }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
86
|
+
__esDecorate(this, null, _sendUserCapabilitiesReport_decorators, { kind: "method", name: "sendUserCapabilitiesReport", static: false, private: false, access: { has: obj => "sendUserCapabilitiesReport" in obj, get: obj => obj.sendUserCapabilitiesReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
87
|
+
__esDecorate(this, null, _sendCredentialCapabilitiesReport_decorators, { kind: "method", name: "sendCredentialCapabilitiesReport", static: false, private: false, access: { has: obj => "sendCredentialCapabilitiesReport" in obj, get: obj => obj.sendCredentialCapabilitiesReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
88
|
+
__esDecorate(this, null, _sendKeyLockerCapabilitiesReport_decorators, { kind: "method", name: "sendKeyLockerCapabilitiesReport", static: false, private: false, access: { has: obj => "sendKeyLockerCapabilitiesReport" in obj, get: obj => obj.sendKeyLockerCapabilitiesReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
89
|
+
__esDecorate(this, null, _sendUserReport_decorators, { kind: "method", name: "sendUserReport", static: false, private: false, access: { has: obj => "sendUserReport" in obj, get: obj => obj.sendUserReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
90
|
+
__esDecorate(this, null, _sendCredentialReport_decorators, { kind: "method", name: "sendCredentialReport", static: false, private: false, access: { has: obj => "sendCredentialReport" in obj, get: obj => obj.sendCredentialReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
91
|
+
__esDecorate(this, null, _sendCredentialLearnReport_decorators, { kind: "method", name: "sendCredentialLearnReport", static: false, private: false, access: { has: obj => "sendCredentialLearnReport" in obj, get: obj => obj.sendCredentialLearnReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
92
|
+
__esDecorate(this, null, _sendUserCredentialAssociationReport_decorators, { kind: "method", name: "sendUserCredentialAssociationReport", static: false, private: false, access: { has: obj => "sendUserCredentialAssociationReport" in obj, get: obj => obj.sendUserCredentialAssociationReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
93
|
+
__esDecorate(this, null, _sendAllUsersChecksumReport_decorators, { kind: "method", name: "sendAllUsersChecksumReport", static: false, private: false, access: { has: obj => "sendAllUsersChecksumReport" in obj, get: obj => obj.sendAllUsersChecksumReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
94
|
+
__esDecorate(this, null, _sendUserChecksumReport_decorators, { kind: "method", name: "sendUserChecksumReport", static: false, private: false, access: { has: obj => "sendUserChecksumReport" in obj, get: obj => obj.sendUserChecksumReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
95
|
+
__esDecorate(this, null, _sendCredentialChecksumReport_decorators, { kind: "method", name: "sendCredentialChecksumReport", static: false, private: false, access: { has: obj => "sendCredentialChecksumReport" in obj, get: obj => obj.sendCredentialChecksumReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
96
|
+
__esDecorate(this, null, _sendAdminPinCodeReport_decorators, { kind: "method", name: "sendAdminPinCodeReport", static: false, private: false, access: { has: obj => "sendAdminPinCodeReport" in obj, get: obj => obj.sendAdminPinCodeReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
97
|
+
__esDecorate(this, null, _sendKeyLockerEntryReport_decorators, { kind: "method", name: "sendKeyLockerEntryReport", static: false, private: false, access: { has: obj => "sendKeyLockerEntryReport" in obj, get: obj => obj.sendKeyLockerEntryReport }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
98
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
99
|
+
UserCredentialCCAPI = _classThis = _classDescriptor.value;
|
|
100
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
101
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
102
|
+
}
|
|
103
|
+
supportsCommand(cmd) {
|
|
104
|
+
switch (cmd) {
|
|
105
|
+
// Mandatory v1 commands
|
|
106
|
+
case UserCredentialCommand.UserCapabilitiesGet:
|
|
107
|
+
case UserCredentialCommand.UserCapabilitiesReport:
|
|
108
|
+
case UserCredentialCommand.CredentialCapabilitiesGet:
|
|
109
|
+
case UserCredentialCommand.CredentialCapabilitiesReport:
|
|
110
|
+
case UserCredentialCommand.UserSet:
|
|
111
|
+
case UserCredentialCommand.UserGet:
|
|
112
|
+
case UserCredentialCommand.UserReport:
|
|
113
|
+
case UserCredentialCommand.CredentialSet:
|
|
114
|
+
case UserCredentialCommand.CredentialGet:
|
|
115
|
+
case UserCredentialCommand.CredentialReport:
|
|
116
|
+
case UserCredentialCommand.CredentialLearnStart:
|
|
117
|
+
case UserCredentialCommand.CredentialLearnCancel:
|
|
118
|
+
case UserCredentialCommand.CredentialLearnReport:
|
|
119
|
+
case UserCredentialCommand.UserCredentialAssociationSet:
|
|
120
|
+
case UserCredentialCommand.UserCredentialAssociationReport:
|
|
121
|
+
return true;
|
|
122
|
+
case UserCredentialCommand.AllUsersChecksumGet:
|
|
123
|
+
case UserCredentialCommand.AllUsersChecksumReport: {
|
|
124
|
+
return this.tryGetValueDB()?.getValue(UserCredentialCCValues.supportsAllUsersChecksum.endpoint(this.endpoint.index));
|
|
125
|
+
}
|
|
126
|
+
case UserCredentialCommand.UserChecksumGet:
|
|
127
|
+
case UserCredentialCommand.UserChecksumReport: {
|
|
128
|
+
return this.tryGetValueDB()?.getValue(UserCredentialCCValues.supportsUserChecksum.endpoint(this.endpoint.index));
|
|
129
|
+
}
|
|
130
|
+
case UserCredentialCommand.CredentialChecksumGet:
|
|
131
|
+
case UserCredentialCommand.CredentialChecksumReport: {
|
|
132
|
+
return this.tryGetValueDB()?.getValue(UserCredentialCCValues.supportsCredentialChecksum
|
|
133
|
+
.endpoint(this.endpoint.index));
|
|
134
|
+
}
|
|
135
|
+
case UserCredentialCommand.AdminPinCodeSet:
|
|
136
|
+
case UserCredentialCommand.AdminPinCodeGet:
|
|
137
|
+
case UserCredentialCommand.AdminPinCodeReport: {
|
|
138
|
+
return this.tryGetValueDB()?.getValue(UserCredentialCCValues.supportsAdminCode.endpoint(this.endpoint.index));
|
|
139
|
+
}
|
|
140
|
+
// V2 commands
|
|
141
|
+
case UserCredentialCommand.KeyLockerCapabilitiesGet:
|
|
142
|
+
case UserCredentialCommand.KeyLockerCapabilitiesReport:
|
|
143
|
+
case UserCredentialCommand.KeyLockerEntrySet:
|
|
144
|
+
case UserCredentialCommand.KeyLockerEntryGet:
|
|
145
|
+
case UserCredentialCommand.KeyLockerEntryReport:
|
|
146
|
+
return this.version >= 2;
|
|
147
|
+
}
|
|
148
|
+
return super.supportsCommand(cmd);
|
|
149
|
+
}
|
|
150
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types
|
|
151
|
+
async getUserCapabilities() {
|
|
152
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserCapabilitiesGet);
|
|
153
|
+
const cc = new UserCredentialCCUserCapabilitiesGet({
|
|
154
|
+
nodeId: this.endpoint.nodeId,
|
|
155
|
+
endpointIndex: this.endpoint.index,
|
|
156
|
+
});
|
|
157
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
158
|
+
if (response) {
|
|
159
|
+
return pick(response, [
|
|
160
|
+
"numberOfSupportedUsers",
|
|
161
|
+
"supportedCredentialRules",
|
|
162
|
+
"maxUserNameLength",
|
|
163
|
+
"supportsUserSchedule",
|
|
164
|
+
"supportsAllUsersChecksum",
|
|
165
|
+
"supportsUserChecksum",
|
|
166
|
+
"supportedUserNameEncodings",
|
|
167
|
+
"supportedUserTypes",
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types
|
|
172
|
+
async getCredentialCapabilities() {
|
|
173
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialCapabilitiesGet);
|
|
174
|
+
const cc = new UserCredentialCCCredentialCapabilitiesGet({
|
|
175
|
+
nodeId: this.endpoint.nodeId,
|
|
176
|
+
endpointIndex: this.endpoint.index,
|
|
177
|
+
});
|
|
178
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
179
|
+
if (response) {
|
|
180
|
+
return pick(response, [
|
|
181
|
+
"supportsCredentialChecksum",
|
|
182
|
+
"supportsAdminCode",
|
|
183
|
+
"supportsAdminCodeDeactivation",
|
|
184
|
+
"credentialTypes",
|
|
185
|
+
]);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types
|
|
189
|
+
async getKeyLockerCapabilities() {
|
|
190
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.KeyLockerCapabilitiesGet);
|
|
191
|
+
const cc = new UserCredentialCCKeyLockerCapabilitiesGet({
|
|
192
|
+
nodeId: this.endpoint.nodeId,
|
|
193
|
+
endpointIndex: this.endpoint.index,
|
|
194
|
+
});
|
|
195
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
196
|
+
return response?.keyLockerCapabilities;
|
|
197
|
+
}
|
|
198
|
+
// User Management
|
|
199
|
+
async setUser(options) {
|
|
200
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserSet);
|
|
201
|
+
const cc = new UserCredentialCCUserSet({
|
|
202
|
+
nodeId: this.endpoint.nodeId,
|
|
203
|
+
endpointIndex: this.endpoint.index,
|
|
204
|
+
...options,
|
|
205
|
+
});
|
|
206
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
207
|
+
}
|
|
208
|
+
async getUser(userId) {
|
|
209
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserGet);
|
|
210
|
+
const cc = new UserCredentialCCUserGet({
|
|
211
|
+
nodeId: this.endpoint.nodeId,
|
|
212
|
+
endpointIndex: this.endpoint.index,
|
|
213
|
+
userId,
|
|
214
|
+
});
|
|
215
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
216
|
+
if (response) {
|
|
217
|
+
return pick(response, [
|
|
218
|
+
"nextUserId",
|
|
219
|
+
"modifierType",
|
|
220
|
+
"modifierNodeId",
|
|
221
|
+
"userId",
|
|
222
|
+
"userType",
|
|
223
|
+
"active",
|
|
224
|
+
"credentialRule",
|
|
225
|
+
"expiringTimeoutMinutes",
|
|
226
|
+
"nameEncoding",
|
|
227
|
+
"userName",
|
|
228
|
+
]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Credential Management
|
|
232
|
+
async setCredential(options) {
|
|
233
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialSet);
|
|
234
|
+
const cc = new UserCredentialCCCredentialSet({
|
|
235
|
+
nodeId: this.endpoint.nodeId,
|
|
236
|
+
endpointIndex: this.endpoint.index,
|
|
237
|
+
...options,
|
|
238
|
+
});
|
|
239
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
240
|
+
}
|
|
241
|
+
async getCredential(userId, credentialType, credentialSlot) {
|
|
242
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialGet);
|
|
243
|
+
const cc = new UserCredentialCCCredentialGet({
|
|
244
|
+
nodeId: this.endpoint.nodeId,
|
|
245
|
+
endpointIndex: this.endpoint.index,
|
|
246
|
+
userId,
|
|
247
|
+
credentialType,
|
|
248
|
+
credentialSlot,
|
|
249
|
+
});
|
|
250
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
251
|
+
if (response) {
|
|
252
|
+
return pick(response, [
|
|
253
|
+
// UserId, credential type and slot can be zero in the
|
|
254
|
+
// request to return the first credential, so we cannot
|
|
255
|
+
// simply omit them here
|
|
256
|
+
"userId",
|
|
257
|
+
"credentialType",
|
|
258
|
+
"credentialSlot",
|
|
259
|
+
"credentialReadBack",
|
|
260
|
+
"credentialLength",
|
|
261
|
+
"credentialData",
|
|
262
|
+
"modifierType",
|
|
263
|
+
"modifierNodeId",
|
|
264
|
+
"nextCredentialType",
|
|
265
|
+
"nextCredentialSlot",
|
|
266
|
+
]);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async startCredentialLearn(options) {
|
|
270
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialLearnStart);
|
|
271
|
+
// The node will ignore the command if credential learning is not
|
|
272
|
+
// supported for this credential type (CC:0083.01.0F.11.004)
|
|
273
|
+
const caps = UserCredentialCC.getCredentialCapabilitiesCached(this.host, this.endpoint, options.credentialType);
|
|
274
|
+
if (caps && !caps.supportsCredentialLearn) {
|
|
275
|
+
throw new ZWaveError(`Credential learning is not supported for credential type ${getEnumMemberName(UserCredentialType, options.credentialType)}`, ZWaveErrorCodes.CC_NotSupported);
|
|
276
|
+
}
|
|
277
|
+
const cc = new UserCredentialCCCredentialLearnStart({
|
|
278
|
+
nodeId: this.endpoint.nodeId,
|
|
279
|
+
endpointIndex: this.endpoint.index,
|
|
280
|
+
...options,
|
|
281
|
+
});
|
|
282
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
283
|
+
}
|
|
284
|
+
async cancelCredentialLearn() {
|
|
285
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialLearnCancel);
|
|
286
|
+
const cc = new UserCredentialCCCredentialLearnCancel({
|
|
287
|
+
nodeId: this.endpoint.nodeId,
|
|
288
|
+
endpointIndex: this.endpoint.index,
|
|
289
|
+
});
|
|
290
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
291
|
+
}
|
|
292
|
+
async setUserCredentialAssociation(options) {
|
|
293
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserCredentialAssociationSet);
|
|
294
|
+
const cc = new UserCredentialCCUserCredentialAssociationSet({
|
|
295
|
+
nodeId: this.endpoint.nodeId,
|
|
296
|
+
endpointIndex: this.endpoint.index,
|
|
297
|
+
...options,
|
|
298
|
+
});
|
|
299
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
300
|
+
}
|
|
301
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types
|
|
302
|
+
async getAllUsersChecksum() {
|
|
303
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.AllUsersChecksumGet);
|
|
304
|
+
const cc = new UserCredentialCCAllUsersChecksumGet({
|
|
305
|
+
nodeId: this.endpoint.nodeId,
|
|
306
|
+
endpointIndex: this.endpoint.index,
|
|
307
|
+
});
|
|
308
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
309
|
+
return response?.checksum;
|
|
310
|
+
}
|
|
311
|
+
async getUserChecksum(userId) {
|
|
312
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserChecksumGet);
|
|
313
|
+
const cc = new UserCredentialCCUserChecksumGet({
|
|
314
|
+
nodeId: this.endpoint.nodeId,
|
|
315
|
+
endpointIndex: this.endpoint.index,
|
|
316
|
+
userId,
|
|
317
|
+
});
|
|
318
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
319
|
+
return response?.checksum;
|
|
320
|
+
}
|
|
321
|
+
async getCredentialChecksum(credentialType) {
|
|
322
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialChecksumGet);
|
|
323
|
+
const cc = new UserCredentialCCCredentialChecksumGet({
|
|
324
|
+
nodeId: this.endpoint.nodeId,
|
|
325
|
+
endpointIndex: this.endpoint.index,
|
|
326
|
+
credentialType,
|
|
327
|
+
});
|
|
328
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
329
|
+
return response?.checksum;
|
|
330
|
+
}
|
|
331
|
+
async setAdminPinCode(options) {
|
|
332
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.AdminPinCodeSet);
|
|
333
|
+
// Deactivating the admin code (empty string) requires ACD support,
|
|
334
|
+
// otherwise the node may ignore the command (CC:0083.01.1A.13.003)
|
|
335
|
+
if (options.pinCode.length === 0) {
|
|
336
|
+
const supportsDeactivation = this.tryGetValueDB()?.getValue(UserCredentialCCValues.supportsAdminCodeDeactivation.endpoint(this.endpoint.index));
|
|
337
|
+
if (supportsDeactivation === false) {
|
|
338
|
+
throw new ZWaveError("This node does not support deactivating the Admin Code", ZWaveErrorCodes.CC_NotSupported);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const cc = new UserCredentialCCAdminPinCodeSet({
|
|
342
|
+
nodeId: this.endpoint.nodeId,
|
|
343
|
+
endpointIndex: this.endpoint.index,
|
|
344
|
+
...options,
|
|
345
|
+
});
|
|
346
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
347
|
+
}
|
|
348
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types
|
|
349
|
+
async getAdminPinCode() {
|
|
350
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.AdminPinCodeGet);
|
|
351
|
+
const cc = new UserCredentialCCAdminPinCodeGet({
|
|
352
|
+
nodeId: this.endpoint.nodeId,
|
|
353
|
+
endpointIndex: this.endpoint.index,
|
|
354
|
+
});
|
|
355
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
356
|
+
return response?.pinCode;
|
|
357
|
+
}
|
|
358
|
+
async setKeyLockerEntry(options) {
|
|
359
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.KeyLockerEntrySet);
|
|
360
|
+
const cc = new UserCredentialCCKeyLockerEntrySet({
|
|
361
|
+
nodeId: this.endpoint.nodeId,
|
|
362
|
+
endpointIndex: this.endpoint.index,
|
|
363
|
+
...options,
|
|
364
|
+
});
|
|
365
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
366
|
+
}
|
|
367
|
+
async getKeyLockerEntry(entryType, entrySlot) {
|
|
368
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.KeyLockerEntryGet);
|
|
369
|
+
const cc = new UserCredentialCCKeyLockerEntryGet({
|
|
370
|
+
nodeId: this.endpoint.nodeId,
|
|
371
|
+
endpointIndex: this.endpoint.index,
|
|
372
|
+
entryType,
|
|
373
|
+
entrySlot,
|
|
374
|
+
});
|
|
375
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
376
|
+
if (response) {
|
|
377
|
+
return pick(response, [
|
|
378
|
+
"occupied",
|
|
379
|
+
"entryType",
|
|
380
|
+
"entrySlot",
|
|
381
|
+
]);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
async sendUserCapabilitiesReport(options) {
|
|
385
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserCapabilitiesReport);
|
|
386
|
+
const cc = new UserCredentialCCUserCapabilitiesReport({
|
|
387
|
+
nodeId: this.endpoint.nodeId,
|
|
388
|
+
endpointIndex: this.endpoint.index,
|
|
389
|
+
...options,
|
|
390
|
+
});
|
|
391
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
392
|
+
}
|
|
393
|
+
async sendCredentialCapabilitiesReport(options) {
|
|
394
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialCapabilitiesReport);
|
|
395
|
+
const cc = new UserCredentialCCCredentialCapabilitiesReport({
|
|
396
|
+
nodeId: this.endpoint.nodeId,
|
|
397
|
+
endpointIndex: this.endpoint.index,
|
|
398
|
+
...options,
|
|
399
|
+
});
|
|
400
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
401
|
+
}
|
|
402
|
+
async sendKeyLockerCapabilitiesReport(options) {
|
|
403
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.KeyLockerCapabilitiesReport);
|
|
404
|
+
const cc = new UserCredentialCCKeyLockerCapabilitiesReport({
|
|
405
|
+
nodeId: this.endpoint.nodeId,
|
|
406
|
+
endpointIndex: this.endpoint.index,
|
|
407
|
+
...options,
|
|
408
|
+
});
|
|
409
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
410
|
+
}
|
|
411
|
+
async sendUserReport(options) {
|
|
412
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserReport);
|
|
413
|
+
const cc = new UserCredentialCCUserReport({
|
|
414
|
+
nodeId: this.endpoint.nodeId,
|
|
415
|
+
endpointIndex: this.endpoint.index,
|
|
416
|
+
...options,
|
|
417
|
+
});
|
|
418
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
419
|
+
}
|
|
420
|
+
async sendCredentialReport(options) {
|
|
421
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialReport);
|
|
422
|
+
const cc = new UserCredentialCCCredentialReport({
|
|
423
|
+
nodeId: this.endpoint.nodeId,
|
|
424
|
+
endpointIndex: this.endpoint.index,
|
|
425
|
+
...options,
|
|
426
|
+
});
|
|
427
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
428
|
+
}
|
|
429
|
+
async sendCredentialLearnReport(options) {
|
|
430
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialLearnReport);
|
|
431
|
+
const cc = new UserCredentialCCCredentialLearnReport({
|
|
432
|
+
nodeId: this.endpoint.nodeId,
|
|
433
|
+
endpointIndex: this.endpoint.index,
|
|
434
|
+
...options,
|
|
435
|
+
});
|
|
436
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
437
|
+
}
|
|
438
|
+
async sendUserCredentialAssociationReport(options) {
|
|
439
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserCredentialAssociationReport);
|
|
440
|
+
const cc = new UserCredentialCCUserCredentialAssociationReport({
|
|
441
|
+
nodeId: this.endpoint.nodeId,
|
|
442
|
+
endpointIndex: this.endpoint.index,
|
|
443
|
+
...options,
|
|
444
|
+
});
|
|
445
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
446
|
+
}
|
|
447
|
+
async sendAllUsersChecksumReport(options) {
|
|
448
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.AllUsersChecksumReport);
|
|
449
|
+
const cc = new UserCredentialCCAllUsersChecksumReport({
|
|
450
|
+
nodeId: this.endpoint.nodeId,
|
|
451
|
+
endpointIndex: this.endpoint.index,
|
|
452
|
+
...options,
|
|
453
|
+
});
|
|
454
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
455
|
+
}
|
|
456
|
+
async sendUserChecksumReport(options) {
|
|
457
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.UserChecksumReport);
|
|
458
|
+
const cc = new UserCredentialCCUserChecksumReport({
|
|
459
|
+
nodeId: this.endpoint.nodeId,
|
|
460
|
+
endpointIndex: this.endpoint.index,
|
|
461
|
+
...options,
|
|
462
|
+
});
|
|
463
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
464
|
+
}
|
|
465
|
+
async sendCredentialChecksumReport(options) {
|
|
466
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.CredentialChecksumReport);
|
|
467
|
+
const cc = new UserCredentialCCCredentialChecksumReport({
|
|
468
|
+
nodeId: this.endpoint.nodeId,
|
|
469
|
+
endpointIndex: this.endpoint.index,
|
|
470
|
+
...options,
|
|
471
|
+
});
|
|
472
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
473
|
+
}
|
|
474
|
+
async sendAdminPinCodeReport(options) {
|
|
475
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.AdminPinCodeReport);
|
|
476
|
+
const cc = new UserCredentialCCAdminPinCodeReport({
|
|
477
|
+
nodeId: this.endpoint.nodeId,
|
|
478
|
+
endpointIndex: this.endpoint.index,
|
|
479
|
+
...options,
|
|
480
|
+
});
|
|
481
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
482
|
+
}
|
|
483
|
+
async sendKeyLockerEntryReport(options) {
|
|
484
|
+
this.assertSupportsCommand(UserCredentialCommand, UserCredentialCommand.KeyLockerEntryReport);
|
|
485
|
+
const cc = new UserCredentialCCKeyLockerEntryReport({
|
|
486
|
+
nodeId: this.endpoint.nodeId,
|
|
487
|
+
endpointIndex: this.endpoint.index,
|
|
488
|
+
...options,
|
|
489
|
+
});
|
|
490
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
491
|
+
}
|
|
492
|
+
constructor() {
|
|
493
|
+
super(...arguments);
|
|
494
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
return UserCredentialCCAPI = _classThis;
|
|
498
|
+
})();
|
|
499
|
+
export { UserCredentialCCAPI };
|
|
500
|
+
let UserCredentialCC = (() => {
|
|
501
|
+
let _classDecorators = [commandClass(CommandClasses["User Credential"]), implementedVersion(2), ccValues(UserCredentialCCValues)];
|
|
502
|
+
let _classDescriptor;
|
|
503
|
+
let _classExtraInitializers = [];
|
|
504
|
+
let _classThis;
|
|
505
|
+
let _classSuper = CommandClass;
|
|
506
|
+
var UserCredentialCC = class extends _classSuper {
|
|
507
|
+
static { _classThis = this; }
|
|
508
|
+
static {
|
|
509
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
510
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
511
|
+
UserCredentialCC = _classThis = _classDescriptor.value;
|
|
512
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
513
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
514
|
+
}
|
|
515
|
+
async interview(ctx) {
|
|
516
|
+
const node = this.getNode(ctx);
|
|
517
|
+
const endpoint = this.getEndpoint(ctx);
|
|
518
|
+
const api = CCAPI.create(CommandClasses["User Credential"], ctx, endpoint).withOptions({
|
|
519
|
+
priority: MessagePriority.NodeQuery,
|
|
520
|
+
});
|
|
521
|
+
ctx.logNode(node.id, {
|
|
522
|
+
endpoint: this.endpointIndex,
|
|
523
|
+
message: "querying user capabilities...",
|
|
524
|
+
direction: "outbound",
|
|
525
|
+
});
|
|
526
|
+
const userCaps = await api.getUserCapabilities();
|
|
527
|
+
if (!userCaps) {
|
|
528
|
+
ctx.logNode(node.id, {
|
|
529
|
+
endpoint: this.endpointIndex,
|
|
530
|
+
message: "User capabilities query timed out - skipping interview",
|
|
531
|
+
level: "warn",
|
|
532
|
+
});
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
ctx.logNode(node.id, {
|
|
536
|
+
endpoint: this.endpointIndex,
|
|
537
|
+
message: "querying credential capabilities...",
|
|
538
|
+
direction: "outbound",
|
|
539
|
+
});
|
|
540
|
+
const credCaps = await api.getCredentialCapabilities();
|
|
541
|
+
if (!credCaps) {
|
|
542
|
+
ctx.logNode(node.id, {
|
|
543
|
+
endpoint: this.endpointIndex,
|
|
544
|
+
message: "Credential capabilities query timed out - skipping interview",
|
|
545
|
+
level: "warn",
|
|
546
|
+
});
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (api.version >= 2) {
|
|
550
|
+
ctx.logNode(node.id, {
|
|
551
|
+
endpoint: this.endpointIndex,
|
|
552
|
+
message: "querying key locker capabilities...",
|
|
553
|
+
direction: "outbound",
|
|
554
|
+
});
|
|
555
|
+
await api.getKeyLockerCapabilities();
|
|
556
|
+
}
|
|
557
|
+
await this.refreshValues(ctx);
|
|
558
|
+
this.setInterviewComplete(ctx, true);
|
|
559
|
+
}
|
|
560
|
+
async refreshValues(ctx) {
|
|
561
|
+
const node = this.getNode(ctx);
|
|
562
|
+
const endpoint = this.getEndpoint(ctx);
|
|
563
|
+
const api = CCAPI.create(CommandClasses["User Credential"], ctx, endpoint).withOptions({
|
|
564
|
+
priority: MessagePriority.NodeQuery,
|
|
565
|
+
});
|
|
566
|
+
const supportsAllUsersChecksum = this.getValue(ctx, UserCredentialCCValues.supportsAllUsersChecksum);
|
|
567
|
+
const supportsUserChecksum = this.getValue(ctx, UserCredentialCCValues.supportsUserChecksum);
|
|
568
|
+
const supportsAdminCode = this.getValue(ctx, UserCredentialCCValues.supportsAdminCode);
|
|
569
|
+
const supportedKeyLockerEntryTypes = this.getValue(ctx, UserCredentialCCValues.supportedKeyLockerEntryTypes);
|
|
570
|
+
// If possible use the all-users checksum to determine whether to
|
|
571
|
+
// skip full sync of all users and credentials
|
|
572
|
+
let skipFullSync = false;
|
|
573
|
+
let allUsersChecksum;
|
|
574
|
+
if (supportsAllUsersChecksum) {
|
|
575
|
+
allUsersChecksum = await api.getAllUsersChecksum();
|
|
576
|
+
const cachedChecksum = this.getValue(ctx, UserCredentialCCValues.allUsersChecksum);
|
|
577
|
+
if (allUsersChecksum != undefined
|
|
578
|
+
&& cachedChecksum != undefined
|
|
579
|
+
&& allUsersChecksum === cachedChecksum) {
|
|
580
|
+
ctx.logNode(node.id, {
|
|
581
|
+
endpoint: this.endpointIndex,
|
|
582
|
+
message: "all-users checksum unchanged, skipping full sync",
|
|
583
|
+
direction: "none",
|
|
584
|
+
});
|
|
585
|
+
skipFullSync = true;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if (!skipFullSync) {
|
|
589
|
+
// Iterate all users starting from UUID 0
|
|
590
|
+
let nextUserId = 0;
|
|
591
|
+
let previousUserId = 0;
|
|
592
|
+
do {
|
|
593
|
+
ctx.logNode(node.id, {
|
|
594
|
+
endpoint: this.endpointIndex,
|
|
595
|
+
message: `querying user with UUID ${nextUserId}...`,
|
|
596
|
+
direction: "outbound",
|
|
597
|
+
});
|
|
598
|
+
const user = await api.getUser(nextUserId);
|
|
599
|
+
if (!user?.userId)
|
|
600
|
+
break; // No user found, stop iterating
|
|
601
|
+
const currentUserId = user.userId;
|
|
602
|
+
// Purge cached data for any users in the gap between the
|
|
603
|
+
// last reported user and this one
|
|
604
|
+
for (let gapUserId = previousUserId + 1; gapUserId < currentUserId; gapUserId++) {
|
|
605
|
+
this.purgeUserFromCache(ctx, gapUserId);
|
|
606
|
+
}
|
|
607
|
+
// If possible use the checksum to determine whether to sync
|
|
608
|
+
// credentials for this user
|
|
609
|
+
let userChecksum;
|
|
610
|
+
let syncCredentials = true;
|
|
611
|
+
if (supportsUserChecksum) {
|
|
612
|
+
userChecksum = await api.getUserChecksum(currentUserId);
|
|
613
|
+
const cachedUserChecksum = this.getValue(ctx, UserCredentialCCValues.userChecksum(currentUserId));
|
|
614
|
+
if (userChecksum != undefined
|
|
615
|
+
&& cachedUserChecksum != undefined
|
|
616
|
+
&& userChecksum === cachedUserChecksum) {
|
|
617
|
+
ctx.logNode(node.id, {
|
|
618
|
+
endpoint: this.endpointIndex,
|
|
619
|
+
message: `user ${currentUserId} checksum unchanged, skipping credential sync`,
|
|
620
|
+
direction: "none",
|
|
621
|
+
});
|
|
622
|
+
syncCredentials = false;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (syncCredentials) {
|
|
626
|
+
await this.queryCredentialsForUser(ctx, api, node.id, currentUserId);
|
|
627
|
+
if (userChecksum != undefined) {
|
|
628
|
+
this.setValue(ctx, UserCredentialCCValues.userChecksum(currentUserId), userChecksum);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
previousUserId = currentUserId;
|
|
632
|
+
nextUserId = user.nextUserId;
|
|
633
|
+
} while (nextUserId > 0);
|
|
634
|
+
}
|
|
635
|
+
// After querying all users, save the checksum for the next refresh.
|
|
636
|
+
if (allUsersChecksum != undefined) {
|
|
637
|
+
this.setValue(ctx, UserCredentialCCValues.allUsersChecksum, allUsersChecksum);
|
|
638
|
+
}
|
|
639
|
+
// Query admin PIN code if supported
|
|
640
|
+
if (supportsAdminCode) {
|
|
641
|
+
ctx.logNode(node.id, {
|
|
642
|
+
endpoint: this.endpointIndex,
|
|
643
|
+
message: "querying admin PIN code...",
|
|
644
|
+
direction: "outbound",
|
|
645
|
+
});
|
|
646
|
+
await api.getAdminPinCode();
|
|
647
|
+
}
|
|
648
|
+
// Query key locker entries (V2)
|
|
649
|
+
if (api.version >= 2 && supportedKeyLockerEntryTypes?.length) {
|
|
650
|
+
for (const entryType of supportedKeyLockerEntryTypes) {
|
|
651
|
+
const entry = this.getValue(ctx, UserCredentialCCValues.keyLockerCapabilities(entryType));
|
|
652
|
+
if (!entry)
|
|
653
|
+
continue;
|
|
654
|
+
for (let slot = 1; slot <= entry.numberOfEntrySlots; slot++) {
|
|
655
|
+
ctx.logNode(node.id, {
|
|
656
|
+
endpoint: this.endpointIndex,
|
|
657
|
+
message: `querying key locker entry type ${entryType}, slot ${slot}...`,
|
|
658
|
+
direction: "outbound",
|
|
659
|
+
});
|
|
660
|
+
await api.getKeyLockerEntry(entryType, slot);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
purgeUserFromCache(ctx, userId) {
|
|
666
|
+
// Remove all per-user values
|
|
667
|
+
this.removeValue(ctx, UserCredentialCCValues.userType(userId));
|
|
668
|
+
this.removeValue(ctx, UserCredentialCCValues.userActive(userId));
|
|
669
|
+
this.removeValue(ctx, UserCredentialCCValues.credentialRule(userId));
|
|
670
|
+
this.removeValue(ctx, UserCredentialCCValues.expiringTimeoutMinutes(userId));
|
|
671
|
+
this.removeValue(ctx, UserCredentialCCValues.userName(userId));
|
|
672
|
+
this.removeValue(ctx, UserCredentialCCValues.userModifierType(userId));
|
|
673
|
+
this.removeValue(ctx, UserCredentialCCValues.userModifierNodeId(userId));
|
|
674
|
+
this.removeValue(ctx, UserCredentialCCValues.userChecksum(userId));
|
|
675
|
+
// Remove all credential values for this user
|
|
676
|
+
const valueDB = this.getValueDB(ctx);
|
|
677
|
+
const credentialValues = valueDB.findValues((vid) => (UserCredentialCCValues.credential.is(vid)
|
|
678
|
+
|| UserCredentialCCValues.credentialModifierType.is(vid)
|
|
679
|
+
|| UserCredentialCCValues.credentialModifierNodeId.is(vid))
|
|
680
|
+
// The property key is constructed as (userId << 24) | (type << 16) | slot, so we can filter by userId
|
|
681
|
+
&& (vid.propertyKey >> 24) === userId);
|
|
682
|
+
for (const { commandClass, endpoint, property, propertyKey } of credentialValues) {
|
|
683
|
+
valueDB.removeValue({
|
|
684
|
+
commandClass,
|
|
685
|
+
endpoint,
|
|
686
|
+
property,
|
|
687
|
+
propertyKey,
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
async queryCredentialsForUser(ctx, api, nodeId, userId) {
|
|
692
|
+
// Start with credential type 0, slot 0 to get the first credential for this user
|
|
693
|
+
let nextCredType = UserCredentialType.None;
|
|
694
|
+
let nextCredSlot = 0;
|
|
695
|
+
do {
|
|
696
|
+
ctx.logNode(nodeId, {
|
|
697
|
+
endpoint: this.endpointIndex,
|
|
698
|
+
message: `querying credential for user ${userId}, type ${nextCredType}, slot ${nextCredSlot}...`,
|
|
699
|
+
direction: "outbound",
|
|
700
|
+
});
|
|
701
|
+
const cred = await api.getCredential(userId, nextCredType, nextCredSlot);
|
|
702
|
+
if (!cred?.credentialSlot)
|
|
703
|
+
break; // No credential found, stop iterating
|
|
704
|
+
nextCredType = cred.nextCredentialType;
|
|
705
|
+
nextCredSlot = cred.nextCredentialSlot;
|
|
706
|
+
} while (nextCredType !== UserCredentialType.None || nextCredSlot !== 0);
|
|
707
|
+
}
|
|
708
|
+
static getSupportedUsersCached(ctx, endpoint) {
|
|
709
|
+
return ctx
|
|
710
|
+
.getValueDB(endpoint.nodeId)
|
|
711
|
+
.getValue(UserCredentialCCValues.supportedUsers.endpoint(endpoint.index));
|
|
712
|
+
}
|
|
713
|
+
static getSupportedCredentialTypesCached(ctx, endpoint) {
|
|
714
|
+
return ctx
|
|
715
|
+
.getValueDB(endpoint.nodeId)
|
|
716
|
+
.getValue(UserCredentialCCValues.supportedCredentialTypes.endpoint(endpoint.index));
|
|
717
|
+
}
|
|
718
|
+
static getCredentialCapabilitiesCached(ctx, endpoint, credentialType) {
|
|
719
|
+
return ctx
|
|
720
|
+
.getValueDB(endpoint.nodeId)
|
|
721
|
+
.getValue(UserCredentialCCValues.credentialCapabilities(credentialType).endpoint(endpoint.index));
|
|
722
|
+
}
|
|
723
|
+
static supportsAdminCodeCached(ctx, endpoint) {
|
|
724
|
+
return (ctx
|
|
725
|
+
.getValueDB(endpoint.nodeId)
|
|
726
|
+
.getValue(UserCredentialCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? false);
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
return UserCredentialCC = _classThis;
|
|
730
|
+
})();
|
|
731
|
+
export { UserCredentialCC };
|
|
732
|
+
let UserCredentialCCUserCapabilitiesReport = (() => {
|
|
733
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserCapabilitiesReport), ccValueProperty("numberOfSupportedUsers", UserCredentialCCValues.supportedUsers), ccValueProperty("supportedCredentialRules", UserCredentialCCValues.supportedCredentialRules), ccValueProperty("maxUserNameLength", UserCredentialCCValues.maxUserNameLength), ccValueProperty("supportsUserSchedule", UserCredentialCCValues.supportsUserSchedule), ccValueProperty("supportsAllUsersChecksum", UserCredentialCCValues.supportsAllUsersChecksum), ccValueProperty("supportsUserChecksum", UserCredentialCCValues.supportsUserChecksum), ccValueProperty("supportedUserNameEncodings", UserCredentialCCValues.supportedUserNameEncodings), ccValueProperty("supportedUserTypes", UserCredentialCCValues.supportedUserTypes)];
|
|
734
|
+
let _classDescriptor;
|
|
735
|
+
let _classExtraInitializers = [];
|
|
736
|
+
let _classThis;
|
|
737
|
+
let _classSuper = UserCredentialCC;
|
|
738
|
+
var UserCredentialCCUserCapabilitiesReport = class extends _classSuper {
|
|
739
|
+
static { _classThis = this; }
|
|
740
|
+
static {
|
|
741
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
742
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
743
|
+
UserCredentialCCUserCapabilitiesReport = _classThis = _classDescriptor.value;
|
|
744
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
745
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
746
|
+
}
|
|
747
|
+
constructor(options) {
|
|
748
|
+
super(options);
|
|
749
|
+
this.numberOfSupportedUsers = options.numberOfSupportedUsers;
|
|
750
|
+
this.supportedCredentialRules = options.supportedCredentialRules;
|
|
751
|
+
this.maxUserNameLength = options.maxUserNameLength;
|
|
752
|
+
this.supportsUserSchedule = options.supportsUserSchedule;
|
|
753
|
+
this.supportsAllUsersChecksum = options.supportsAllUsersChecksum;
|
|
754
|
+
this.supportsUserChecksum = options.supportsUserChecksum;
|
|
755
|
+
this.supportedUserNameEncodings = options.supportedUserNameEncodings;
|
|
756
|
+
this.supportedUserTypes = options.supportedUserTypes;
|
|
757
|
+
}
|
|
758
|
+
static from(raw, ctx) {
|
|
759
|
+
validatePayload(raw.payload.length >= 4);
|
|
760
|
+
const numberOfSupportedUsers = raw.payload.readUInt16BE(0);
|
|
761
|
+
const credentialRulesBitmask = raw.payload[2];
|
|
762
|
+
const supportedCredentialRules = parseBitMask(Bytes.from([credentialRulesBitmask]), 0).filter((v) => v in UserCredentialRule);
|
|
763
|
+
const maxUserNameLength = raw.payload[3];
|
|
764
|
+
validatePayload(raw.payload.length >= 5);
|
|
765
|
+
const flagsByte = raw.payload[4];
|
|
766
|
+
const supportsUserSchedule = !!(flagsByte & 128);
|
|
767
|
+
const supportsAllUsersChecksum = !!(flagsByte & 64);
|
|
768
|
+
const supportsUserChecksum = !!(flagsByte & 32);
|
|
769
|
+
// Name encoding bitmask in bits 4:2
|
|
770
|
+
const nameEncodingBitmask = (flagsByte >> 2) & 0b111;
|
|
771
|
+
let supportedUserNameEncodings;
|
|
772
|
+
if (nameEncodingBitmask === 0) {
|
|
773
|
+
// All encodings assumed supported per spec
|
|
774
|
+
supportedUserNameEncodings = [
|
|
775
|
+
UserCredentialNameEncoding.ASCII,
|
|
776
|
+
UserCredentialNameEncoding.ExtendedASCII,
|
|
777
|
+
UserCredentialNameEncoding.UTF16BE,
|
|
778
|
+
];
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
supportedUserNameEncodings = parseBitMask(Bytes.from([nameEncodingBitmask]), 0).filter((v) => v in UserCredentialNameEncoding);
|
|
782
|
+
}
|
|
783
|
+
validatePayload(raw.payload.length >= 6);
|
|
784
|
+
const userTypesBitmaskLength = raw.payload[5];
|
|
785
|
+
validatePayload(raw.payload.length >= 6 + userTypesBitmaskLength);
|
|
786
|
+
const supportedUserTypes = parseBitMask(raw.payload.subarray(6, 6 + userTypesBitmaskLength), 0).filter((v) => v in UserCredentialUserType);
|
|
787
|
+
return new this({
|
|
788
|
+
nodeId: ctx.sourceNodeId,
|
|
789
|
+
numberOfSupportedUsers,
|
|
790
|
+
supportedCredentialRules,
|
|
791
|
+
maxUserNameLength,
|
|
792
|
+
supportsUserSchedule,
|
|
793
|
+
supportsAllUsersChecksum,
|
|
794
|
+
supportsUserChecksum,
|
|
795
|
+
supportedUserNameEncodings,
|
|
796
|
+
supportedUserTypes,
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
numberOfSupportedUsers;
|
|
800
|
+
supportedCredentialRules;
|
|
801
|
+
maxUserNameLength;
|
|
802
|
+
supportsUserSchedule;
|
|
803
|
+
supportsAllUsersChecksum;
|
|
804
|
+
supportsUserChecksum;
|
|
805
|
+
supportedUserNameEncodings;
|
|
806
|
+
supportedUserTypes;
|
|
807
|
+
serialize(ctx) {
|
|
808
|
+
const credentialRulesBitmask = encodeBitMask(this.supportedCredentialRules, UserCredentialRule.Triple, 0);
|
|
809
|
+
const nameEncodingBitmask = encodeBitMask(this.supportedUserNameEncodings, UserCredentialNameEncoding.UTF16BE, UserCredentialNameEncoding.ASCII);
|
|
810
|
+
const flagsByte = (this.supportsUserSchedule ? 0x80 : 0)
|
|
811
|
+
| (this.supportsAllUsersChecksum ? 0x40 : 0)
|
|
812
|
+
| (this.supportsUserChecksum ? 0x20 : 0)
|
|
813
|
+
| ((nameEncodingBitmask[0] & 0b111) << 2);
|
|
814
|
+
const userTypesBitmask = encodeBitMask(this.supportedUserTypes, UserCredentialUserType.RemoteOnly, UserCredentialUserType.General);
|
|
815
|
+
this.payload = Bytes.alloc(6 + userTypesBitmask.length);
|
|
816
|
+
this.payload.writeUInt16BE(this.numberOfSupportedUsers, 0);
|
|
817
|
+
this.payload[2] = credentialRulesBitmask[0];
|
|
818
|
+
this.payload[3] = this.maxUserNameLength;
|
|
819
|
+
this.payload[4] = flagsByte;
|
|
820
|
+
this.payload[5] = userTypesBitmask.length;
|
|
821
|
+
this.payload.set(userTypesBitmask, 6);
|
|
822
|
+
return super.serialize(ctx);
|
|
823
|
+
}
|
|
824
|
+
toLogEntry(ctx) {
|
|
825
|
+
return {
|
|
826
|
+
...super.toLogEntry(ctx),
|
|
827
|
+
message: {
|
|
828
|
+
"supported users": this.numberOfSupportedUsers,
|
|
829
|
+
"supported credential rules": this.supportedCredentialRules
|
|
830
|
+
.map((r) => getEnumMemberName(UserCredentialRule, r))
|
|
831
|
+
.join(", "),
|
|
832
|
+
"max user name length": this.maxUserNameLength,
|
|
833
|
+
"user schedule support": this.supportsUserSchedule,
|
|
834
|
+
"all users checksum support": this.supportsAllUsersChecksum,
|
|
835
|
+
"user checksum support": this.supportsUserChecksum,
|
|
836
|
+
"supported name encodings": this.supportedUserNameEncodings
|
|
837
|
+
.map((e) => getEnumMemberName(UserCredentialNameEncoding, e))
|
|
838
|
+
.join(", "),
|
|
839
|
+
"supported user types": this.supportedUserTypes
|
|
840
|
+
.map((t) => getEnumMemberName(UserCredentialUserType, t))
|
|
841
|
+
.join(", "),
|
|
842
|
+
},
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
return UserCredentialCCUserCapabilitiesReport = _classThis;
|
|
847
|
+
})();
|
|
848
|
+
export { UserCredentialCCUserCapabilitiesReport };
|
|
849
|
+
let UserCredentialCCUserCapabilitiesGet = (() => {
|
|
850
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserCapabilitiesGet), expectedCCResponse(UserCredentialCCUserCapabilitiesReport)];
|
|
851
|
+
let _classDescriptor;
|
|
852
|
+
let _classExtraInitializers = [];
|
|
853
|
+
let _classThis;
|
|
854
|
+
let _classSuper = UserCredentialCC;
|
|
855
|
+
var UserCredentialCCUserCapabilitiesGet = class extends _classSuper {
|
|
856
|
+
static { _classThis = this; }
|
|
857
|
+
static {
|
|
858
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
859
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
860
|
+
UserCredentialCCUserCapabilitiesGet = _classThis = _classDescriptor.value;
|
|
861
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
862
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
return UserCredentialCCUserCapabilitiesGet = _classThis;
|
|
866
|
+
})();
|
|
867
|
+
export { UserCredentialCCUserCapabilitiesGet };
|
|
868
|
+
let UserCredentialCCCredentialCapabilitiesReport = (() => {
|
|
869
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialCapabilitiesReport), ccValueProperty("supportsCredentialChecksum", UserCredentialCCValues.supportsCredentialChecksum), ccValueProperty("supportsAdminCode", UserCredentialCCValues.supportsAdminCode), ccValueProperty("supportsAdminCodeDeactivation", UserCredentialCCValues.supportsAdminCodeDeactivation)];
|
|
870
|
+
let _classDescriptor;
|
|
871
|
+
let _classExtraInitializers = [];
|
|
872
|
+
let _classThis;
|
|
873
|
+
let _classSuper = UserCredentialCC;
|
|
874
|
+
var UserCredentialCCCredentialCapabilitiesReport = class extends _classSuper {
|
|
875
|
+
static { _classThis = this; }
|
|
876
|
+
static {
|
|
877
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
878
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
879
|
+
UserCredentialCCCredentialCapabilitiesReport = _classThis = _classDescriptor.value;
|
|
880
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
881
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
882
|
+
}
|
|
883
|
+
constructor(options) {
|
|
884
|
+
super(options);
|
|
885
|
+
this.supportsCredentialChecksum = options.supportsCredentialChecksum;
|
|
886
|
+
this.supportsAdminCode = options.supportsAdminCode;
|
|
887
|
+
this.supportsAdminCodeDeactivation =
|
|
888
|
+
options.supportsAdminCodeDeactivation;
|
|
889
|
+
this.credentialTypes = options.credentialTypes;
|
|
890
|
+
}
|
|
891
|
+
static from(raw, ctx) {
|
|
892
|
+
validatePayload(raw.payload.length >= 2);
|
|
893
|
+
const flagsByte = raw.payload[0];
|
|
894
|
+
const supportsCredentialChecksum = !!(flagsByte & 128);
|
|
895
|
+
const supportsAdminCode = !!(flagsByte & 64);
|
|
896
|
+
const supportsAdminCodeDeactivation = !!(flagsByte & 32);
|
|
897
|
+
const numberOfCredentialTypes = raw.payload[1];
|
|
898
|
+
const n = numberOfCredentialTypes;
|
|
899
|
+
validatePayload(raw.payload.length >= 2 + n * 9);
|
|
900
|
+
const credentialTypes = new Map();
|
|
901
|
+
// Grouped block offsets
|
|
902
|
+
const credTypeOff = 2;
|
|
903
|
+
const clSupportOff = credTypeOff + n;
|
|
904
|
+
const numSlotsOff = clSupportOff + n;
|
|
905
|
+
const minLenOff = numSlotsOff + n * 2;
|
|
906
|
+
const maxLenOff = minLenOff + n;
|
|
907
|
+
const clTimeoutOff = maxLenOff + n;
|
|
908
|
+
const clStepsOff = clTimeoutOff + n;
|
|
909
|
+
const maxHashLenOff = clStepsOff + n;
|
|
910
|
+
for (let i = 0; i < n; i++) {
|
|
911
|
+
const credentialType = raw.payload[credTypeOff + i];
|
|
912
|
+
const clByte = raw.payload[clSupportOff + i];
|
|
913
|
+
const supportsCredentialLearn = !!(clByte & 128);
|
|
914
|
+
const numberOfCredentialSlots = raw.payload.readUInt16BE(numSlotsOff + i * 2);
|
|
915
|
+
const minCredentialLength = raw.payload[minLenOff + i];
|
|
916
|
+
const maxCredentialLength = raw.payload[maxLenOff + i];
|
|
917
|
+
const credentialLearnRecommendedTimeout = raw.payload[clTimeoutOff + i];
|
|
918
|
+
const credentialLearnNumberOfSteps = raw.payload[clStepsOff + i];
|
|
919
|
+
const maxCredentialHashLength = raw.payload[maxHashLenOff + i];
|
|
920
|
+
if (supportsCredentialLearn) {
|
|
921
|
+
validatePayload(credentialLearnRecommendedTimeout > 0);
|
|
922
|
+
validatePayload(credentialLearnNumberOfSteps > 0);
|
|
923
|
+
credentialTypes.set(credentialType, {
|
|
924
|
+
supportsCredentialLearn,
|
|
925
|
+
numberOfCredentialSlots,
|
|
926
|
+
minCredentialLength,
|
|
927
|
+
maxCredentialLength,
|
|
928
|
+
credentialLearnRecommendedTimeout,
|
|
929
|
+
credentialLearnNumberOfSteps,
|
|
930
|
+
maxCredentialHashLength,
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
validatePayload(credentialLearnRecommendedTimeout === 0);
|
|
935
|
+
validatePayload(credentialLearnNumberOfSteps === 0);
|
|
936
|
+
credentialTypes.set(credentialType, {
|
|
937
|
+
supportsCredentialLearn,
|
|
938
|
+
numberOfCredentialSlots,
|
|
939
|
+
minCredentialLength,
|
|
940
|
+
maxCredentialLength,
|
|
941
|
+
maxCredentialHashLength,
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
return new this({
|
|
946
|
+
nodeId: ctx.sourceNodeId,
|
|
947
|
+
supportsCredentialChecksum,
|
|
948
|
+
supportsAdminCode,
|
|
949
|
+
supportsAdminCodeDeactivation,
|
|
950
|
+
credentialTypes: credentialTypes,
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
supportsCredentialChecksum;
|
|
954
|
+
supportsAdminCode;
|
|
955
|
+
supportsAdminCodeDeactivation;
|
|
956
|
+
credentialTypes;
|
|
957
|
+
persistValues(ctx) {
|
|
958
|
+
if (!super.persistValues(ctx))
|
|
959
|
+
return false;
|
|
960
|
+
this.setValue(ctx, UserCredentialCCValues.supportedCredentialTypes, [...this.credentialTypes.keys()]);
|
|
961
|
+
for (const [credentialType, capability] of this.credentialTypes) {
|
|
962
|
+
this.setValue(ctx, UserCredentialCCValues.credentialCapabilities(credentialType), capability);
|
|
963
|
+
}
|
|
964
|
+
return true;
|
|
965
|
+
}
|
|
966
|
+
serialize(ctx) {
|
|
967
|
+
const n = this.credentialTypes.size;
|
|
968
|
+
this.payload = Bytes.alloc(2 + n * 9);
|
|
969
|
+
this.payload[0] = (this.supportsCredentialChecksum ? 0x80 : 0)
|
|
970
|
+
| (this.supportsAdminCode ? 0x40 : 0)
|
|
971
|
+
| (this.supportsAdminCodeDeactivation ? 0x20 : 0);
|
|
972
|
+
this.payload[1] = n;
|
|
973
|
+
const credTypeOff = 2;
|
|
974
|
+
const clSupportOff = credTypeOff + n;
|
|
975
|
+
const numSlotsOff = clSupportOff + n;
|
|
976
|
+
const minLenOff = numSlotsOff + n * 2;
|
|
977
|
+
const maxLenOff = minLenOff + n;
|
|
978
|
+
const clTimeoutOff = maxLenOff + n;
|
|
979
|
+
const clStepsOff = clTimeoutOff + n;
|
|
980
|
+
const maxHashLenOff = clStepsOff + n;
|
|
981
|
+
let i = 0;
|
|
982
|
+
for (const [credentialType, ct] of this.credentialTypes) {
|
|
983
|
+
this.payload[credTypeOff + i] = credentialType;
|
|
984
|
+
this.payload[clSupportOff + i] = ct.supportsCredentialLearn
|
|
985
|
+
? 0x80
|
|
986
|
+
: 0;
|
|
987
|
+
this.payload.writeUInt16BE(ct.numberOfCredentialSlots, numSlotsOff + i * 2);
|
|
988
|
+
this.payload[minLenOff + i] = ct.minCredentialLength;
|
|
989
|
+
this.payload[maxLenOff + i] = ct.maxCredentialLength;
|
|
990
|
+
this.payload[clTimeoutOff + i] =
|
|
991
|
+
ct.credentialLearnRecommendedTimeout ?? 0;
|
|
992
|
+
this.payload[clStepsOff + i] = ct.credentialLearnNumberOfSteps ?? 0;
|
|
993
|
+
this.payload[maxHashLenOff + i] = ct.maxCredentialHashLength;
|
|
994
|
+
i++;
|
|
995
|
+
}
|
|
996
|
+
return super.serialize(ctx);
|
|
997
|
+
}
|
|
998
|
+
toLogEntry(ctx) {
|
|
999
|
+
const message = {
|
|
1000
|
+
"credential checksum support": this.supportsCredentialChecksum,
|
|
1001
|
+
"admin code support": this.supportsAdminCode,
|
|
1002
|
+
"admin code deactivation support": this.supportsAdminCodeDeactivation,
|
|
1003
|
+
};
|
|
1004
|
+
for (const [credentialType, ct] of this.credentialTypes) {
|
|
1005
|
+
message[`credential type ${getEnumMemberName(UserCredentialType, credentialType)}`] = `slots: ${ct.numberOfCredentialSlots}, length: ${ct.minCredentialLength}-${ct.maxCredentialLength}`;
|
|
1006
|
+
}
|
|
1007
|
+
return {
|
|
1008
|
+
...super.toLogEntry(ctx),
|
|
1009
|
+
message,
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
return UserCredentialCCCredentialCapabilitiesReport = _classThis;
|
|
1014
|
+
})();
|
|
1015
|
+
export { UserCredentialCCCredentialCapabilitiesReport };
|
|
1016
|
+
let UserCredentialCCCredentialCapabilitiesGet = (() => {
|
|
1017
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialCapabilitiesGet), expectedCCResponse(UserCredentialCCCredentialCapabilitiesReport)];
|
|
1018
|
+
let _classDescriptor;
|
|
1019
|
+
let _classExtraInitializers = [];
|
|
1020
|
+
let _classThis;
|
|
1021
|
+
let _classSuper = UserCredentialCC;
|
|
1022
|
+
var UserCredentialCCCredentialCapabilitiesGet = class extends _classSuper {
|
|
1023
|
+
static { _classThis = this; }
|
|
1024
|
+
static {
|
|
1025
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1026
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1027
|
+
UserCredentialCCCredentialCapabilitiesGet = _classThis = _classDescriptor.value;
|
|
1028
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1029
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
return UserCredentialCCCredentialCapabilitiesGet = _classThis;
|
|
1033
|
+
})();
|
|
1034
|
+
export { UserCredentialCCCredentialCapabilitiesGet };
|
|
1035
|
+
let UserCredentialCCKeyLockerCapabilitiesReport = (() => {
|
|
1036
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.KeyLockerCapabilitiesReport)];
|
|
1037
|
+
let _classDescriptor;
|
|
1038
|
+
let _classExtraInitializers = [];
|
|
1039
|
+
let _classThis;
|
|
1040
|
+
let _classSuper = UserCredentialCC;
|
|
1041
|
+
var UserCredentialCCKeyLockerCapabilitiesReport = class extends _classSuper {
|
|
1042
|
+
static { _classThis = this; }
|
|
1043
|
+
static {
|
|
1044
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1045
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1046
|
+
UserCredentialCCKeyLockerCapabilitiesReport = _classThis = _classDescriptor.value;
|
|
1047
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1048
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1049
|
+
}
|
|
1050
|
+
constructor(options) {
|
|
1051
|
+
super(options);
|
|
1052
|
+
this.keyLockerCapabilities = options.keyLockerCapabilities;
|
|
1053
|
+
}
|
|
1054
|
+
static from(raw, ctx) {
|
|
1055
|
+
validatePayload(raw.payload.length >= 1);
|
|
1056
|
+
const numberOfEntryTypes = raw.payload[0];
|
|
1057
|
+
const n = numberOfEntryTypes;
|
|
1058
|
+
validatePayload(raw.payload.length >= 1 + n * 7);
|
|
1059
|
+
const keyLockerCapabilities = new Map();
|
|
1060
|
+
// Grouped block offsets
|
|
1061
|
+
const entryTypeOff = 1;
|
|
1062
|
+
const numSlotsOff = entryTypeOff + n;
|
|
1063
|
+
const minLenOff = numSlotsOff + n * 2;
|
|
1064
|
+
const maxLenOff = minLenOff + n * 2;
|
|
1065
|
+
for (let i = 0; i < n; i++) {
|
|
1066
|
+
const entryType = raw.payload[entryTypeOff + i];
|
|
1067
|
+
const numberOfEntrySlots = raw.payload.readUInt16BE(numSlotsOff + i * 2);
|
|
1068
|
+
const minEntryDataLength = raw.payload.readUInt16BE(minLenOff + i * 2);
|
|
1069
|
+
const maxEntryDataLength = raw.payload.readUInt16BE(maxLenOff + i * 2);
|
|
1070
|
+
keyLockerCapabilities.set(entryType, {
|
|
1071
|
+
numberOfEntrySlots,
|
|
1072
|
+
minEntryDataLength,
|
|
1073
|
+
maxEntryDataLength,
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
return new this({
|
|
1077
|
+
nodeId: ctx.sourceNodeId,
|
|
1078
|
+
keyLockerCapabilities,
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
keyLockerCapabilities;
|
|
1082
|
+
persistValues(ctx) {
|
|
1083
|
+
if (!super.persistValues(ctx))
|
|
1084
|
+
return false;
|
|
1085
|
+
this.setValue(ctx, UserCredentialCCValues.supportedKeyLockerEntryTypes, [...this.keyLockerCapabilities.keys()]);
|
|
1086
|
+
for (const [entryType, capability] of this.keyLockerCapabilities) {
|
|
1087
|
+
this.setValue(ctx, UserCredentialCCValues.keyLockerCapabilities(entryType), capability);
|
|
1088
|
+
}
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
serialize(ctx) {
|
|
1092
|
+
const n = this.keyLockerCapabilities.size;
|
|
1093
|
+
this.payload = Bytes.alloc(1 + n * 7);
|
|
1094
|
+
this.payload[0] = n;
|
|
1095
|
+
const entryTypeOff = 1;
|
|
1096
|
+
const numSlotsOff = entryTypeOff + n;
|
|
1097
|
+
const minLenOff = numSlotsOff + n * 2;
|
|
1098
|
+
const maxLenOff = minLenOff + n * 2;
|
|
1099
|
+
let i = 0;
|
|
1100
|
+
for (const [entryType, capability] of this.keyLockerCapabilities) {
|
|
1101
|
+
this.payload[entryTypeOff + i] = entryType;
|
|
1102
|
+
this.payload.writeUInt16BE(capability.numberOfEntrySlots, numSlotsOff + i * 2);
|
|
1103
|
+
this.payload.writeUInt16BE(capability.minEntryDataLength, minLenOff + i * 2);
|
|
1104
|
+
this.payload.writeUInt16BE(capability.maxEntryDataLength, maxLenOff + i * 2);
|
|
1105
|
+
i++;
|
|
1106
|
+
}
|
|
1107
|
+
return super.serialize(ctx);
|
|
1108
|
+
}
|
|
1109
|
+
toLogEntry(ctx) {
|
|
1110
|
+
const message = {};
|
|
1111
|
+
for (const [entryType, capability] of this.keyLockerCapabilities) {
|
|
1112
|
+
message[`entry type ${getEnumMemberName(UserCredentialKeyLockerEntryType, entryType)}`] = `slots: ${capability.numberOfEntrySlots}, length: ${capability.minEntryDataLength}-${capability.maxEntryDataLength}`;
|
|
1113
|
+
}
|
|
1114
|
+
return {
|
|
1115
|
+
...super.toLogEntry(ctx),
|
|
1116
|
+
message,
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
return UserCredentialCCKeyLockerCapabilitiesReport = _classThis;
|
|
1121
|
+
})();
|
|
1122
|
+
export { UserCredentialCCKeyLockerCapabilitiesReport };
|
|
1123
|
+
let UserCredentialCCKeyLockerCapabilitiesGet = (() => {
|
|
1124
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.KeyLockerCapabilitiesGet), expectedCCResponse(UserCredentialCCKeyLockerCapabilitiesReport)];
|
|
1125
|
+
let _classDescriptor;
|
|
1126
|
+
let _classExtraInitializers = [];
|
|
1127
|
+
let _classThis;
|
|
1128
|
+
let _classSuper = UserCredentialCC;
|
|
1129
|
+
var UserCredentialCCKeyLockerCapabilitiesGet = class extends _classSuper {
|
|
1130
|
+
static { _classThis = this; }
|
|
1131
|
+
static {
|
|
1132
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1133
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1134
|
+
UserCredentialCCKeyLockerCapabilitiesGet = _classThis = _classDescriptor.value;
|
|
1135
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1136
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
return UserCredentialCCKeyLockerCapabilitiesGet = _classThis;
|
|
1140
|
+
})();
|
|
1141
|
+
export { UserCredentialCCKeyLockerCapabilitiesGet };
|
|
1142
|
+
let UserCredentialCCUserSet = (() => {
|
|
1143
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserSet), useSupervision()];
|
|
1144
|
+
let _classDescriptor;
|
|
1145
|
+
let _classExtraInitializers = [];
|
|
1146
|
+
let _classThis;
|
|
1147
|
+
let _classSuper = UserCredentialCC;
|
|
1148
|
+
var UserCredentialCCUserSet = class extends _classSuper {
|
|
1149
|
+
static { _classThis = this; }
|
|
1150
|
+
static {
|
|
1151
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1152
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1153
|
+
UserCredentialCCUserSet = _classThis = _classDescriptor.value;
|
|
1154
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1155
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1156
|
+
}
|
|
1157
|
+
constructor(options) {
|
|
1158
|
+
super(options);
|
|
1159
|
+
this.operationType = options.operationType;
|
|
1160
|
+
this.userId = options.userId;
|
|
1161
|
+
if (options.operationType !== UserCredentialOperationType.Delete) {
|
|
1162
|
+
this.userType = options.userType;
|
|
1163
|
+
this.active = options.active;
|
|
1164
|
+
this.credentialRule = options.credentialRule;
|
|
1165
|
+
this.expiringTimeoutMinutes = options.expiringTimeoutMinutes;
|
|
1166
|
+
this.nameEncoding = options.nameEncoding;
|
|
1167
|
+
this.userName = options.userName;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
operationType;
|
|
1171
|
+
userId;
|
|
1172
|
+
userType;
|
|
1173
|
+
active;
|
|
1174
|
+
credentialRule;
|
|
1175
|
+
expiringTimeoutMinutes;
|
|
1176
|
+
nameEncoding;
|
|
1177
|
+
userName;
|
|
1178
|
+
static from(raw, ctx) {
|
|
1179
|
+
validatePayload(raw.payload.length >= 3);
|
|
1180
|
+
const operationType = raw.payload[0]
|
|
1181
|
+
& 0b11;
|
|
1182
|
+
const userId = raw.payload.readUInt16BE(1);
|
|
1183
|
+
if (operationType === UserCredentialOperationType.Delete) {
|
|
1184
|
+
return new this({
|
|
1185
|
+
nodeId: ctx.sourceNodeId,
|
|
1186
|
+
operationType,
|
|
1187
|
+
userId,
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
// For Delete, the remaining fields MAY be omitted
|
|
1191
|
+
if (raw.payload.length < 10) {
|
|
1192
|
+
return new this({
|
|
1193
|
+
nodeId: ctx.sourceNodeId,
|
|
1194
|
+
operationType,
|
|
1195
|
+
userId,
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
const userType = raw.payload[3];
|
|
1199
|
+
const active = !!(raw.payload[4] & 0b1);
|
|
1200
|
+
const credentialRule = raw.payload[5];
|
|
1201
|
+
const expiringTimeoutMinutes = raw.payload.readUInt16BE(6);
|
|
1202
|
+
const nameEncoding = raw.payload[8] & 0b111;
|
|
1203
|
+
const nameLength = raw.payload[9];
|
|
1204
|
+
validatePayload(raw.payload.length >= 10 + nameLength);
|
|
1205
|
+
let userName;
|
|
1206
|
+
if (nameEncoding === UserCredentialNameEncoding.UTF16BE) {
|
|
1207
|
+
userName = uint8ArrayToStringUTF16BE(raw.payload.subarray(10, 10 + nameLength));
|
|
1208
|
+
}
|
|
1209
|
+
else {
|
|
1210
|
+
userName = raw.payload
|
|
1211
|
+
.subarray(10, 10 + nameLength)
|
|
1212
|
+
.toString("ascii");
|
|
1213
|
+
}
|
|
1214
|
+
if (userType === UserCredentialUserType.Expiring) {
|
|
1215
|
+
return new this({
|
|
1216
|
+
nodeId: ctx.sourceNodeId,
|
|
1217
|
+
operationType,
|
|
1218
|
+
userId,
|
|
1219
|
+
userType,
|
|
1220
|
+
expiringTimeoutMinutes,
|
|
1221
|
+
active,
|
|
1222
|
+
credentialRule,
|
|
1223
|
+
nameEncoding,
|
|
1224
|
+
userName,
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
return new this({
|
|
1228
|
+
nodeId: ctx.sourceNodeId,
|
|
1229
|
+
operationType,
|
|
1230
|
+
userId,
|
|
1231
|
+
userType,
|
|
1232
|
+
active,
|
|
1233
|
+
credentialRule,
|
|
1234
|
+
nameEncoding,
|
|
1235
|
+
userName,
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
serialize(ctx) {
|
|
1239
|
+
// For Delete, remaining user-detail fields MAY be omitted
|
|
1240
|
+
if (this.operationType === UserCredentialOperationType.Delete) {
|
|
1241
|
+
this.payload = Bytes.alloc(3);
|
|
1242
|
+
this.payload[0] = this.operationType & 0b11;
|
|
1243
|
+
this.payload.writeUInt16BE(this.userId, 1);
|
|
1244
|
+
return super.serialize(ctx);
|
|
1245
|
+
}
|
|
1246
|
+
if (this.userType == undefined) {
|
|
1247
|
+
throw new ZWaveError(`${this.constructor.name}: user type must be set for Add/Modify operations`, ZWaveErrorCodes.Argument_Invalid);
|
|
1248
|
+
}
|
|
1249
|
+
if (this.active == undefined) {
|
|
1250
|
+
throw new ZWaveError(`${this.constructor.name}: The active flag must be set for Add/Modify operations`, ZWaveErrorCodes.Argument_Invalid);
|
|
1251
|
+
}
|
|
1252
|
+
// Credential rule defaults to Single
|
|
1253
|
+
const credentialRule = this.credentialRule ?? UserCredentialRule.Single;
|
|
1254
|
+
// Expiring timeout MUST be 0 for non-Expiring user types
|
|
1255
|
+
let expiringTimeoutMinutes;
|
|
1256
|
+
if (this.userType === UserCredentialUserType.Expiring) {
|
|
1257
|
+
if (this.expiringTimeoutMinutes == undefined) {
|
|
1258
|
+
throw new ZWaveError(`${this.constructor.name}: expiring timeout minutes must be set for Expiring user type`, ZWaveErrorCodes.Argument_Invalid);
|
|
1259
|
+
}
|
|
1260
|
+
expiringTimeoutMinutes = this.expiringTimeoutMinutes;
|
|
1261
|
+
}
|
|
1262
|
+
else {
|
|
1263
|
+
expiringTimeoutMinutes = 0;
|
|
1264
|
+
}
|
|
1265
|
+
// Name encoding defaults to ASCII
|
|
1266
|
+
const nameEncoding = this.nameEncoding
|
|
1267
|
+
?? UserCredentialNameEncoding.ASCII;
|
|
1268
|
+
// User name defaults to empty string
|
|
1269
|
+
const userName = this.userName ?? "";
|
|
1270
|
+
let nameBuffer;
|
|
1271
|
+
if (nameEncoding === UserCredentialNameEncoding.UTF16BE) {
|
|
1272
|
+
nameBuffer = stringToUint8ArrayUTF16BE(userName);
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1275
|
+
nameBuffer = Bytes.from(userName, "ascii");
|
|
1276
|
+
}
|
|
1277
|
+
this.payload = Bytes.alloc(10 + nameBuffer.length);
|
|
1278
|
+
this.payload[0] = this.operationType & 0b11;
|
|
1279
|
+
this.payload.writeUInt16BE(this.userId, 1);
|
|
1280
|
+
this.payload[3] = this.userType;
|
|
1281
|
+
this.payload[4] = this.active ? 0b1 : 0;
|
|
1282
|
+
this.payload[5] = credentialRule;
|
|
1283
|
+
this.payload.writeUInt16BE(expiringTimeoutMinutes, 6);
|
|
1284
|
+
this.payload[8] = nameEncoding & 0b111;
|
|
1285
|
+
this.payload[9] = nameBuffer.length;
|
|
1286
|
+
if (nameBuffer.length > 0) {
|
|
1287
|
+
this.payload.set(nameBuffer, 10);
|
|
1288
|
+
}
|
|
1289
|
+
return super.serialize(ctx);
|
|
1290
|
+
}
|
|
1291
|
+
toLogEntry(ctx) {
|
|
1292
|
+
const message = {
|
|
1293
|
+
"operation type": getEnumMemberName(UserCredentialOperationType, this.operationType),
|
|
1294
|
+
"user ID": this.userId,
|
|
1295
|
+
};
|
|
1296
|
+
if (this.userType != undefined) {
|
|
1297
|
+
message["user type"] = getEnumMemberName(UserCredentialUserType, this.userType);
|
|
1298
|
+
}
|
|
1299
|
+
if (this.active != undefined) {
|
|
1300
|
+
message["active"] = this.active;
|
|
1301
|
+
}
|
|
1302
|
+
if (this.credentialRule != undefined) {
|
|
1303
|
+
message["credential rule"] = getEnumMemberName(UserCredentialRule, this.credentialRule);
|
|
1304
|
+
}
|
|
1305
|
+
if (this.expiringTimeoutMinutes != undefined) {
|
|
1306
|
+
message["expiring timeout (minutes)"] = this.expiringTimeoutMinutes;
|
|
1307
|
+
}
|
|
1308
|
+
if (this.nameEncoding != undefined) {
|
|
1309
|
+
message["name encoding"] = getEnumMemberName(UserCredentialNameEncoding, this.nameEncoding);
|
|
1310
|
+
}
|
|
1311
|
+
if (this.userName != undefined) {
|
|
1312
|
+
message["user name"] = this.userName;
|
|
1313
|
+
}
|
|
1314
|
+
return { ...super.toLogEntry(ctx), message };
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
return UserCredentialCCUserSet = _classThis;
|
|
1318
|
+
})();
|
|
1319
|
+
export { UserCredentialCCUserSet };
|
|
1320
|
+
let UserCredentialCCUserReport = (() => {
|
|
1321
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserReport)];
|
|
1322
|
+
let _classDescriptor;
|
|
1323
|
+
let _classExtraInitializers = [];
|
|
1324
|
+
let _classThis;
|
|
1325
|
+
let _classSuper = UserCredentialCC;
|
|
1326
|
+
var UserCredentialCCUserReport = class extends _classSuper {
|
|
1327
|
+
static { _classThis = this; }
|
|
1328
|
+
static {
|
|
1329
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1330
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1331
|
+
UserCredentialCCUserReport = _classThis = _classDescriptor.value;
|
|
1332
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1333
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1334
|
+
}
|
|
1335
|
+
constructor(options) {
|
|
1336
|
+
super(options);
|
|
1337
|
+
this.reportType = options.reportType;
|
|
1338
|
+
this.nextUserId = options.nextUserId;
|
|
1339
|
+
this.modifierType = options.modifierType;
|
|
1340
|
+
this.modifierNodeId = options.modifierNodeId;
|
|
1341
|
+
this.userId = options.userId;
|
|
1342
|
+
this.userType = options.userType;
|
|
1343
|
+
this.active = options.active;
|
|
1344
|
+
this.credentialRule = options.credentialRule;
|
|
1345
|
+
this.expiringTimeoutMinutes = options.expiringTimeoutMinutes;
|
|
1346
|
+
this.nameEncoding = options.nameEncoding;
|
|
1347
|
+
this.userName = options.userName;
|
|
1348
|
+
}
|
|
1349
|
+
static from(raw, ctx) {
|
|
1350
|
+
validatePayload(raw.payload.length >= 13);
|
|
1351
|
+
const reportType = raw.payload[0];
|
|
1352
|
+
const nextUserId = raw.payload.readUInt16BE(1);
|
|
1353
|
+
const modifierType = raw.payload[3];
|
|
1354
|
+
const modifierNodeId = raw.payload.readUInt16BE(4);
|
|
1355
|
+
const userId = raw.payload.readUInt16BE(6);
|
|
1356
|
+
const userType = raw.payload[8];
|
|
1357
|
+
const active = !!(raw.payload[9] & 0b1);
|
|
1358
|
+
const credentialRule = raw.payload[10];
|
|
1359
|
+
const expiringTimeoutMinutes = raw.payload.readUInt16BE(11);
|
|
1360
|
+
validatePayload(raw.payload.length >= 15);
|
|
1361
|
+
const nameEncoding = raw.payload[13]
|
|
1362
|
+
& 0b111;
|
|
1363
|
+
const nameLength = raw.payload[14];
|
|
1364
|
+
validatePayload(raw.payload.length >= 15 + nameLength);
|
|
1365
|
+
let userName;
|
|
1366
|
+
if (nameEncoding === UserCredentialNameEncoding.UTF16BE) {
|
|
1367
|
+
userName = uint8ArrayToStringUTF16BE(raw.payload.subarray(15, 15 + nameLength));
|
|
1368
|
+
}
|
|
1369
|
+
else {
|
|
1370
|
+
userName = raw.payload
|
|
1371
|
+
.subarray(15, 15 + nameLength)
|
|
1372
|
+
.toString("ascii");
|
|
1373
|
+
}
|
|
1374
|
+
return new this({
|
|
1375
|
+
nodeId: ctx.sourceNodeId,
|
|
1376
|
+
reportType,
|
|
1377
|
+
nextUserId,
|
|
1378
|
+
modifierType,
|
|
1379
|
+
modifierNodeId,
|
|
1380
|
+
userId,
|
|
1381
|
+
userType,
|
|
1382
|
+
active,
|
|
1383
|
+
credentialRule,
|
|
1384
|
+
expiringTimeoutMinutes,
|
|
1385
|
+
nameEncoding,
|
|
1386
|
+
userName,
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
reportType;
|
|
1390
|
+
nextUserId;
|
|
1391
|
+
modifierType;
|
|
1392
|
+
modifierNodeId;
|
|
1393
|
+
userId;
|
|
1394
|
+
userType;
|
|
1395
|
+
active;
|
|
1396
|
+
credentialRule;
|
|
1397
|
+
expiringTimeoutMinutes;
|
|
1398
|
+
nameEncoding;
|
|
1399
|
+
userName;
|
|
1400
|
+
serialize(ctx) {
|
|
1401
|
+
let nameBuffer;
|
|
1402
|
+
if (this.nameEncoding === UserCredentialNameEncoding.UTF16BE) {
|
|
1403
|
+
nameBuffer = stringToUint8ArrayUTF16BE(this.userName);
|
|
1404
|
+
}
|
|
1405
|
+
else {
|
|
1406
|
+
nameBuffer = Bytes.from(this.userName, "ascii");
|
|
1407
|
+
}
|
|
1408
|
+
this.payload = Bytes.alloc(15 + nameBuffer.length);
|
|
1409
|
+
this.payload[0] = this.reportType;
|
|
1410
|
+
this.payload.writeUInt16BE(this.nextUserId, 1);
|
|
1411
|
+
this.payload[3] = this.modifierType;
|
|
1412
|
+
this.payload.writeUInt16BE(this.modifierNodeId, 4);
|
|
1413
|
+
this.payload.writeUInt16BE(this.userId, 6);
|
|
1414
|
+
this.payload[8] = this.userType;
|
|
1415
|
+
this.payload[9] = this.active ? 0b1 : 0;
|
|
1416
|
+
this.payload[10] = this.credentialRule;
|
|
1417
|
+
this.payload.writeUInt16BE(this.expiringTimeoutMinutes, 11);
|
|
1418
|
+
this.payload[13] = this.nameEncoding & 0b111;
|
|
1419
|
+
this.payload[14] = nameBuffer.length;
|
|
1420
|
+
if (nameBuffer.length > 0) {
|
|
1421
|
+
this.payload.set(nameBuffer, 15);
|
|
1422
|
+
}
|
|
1423
|
+
return super.serialize(ctx);
|
|
1424
|
+
}
|
|
1425
|
+
persistValues(ctx) {
|
|
1426
|
+
if (!super.persistValues(ctx))
|
|
1427
|
+
return false;
|
|
1428
|
+
if (this.userId === 0)
|
|
1429
|
+
return true;
|
|
1430
|
+
// Only persist data for successful responses
|
|
1431
|
+
if (this.reportType
|
|
1432
|
+
=== UserCredentialUserReportType.UserDeleted) {
|
|
1433
|
+
// Remove all values for this user
|
|
1434
|
+
const userId = this.userId;
|
|
1435
|
+
this.removeValue(ctx, UserCredentialCCValues.userType(userId));
|
|
1436
|
+
this.removeValue(ctx, UserCredentialCCValues.userActive(userId));
|
|
1437
|
+
this.removeValue(ctx, UserCredentialCCValues.credentialRule(userId));
|
|
1438
|
+
this.removeValue(ctx, UserCredentialCCValues.expiringTimeoutMinutes(userId));
|
|
1439
|
+
this.removeValue(ctx, UserCredentialCCValues.userName(userId));
|
|
1440
|
+
this.removeValue(ctx, UserCredentialCCValues.userModifierType(userId));
|
|
1441
|
+
this.removeValue(ctx, UserCredentialCCValues.userModifierNodeId(userId));
|
|
1442
|
+
return true;
|
|
1443
|
+
}
|
|
1444
|
+
if (this.reportType
|
|
1445
|
+
!== UserCredentialUserReportType.ResponseToGet
|
|
1446
|
+
&& this.reportType
|
|
1447
|
+
!== UserCredentialUserReportType.UserAdded
|
|
1448
|
+
&& this.reportType
|
|
1449
|
+
!== UserCredentialUserReportType.UserModified) {
|
|
1450
|
+
return true;
|
|
1451
|
+
}
|
|
1452
|
+
const userId = this.userId;
|
|
1453
|
+
this.ensureMetadata(ctx, UserCredentialCCValues.userType(userId));
|
|
1454
|
+
this.setValue(ctx, UserCredentialCCValues.userType(userId), this.userType);
|
|
1455
|
+
this.ensureMetadata(ctx, UserCredentialCCValues.userActive(userId));
|
|
1456
|
+
this.setValue(ctx, UserCredentialCCValues.userActive(userId), this.active);
|
|
1457
|
+
this.ensureMetadata(ctx, UserCredentialCCValues.credentialRule(userId));
|
|
1458
|
+
this.setValue(ctx, UserCredentialCCValues.credentialRule(userId), this.credentialRule);
|
|
1459
|
+
this.ensureMetadata(ctx, UserCredentialCCValues.expiringTimeoutMinutes(userId));
|
|
1460
|
+
this.setValue(ctx, UserCredentialCCValues.expiringTimeoutMinutes(userId), this.expiringTimeoutMinutes);
|
|
1461
|
+
this.ensureMetadata(ctx, UserCredentialCCValues.userName(userId));
|
|
1462
|
+
this.setValue(ctx, UserCredentialCCValues.userName(userId), this.userName);
|
|
1463
|
+
this.setValue(ctx, UserCredentialCCValues.userModifierType(userId), this.modifierType);
|
|
1464
|
+
this.setValue(ctx, UserCredentialCCValues.userModifierNodeId(userId), this.modifierNodeId);
|
|
1465
|
+
return true;
|
|
1466
|
+
}
|
|
1467
|
+
toLogEntry(ctx) {
|
|
1468
|
+
return {
|
|
1469
|
+
...super.toLogEntry(ctx),
|
|
1470
|
+
message: {
|
|
1471
|
+
"report type": getEnumMemberName(UserCredentialUserReportType, this.reportType),
|
|
1472
|
+
"next user ID": this.nextUserId,
|
|
1473
|
+
"modifier type": getEnumMemberName(UserCredentialModifierType, this.modifierType),
|
|
1474
|
+
"modifier node id": this.modifierNodeId,
|
|
1475
|
+
"user ID": this.userId,
|
|
1476
|
+
"user type": getEnumMemberName(UserCredentialUserType, this.userType),
|
|
1477
|
+
active: this.active,
|
|
1478
|
+
"credential rule": getEnumMemberName(UserCredentialRule, this.credentialRule),
|
|
1479
|
+
"expiring timeout (minutes)": this.expiringTimeoutMinutes,
|
|
1480
|
+
"name encoding": getEnumMemberName(UserCredentialNameEncoding, this.nameEncoding),
|
|
1481
|
+
"user name": this.userName,
|
|
1482
|
+
},
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
return UserCredentialCCUserReport = _classThis;
|
|
1487
|
+
})();
|
|
1488
|
+
export { UserCredentialCCUserReport };
|
|
1489
|
+
function testResponseForUserCredentialUserGet(sent, received) {
|
|
1490
|
+
return (received.reportType
|
|
1491
|
+
=== UserCredentialUserReportType.ResponseToGet);
|
|
1492
|
+
}
|
|
1493
|
+
let UserCredentialCCUserGet = (() => {
|
|
1494
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserGet), expectedCCResponse(UserCredentialCCUserReport, testResponseForUserCredentialUserGet)];
|
|
1495
|
+
let _classDescriptor;
|
|
1496
|
+
let _classExtraInitializers = [];
|
|
1497
|
+
let _classThis;
|
|
1498
|
+
let _classSuper = UserCredentialCC;
|
|
1499
|
+
var UserCredentialCCUserGet = class extends _classSuper {
|
|
1500
|
+
static { _classThis = this; }
|
|
1501
|
+
static {
|
|
1502
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1503
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1504
|
+
UserCredentialCCUserGet = _classThis = _classDescriptor.value;
|
|
1505
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1506
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1507
|
+
}
|
|
1508
|
+
constructor(options) {
|
|
1509
|
+
super(options);
|
|
1510
|
+
this.userId = options.userId;
|
|
1511
|
+
}
|
|
1512
|
+
userId;
|
|
1513
|
+
static from(raw, ctx) {
|
|
1514
|
+
validatePayload(raw.payload.length >= 2);
|
|
1515
|
+
const userId = raw.payload.readUInt16BE(0);
|
|
1516
|
+
return new this({
|
|
1517
|
+
nodeId: ctx.sourceNodeId,
|
|
1518
|
+
userId,
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
serialize(ctx) {
|
|
1522
|
+
this.payload = Bytes.alloc(2);
|
|
1523
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
1524
|
+
return super.serialize(ctx);
|
|
1525
|
+
}
|
|
1526
|
+
toLogEntry(ctx) {
|
|
1527
|
+
return {
|
|
1528
|
+
...super.toLogEntry(ctx),
|
|
1529
|
+
message: {
|
|
1530
|
+
"user ID": this.userId,
|
|
1531
|
+
},
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
return UserCredentialCCUserGet = _classThis;
|
|
1536
|
+
})();
|
|
1537
|
+
export { UserCredentialCCUserGet };
|
|
1538
|
+
let UserCredentialCCCredentialSet = (() => {
|
|
1539
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialSet), useSupervision()];
|
|
1540
|
+
let _classDescriptor;
|
|
1541
|
+
let _classExtraInitializers = [];
|
|
1542
|
+
let _classThis;
|
|
1543
|
+
let _classSuper = UserCredentialCC;
|
|
1544
|
+
var UserCredentialCCCredentialSet = class extends _classSuper {
|
|
1545
|
+
static { _classThis = this; }
|
|
1546
|
+
static {
|
|
1547
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1548
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1549
|
+
UserCredentialCCCredentialSet = _classThis = _classDescriptor.value;
|
|
1550
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1551
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1552
|
+
}
|
|
1553
|
+
constructor(options) {
|
|
1554
|
+
super(options);
|
|
1555
|
+
this.userId = options.userId;
|
|
1556
|
+
this.credentialType = options.credentialType;
|
|
1557
|
+
this.credentialSlot = options.credentialSlot;
|
|
1558
|
+
this.operationType = options.operationType;
|
|
1559
|
+
if (options.operationType !== UserCredentialOperationType.Delete) {
|
|
1560
|
+
this.credentialData = options.credentialData;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
userId;
|
|
1564
|
+
credentialType;
|
|
1565
|
+
credentialSlot;
|
|
1566
|
+
operationType;
|
|
1567
|
+
credentialData;
|
|
1568
|
+
static from(raw, ctx) {
|
|
1569
|
+
validatePayload(raw.payload.length >= 6);
|
|
1570
|
+
const userId = raw.payload.readUInt16BE(0);
|
|
1571
|
+
const credentialType = raw.payload[2];
|
|
1572
|
+
const credentialSlot = raw.payload.readUInt16BE(3);
|
|
1573
|
+
const operationType = raw.payload[5]
|
|
1574
|
+
& 0b11;
|
|
1575
|
+
if (operationType === UserCredentialOperationType.Delete) {
|
|
1576
|
+
return new this({
|
|
1577
|
+
nodeId: ctx.sourceNodeId,
|
|
1578
|
+
userId,
|
|
1579
|
+
credentialType,
|
|
1580
|
+
credentialSlot,
|
|
1581
|
+
operationType,
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
let credentialData = new Bytes();
|
|
1585
|
+
if (raw.payload.length >= 7) {
|
|
1586
|
+
const credentialLength = raw.payload[6];
|
|
1587
|
+
validatePayload(raw.payload.length >= 7 + credentialLength);
|
|
1588
|
+
credentialData = Bytes.from(raw.payload.subarray(7, 7 + credentialLength));
|
|
1589
|
+
}
|
|
1590
|
+
return new this({
|
|
1591
|
+
nodeId: ctx.sourceNodeId,
|
|
1592
|
+
userId,
|
|
1593
|
+
credentialType,
|
|
1594
|
+
credentialSlot,
|
|
1595
|
+
operationType,
|
|
1596
|
+
credentialData,
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
serialize(ctx) {
|
|
1600
|
+
// For Delete, credential data MAY be omitted
|
|
1601
|
+
if (this.operationType === UserCredentialOperationType.Delete) {
|
|
1602
|
+
this.payload = Bytes.alloc(6);
|
|
1603
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
1604
|
+
this.payload[2] = this.credentialType;
|
|
1605
|
+
this.payload.writeUInt16BE(this.credentialSlot, 3);
|
|
1606
|
+
this.payload[5] = this.operationType & 0b11;
|
|
1607
|
+
return super.serialize(ctx);
|
|
1608
|
+
}
|
|
1609
|
+
if (this.credentialData == undefined) {
|
|
1610
|
+
throw new ZWaveError(`${this.constructor.name}: credential data must be set for Add/Modify operations`, ZWaveErrorCodes.Argument_Invalid);
|
|
1611
|
+
}
|
|
1612
|
+
this.payload = Bytes.alloc(7 + this.credentialData.length);
|
|
1613
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
1614
|
+
this.payload[2] = this.credentialType;
|
|
1615
|
+
this.payload.writeUInt16BE(this.credentialSlot, 3);
|
|
1616
|
+
this.payload[5] = this.operationType & 0b11;
|
|
1617
|
+
this.payload[6] = this.credentialData.length;
|
|
1618
|
+
if (this.credentialData.length > 0) {
|
|
1619
|
+
this.payload.set(this.credentialData, 7);
|
|
1620
|
+
}
|
|
1621
|
+
return super.serialize(ctx);
|
|
1622
|
+
}
|
|
1623
|
+
toLogEntry(ctx) {
|
|
1624
|
+
const message = {
|
|
1625
|
+
"user ID": this.userId,
|
|
1626
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
1627
|
+
"credential slot": this.credentialSlot,
|
|
1628
|
+
"operation type": getEnumMemberName(UserCredentialOperationType, this.operationType),
|
|
1629
|
+
};
|
|
1630
|
+
if (this.credentialData != undefined) {
|
|
1631
|
+
message["credential data"] = credentialToLogString(this.credentialData);
|
|
1632
|
+
}
|
|
1633
|
+
return { ...super.toLogEntry(ctx), message };
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
return UserCredentialCCCredentialSet = _classThis;
|
|
1637
|
+
})();
|
|
1638
|
+
export { UserCredentialCCCredentialSet };
|
|
1639
|
+
let UserCredentialCCCredentialReport = (() => {
|
|
1640
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialReport)];
|
|
1641
|
+
let _classDescriptor;
|
|
1642
|
+
let _classExtraInitializers = [];
|
|
1643
|
+
let _classThis;
|
|
1644
|
+
let _classSuper = UserCredentialCC;
|
|
1645
|
+
var UserCredentialCCCredentialReport = class extends _classSuper {
|
|
1646
|
+
static { _classThis = this; }
|
|
1647
|
+
static {
|
|
1648
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1649
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1650
|
+
UserCredentialCCCredentialReport = _classThis = _classDescriptor.value;
|
|
1651
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1652
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1653
|
+
}
|
|
1654
|
+
constructor(options) {
|
|
1655
|
+
super(options);
|
|
1656
|
+
this.reportType = options.reportType;
|
|
1657
|
+
this.userId = options.userId;
|
|
1658
|
+
this.credentialType = options.credentialType;
|
|
1659
|
+
this.credentialSlot = options.credentialSlot;
|
|
1660
|
+
this.credentialReadBack = options.credentialReadBack;
|
|
1661
|
+
this.credentialLength = options.credentialLength;
|
|
1662
|
+
this.credentialData = options.credentialData;
|
|
1663
|
+
this.modifierType = options.modifierType;
|
|
1664
|
+
this.modifierNodeId = options.modifierNodeId;
|
|
1665
|
+
this.nextCredentialType = options.nextCredentialType;
|
|
1666
|
+
this.nextCredentialSlot = options.nextCredentialSlot;
|
|
1667
|
+
}
|
|
1668
|
+
static from(raw, ctx) {
|
|
1669
|
+
validatePayload(raw.payload.length >= 8);
|
|
1670
|
+
const reportType = raw.payload[0];
|
|
1671
|
+
const userId = raw.payload.readUInt16BE(1);
|
|
1672
|
+
const credentialType = raw.payload[3];
|
|
1673
|
+
const credentialSlot = raw.payload.readUInt16BE(4);
|
|
1674
|
+
const credentialReadBack = !!(raw.payload[6] & 128);
|
|
1675
|
+
const credentialLength = raw.payload[7];
|
|
1676
|
+
validatePayload(raw.payload.length >= 8 + credentialLength + 6);
|
|
1677
|
+
const credentialData = Bytes.from(raw.payload.subarray(8, 8 + credentialLength));
|
|
1678
|
+
let offset = 8 + credentialLength;
|
|
1679
|
+
const modifierType = raw.payload[offset];
|
|
1680
|
+
const modifierNodeId = raw.payload.readUInt16BE(offset + 1);
|
|
1681
|
+
const nextCredentialType = raw.payload[offset + 3];
|
|
1682
|
+
const nextCredentialSlot = raw.payload.readUInt16BE(offset + 4);
|
|
1683
|
+
return new this({
|
|
1684
|
+
nodeId: ctx.sourceNodeId,
|
|
1685
|
+
reportType,
|
|
1686
|
+
userId,
|
|
1687
|
+
credentialType,
|
|
1688
|
+
credentialSlot,
|
|
1689
|
+
credentialReadBack,
|
|
1690
|
+
credentialLength,
|
|
1691
|
+
credentialData,
|
|
1692
|
+
modifierType,
|
|
1693
|
+
modifierNodeId,
|
|
1694
|
+
nextCredentialType,
|
|
1695
|
+
nextCredentialSlot,
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
reportType;
|
|
1699
|
+
userId;
|
|
1700
|
+
credentialType;
|
|
1701
|
+
credentialSlot;
|
|
1702
|
+
credentialReadBack;
|
|
1703
|
+
credentialLength;
|
|
1704
|
+
credentialData;
|
|
1705
|
+
modifierType;
|
|
1706
|
+
modifierNodeId;
|
|
1707
|
+
nextCredentialType;
|
|
1708
|
+
nextCredentialSlot;
|
|
1709
|
+
serialize(ctx) {
|
|
1710
|
+
this.payload = Bytes.alloc(14 + this.credentialData.length);
|
|
1711
|
+
this.payload[0] = this.reportType;
|
|
1712
|
+
this.payload.writeUInt16BE(this.userId, 1);
|
|
1713
|
+
this.payload[3] = this.credentialType;
|
|
1714
|
+
this.payload.writeUInt16BE(this.credentialSlot, 4);
|
|
1715
|
+
this.payload[6] = this.credentialReadBack ? 0x80 : 0x00;
|
|
1716
|
+
this.payload[7] = this.credentialData.length;
|
|
1717
|
+
if (this.credentialData.length > 0) {
|
|
1718
|
+
this.payload.set(this.credentialData, 8);
|
|
1719
|
+
}
|
|
1720
|
+
let offset = 8 + this.credentialData.length;
|
|
1721
|
+
this.payload[offset] = this.modifierType;
|
|
1722
|
+
this.payload.writeUInt16BE(this.modifierNodeId, offset + 1);
|
|
1723
|
+
this.payload[offset + 3] = this.nextCredentialType;
|
|
1724
|
+
this.payload.writeUInt16BE(this.nextCredentialSlot, offset + 4);
|
|
1725
|
+
return super.serialize(ctx);
|
|
1726
|
+
}
|
|
1727
|
+
persistValues(ctx) {
|
|
1728
|
+
if (!super.persistValues(ctx))
|
|
1729
|
+
return false;
|
|
1730
|
+
if (this.credentialType === UserCredentialType.None
|
|
1731
|
+
|| this.credentialSlot === 0) {
|
|
1732
|
+
return true;
|
|
1733
|
+
}
|
|
1734
|
+
if (this.reportType
|
|
1735
|
+
=== UserCredentialCredentialReportType.CredentialDeleted) {
|
|
1736
|
+
this.removeValue(ctx, UserCredentialCCValues.credential(this.userId, this.credentialType, this.credentialSlot));
|
|
1737
|
+
this.removeValue(ctx, UserCredentialCCValues.credentialModifierType(this.userId, this.credentialType, this.credentialSlot));
|
|
1738
|
+
this.removeValue(ctx, UserCredentialCCValues.credentialModifierNodeId(this.userId, this.credentialType, this.credentialSlot));
|
|
1739
|
+
return true;
|
|
1740
|
+
}
|
|
1741
|
+
if (this.reportType
|
|
1742
|
+
!== UserCredentialCredentialReportType.ResponseToGet
|
|
1743
|
+
&& this.reportType
|
|
1744
|
+
!== UserCredentialCredentialReportType.CredentialAdded
|
|
1745
|
+
&& this.reportType
|
|
1746
|
+
!== UserCredentialCredentialReportType.CredentialModified) {
|
|
1747
|
+
return true;
|
|
1748
|
+
}
|
|
1749
|
+
this.ensureMetadata(ctx, UserCredentialCCValues.credential(this.userId, this.credentialType, this.credentialSlot));
|
|
1750
|
+
this.setValue(ctx, UserCredentialCCValues.credential(this.userId, this.credentialType, this.credentialSlot), this.credentialData);
|
|
1751
|
+
this.setValue(ctx, UserCredentialCCValues.credentialModifierType(this.userId, this.credentialType, this.credentialSlot), this.modifierType);
|
|
1752
|
+
this.setValue(ctx, UserCredentialCCValues.credentialModifierNodeId(this.userId, this.credentialType, this.credentialSlot), this.modifierNodeId);
|
|
1753
|
+
return true;
|
|
1754
|
+
}
|
|
1755
|
+
toLogEntry(ctx) {
|
|
1756
|
+
return {
|
|
1757
|
+
...super.toLogEntry(ctx),
|
|
1758
|
+
message: {
|
|
1759
|
+
"report type": getEnumMemberName(UserCredentialCredentialReportType, this.reportType),
|
|
1760
|
+
"user ID": this.userId,
|
|
1761
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
1762
|
+
"credential slot": this.credentialSlot,
|
|
1763
|
+
"credential read-back": this.credentialReadBack,
|
|
1764
|
+
"credential data": credentialToLogString(this.credentialData),
|
|
1765
|
+
"modifier type": getEnumMemberName(UserCredentialModifierType, this.modifierType),
|
|
1766
|
+
"modifier node id": this.modifierNodeId,
|
|
1767
|
+
"next credential type": getEnumMemberName(UserCredentialType, this.nextCredentialType),
|
|
1768
|
+
"next credential slot": this.nextCredentialSlot,
|
|
1769
|
+
},
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
return UserCredentialCCCredentialReport = _classThis;
|
|
1774
|
+
})();
|
|
1775
|
+
export { UserCredentialCCCredentialReport };
|
|
1776
|
+
function testResponseForUserCredentialCredentialGet(_sent, received) {
|
|
1777
|
+
return (received.reportType
|
|
1778
|
+
=== UserCredentialCredentialReportType.ResponseToGet);
|
|
1779
|
+
}
|
|
1780
|
+
let UserCredentialCCCredentialGet = (() => {
|
|
1781
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialGet), expectedCCResponse(UserCredentialCCCredentialReport, testResponseForUserCredentialCredentialGet)];
|
|
1782
|
+
let _classDescriptor;
|
|
1783
|
+
let _classExtraInitializers = [];
|
|
1784
|
+
let _classThis;
|
|
1785
|
+
let _classSuper = UserCredentialCC;
|
|
1786
|
+
var UserCredentialCCCredentialGet = class extends _classSuper {
|
|
1787
|
+
static { _classThis = this; }
|
|
1788
|
+
static {
|
|
1789
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1790
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1791
|
+
UserCredentialCCCredentialGet = _classThis = _classDescriptor.value;
|
|
1792
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1793
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1794
|
+
}
|
|
1795
|
+
constructor(options) {
|
|
1796
|
+
super(options);
|
|
1797
|
+
this.userId = options.userId;
|
|
1798
|
+
this.credentialType = options.credentialType;
|
|
1799
|
+
this.credentialSlot = options.credentialSlot;
|
|
1800
|
+
}
|
|
1801
|
+
userId;
|
|
1802
|
+
credentialType;
|
|
1803
|
+
credentialSlot;
|
|
1804
|
+
static from(raw, ctx) {
|
|
1805
|
+
validatePayload(raw.payload.length >= 5);
|
|
1806
|
+
const userId = raw.payload.readUInt16BE(0);
|
|
1807
|
+
const credentialType = raw.payload[2];
|
|
1808
|
+
const credentialSlot = raw.payload.readUInt16BE(3);
|
|
1809
|
+
return new this({
|
|
1810
|
+
nodeId: ctx.sourceNodeId,
|
|
1811
|
+
userId,
|
|
1812
|
+
credentialType,
|
|
1813
|
+
credentialSlot,
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
serialize(ctx) {
|
|
1817
|
+
this.payload = Bytes.alloc(5);
|
|
1818
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
1819
|
+
this.payload[2] = this.credentialType;
|
|
1820
|
+
this.payload.writeUInt16BE(this.credentialSlot, 3);
|
|
1821
|
+
return super.serialize(ctx);
|
|
1822
|
+
}
|
|
1823
|
+
toLogEntry(ctx) {
|
|
1824
|
+
return {
|
|
1825
|
+
...super.toLogEntry(ctx),
|
|
1826
|
+
message: {
|
|
1827
|
+
"user ID": this.userId,
|
|
1828
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
1829
|
+
"credential slot": this.credentialSlot,
|
|
1830
|
+
},
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
return UserCredentialCCCredentialGet = _classThis;
|
|
1835
|
+
})();
|
|
1836
|
+
export { UserCredentialCCCredentialGet };
|
|
1837
|
+
let UserCredentialCCCredentialLearnStart = (() => {
|
|
1838
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialLearnStart), useSupervision()];
|
|
1839
|
+
let _classDescriptor;
|
|
1840
|
+
let _classExtraInitializers = [];
|
|
1841
|
+
let _classThis;
|
|
1842
|
+
let _classSuper = UserCredentialCC;
|
|
1843
|
+
var UserCredentialCCCredentialLearnStart = class extends _classSuper {
|
|
1844
|
+
static { _classThis = this; }
|
|
1845
|
+
static {
|
|
1846
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1847
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1848
|
+
UserCredentialCCCredentialLearnStart = _classThis = _classDescriptor.value;
|
|
1849
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1850
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1851
|
+
}
|
|
1852
|
+
constructor(options) {
|
|
1853
|
+
super(options);
|
|
1854
|
+
this.userId = options.userId;
|
|
1855
|
+
this.credentialType = options.credentialType;
|
|
1856
|
+
this.credentialSlot = options.credentialSlot;
|
|
1857
|
+
this.operationType = options.operationType;
|
|
1858
|
+
this.learnTimeout = options.learnTimeout;
|
|
1859
|
+
}
|
|
1860
|
+
userId;
|
|
1861
|
+
credentialType;
|
|
1862
|
+
credentialSlot;
|
|
1863
|
+
operationType;
|
|
1864
|
+
learnTimeout;
|
|
1865
|
+
static from(raw, ctx) {
|
|
1866
|
+
validatePayload(raw.payload.length >= 7);
|
|
1867
|
+
const userId = raw.payload.readUInt16BE(0);
|
|
1868
|
+
const credentialType = raw.payload[2];
|
|
1869
|
+
const credentialSlot = raw.payload.readUInt16BE(3);
|
|
1870
|
+
const operationType = raw.payload[5]
|
|
1871
|
+
& 0b11;
|
|
1872
|
+
const learnTimeout = raw.payload[6];
|
|
1873
|
+
return new this({
|
|
1874
|
+
nodeId: ctx.sourceNodeId,
|
|
1875
|
+
userId,
|
|
1876
|
+
credentialType,
|
|
1877
|
+
credentialSlot,
|
|
1878
|
+
operationType,
|
|
1879
|
+
learnTimeout,
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
serialize(ctx) {
|
|
1883
|
+
this.payload = Bytes.alloc(7);
|
|
1884
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
1885
|
+
this.payload[2] = this.credentialType;
|
|
1886
|
+
this.payload.writeUInt16BE(this.credentialSlot, 3);
|
|
1887
|
+
this.payload[5] = this.operationType & 0b11;
|
|
1888
|
+
this.payload[6] = this.learnTimeout;
|
|
1889
|
+
return super.serialize(ctx);
|
|
1890
|
+
}
|
|
1891
|
+
toLogEntry(ctx) {
|
|
1892
|
+
return {
|
|
1893
|
+
...super.toLogEntry(ctx),
|
|
1894
|
+
message: {
|
|
1895
|
+
"user ID": this.userId,
|
|
1896
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
1897
|
+
"credential slot": this.credentialSlot,
|
|
1898
|
+
"operation type": getEnumMemberName(UserCredentialOperationType, this.operationType),
|
|
1899
|
+
"learn timeout": this.learnTimeout,
|
|
1900
|
+
},
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
return UserCredentialCCCredentialLearnStart = _classThis;
|
|
1905
|
+
})();
|
|
1906
|
+
export { UserCredentialCCCredentialLearnStart };
|
|
1907
|
+
let UserCredentialCCCredentialLearnCancel = (() => {
|
|
1908
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialLearnCancel), useSupervision()];
|
|
1909
|
+
let _classDescriptor;
|
|
1910
|
+
let _classExtraInitializers = [];
|
|
1911
|
+
let _classThis;
|
|
1912
|
+
let _classSuper = UserCredentialCC;
|
|
1913
|
+
var UserCredentialCCCredentialLearnCancel = class extends _classSuper {
|
|
1914
|
+
static { _classThis = this; }
|
|
1915
|
+
static {
|
|
1916
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1917
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1918
|
+
UserCredentialCCCredentialLearnCancel = _classThis = _classDescriptor.value;
|
|
1919
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1920
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1923
|
+
return UserCredentialCCCredentialLearnCancel = _classThis;
|
|
1924
|
+
})();
|
|
1925
|
+
export { UserCredentialCCCredentialLearnCancel };
|
|
1926
|
+
let UserCredentialCCCredentialLearnReport = (() => {
|
|
1927
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialLearnReport)];
|
|
1928
|
+
let _classDescriptor;
|
|
1929
|
+
let _classExtraInitializers = [];
|
|
1930
|
+
let _classThis;
|
|
1931
|
+
let _classSuper = UserCredentialCC;
|
|
1932
|
+
var UserCredentialCCCredentialLearnReport = class extends _classSuper {
|
|
1933
|
+
static { _classThis = this; }
|
|
1934
|
+
static {
|
|
1935
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1936
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1937
|
+
UserCredentialCCCredentialLearnReport = _classThis = _classDescriptor.value;
|
|
1938
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1939
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1940
|
+
}
|
|
1941
|
+
constructor(options) {
|
|
1942
|
+
super(options);
|
|
1943
|
+
this.learnStatus = options.learnStatus;
|
|
1944
|
+
this.userId = options.userId;
|
|
1945
|
+
this.credentialType = options.credentialType;
|
|
1946
|
+
this.credentialSlot = options.credentialSlot;
|
|
1947
|
+
this.stepsRemaining = options.stepsRemaining;
|
|
1948
|
+
}
|
|
1949
|
+
static from(raw, ctx) {
|
|
1950
|
+
validatePayload(raw.payload.length >= 7);
|
|
1951
|
+
const learnStatus = raw.payload[0];
|
|
1952
|
+
const userId = raw.payload.readUInt16BE(1);
|
|
1953
|
+
const credentialType = raw.payload[3];
|
|
1954
|
+
const credentialSlot = raw.payload.readUInt16BE(4);
|
|
1955
|
+
const stepsRemaining = raw.payload[6];
|
|
1956
|
+
return new this({
|
|
1957
|
+
nodeId: ctx.sourceNodeId,
|
|
1958
|
+
learnStatus,
|
|
1959
|
+
userId,
|
|
1960
|
+
credentialType,
|
|
1961
|
+
credentialSlot,
|
|
1962
|
+
stepsRemaining,
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
learnStatus;
|
|
1966
|
+
userId;
|
|
1967
|
+
credentialType;
|
|
1968
|
+
credentialSlot;
|
|
1969
|
+
stepsRemaining;
|
|
1970
|
+
serialize(ctx) {
|
|
1971
|
+
this.payload = Bytes.alloc(7);
|
|
1972
|
+
this.payload[0] = this.learnStatus;
|
|
1973
|
+
this.payload.writeUInt16BE(this.userId, 1);
|
|
1974
|
+
this.payload[3] = this.credentialType;
|
|
1975
|
+
this.payload.writeUInt16BE(this.credentialSlot, 4);
|
|
1976
|
+
this.payload[6] = this.stepsRemaining;
|
|
1977
|
+
return super.serialize(ctx);
|
|
1978
|
+
}
|
|
1979
|
+
toLogEntry(ctx) {
|
|
1980
|
+
return {
|
|
1981
|
+
...super.toLogEntry(ctx),
|
|
1982
|
+
message: {
|
|
1983
|
+
"learn status": getEnumMemberName(UserCredentialLearnStatus, this.learnStatus),
|
|
1984
|
+
"user ID": this.userId,
|
|
1985
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
1986
|
+
"credential slot": this.credentialSlot,
|
|
1987
|
+
"steps remaining": this.stepsRemaining,
|
|
1988
|
+
},
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
return UserCredentialCCCredentialLearnReport = _classThis;
|
|
1993
|
+
})();
|
|
1994
|
+
export { UserCredentialCCCredentialLearnReport };
|
|
1995
|
+
let UserCredentialCCUserCredentialAssociationSet = (() => {
|
|
1996
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserCredentialAssociationSet), useSupervision()];
|
|
1997
|
+
let _classDescriptor;
|
|
1998
|
+
let _classExtraInitializers = [];
|
|
1999
|
+
let _classThis;
|
|
2000
|
+
let _classSuper = UserCredentialCC;
|
|
2001
|
+
var UserCredentialCCUserCredentialAssociationSet = class extends _classSuper {
|
|
2002
|
+
static { _classThis = this; }
|
|
2003
|
+
static {
|
|
2004
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2005
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2006
|
+
UserCredentialCCUserCredentialAssociationSet = _classThis = _classDescriptor.value;
|
|
2007
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2008
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2009
|
+
}
|
|
2010
|
+
constructor(options) {
|
|
2011
|
+
super(options);
|
|
2012
|
+
this.credentialType = options.credentialType;
|
|
2013
|
+
this.credentialSlot = options.credentialSlot;
|
|
2014
|
+
this.destinationUserId = options.destinationUserId;
|
|
2015
|
+
}
|
|
2016
|
+
credentialType;
|
|
2017
|
+
credentialSlot;
|
|
2018
|
+
destinationUserId;
|
|
2019
|
+
static from(raw, ctx) {
|
|
2020
|
+
validatePayload(raw.payload.length >= 5);
|
|
2021
|
+
const credentialType = raw.payload[0];
|
|
2022
|
+
const credentialSlot = raw.payload.readUInt16BE(1);
|
|
2023
|
+
const destinationUserId = raw.payload.readUInt16BE(3);
|
|
2024
|
+
return new this({
|
|
2025
|
+
nodeId: ctx.sourceNodeId,
|
|
2026
|
+
credentialType,
|
|
2027
|
+
credentialSlot,
|
|
2028
|
+
destinationUserId,
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
serialize(ctx) {
|
|
2032
|
+
this.payload = Bytes.alloc(5);
|
|
2033
|
+
this.payload[0] = this.credentialType;
|
|
2034
|
+
this.payload.writeUInt16BE(this.credentialSlot, 1);
|
|
2035
|
+
this.payload.writeUInt16BE(this.destinationUserId, 3);
|
|
2036
|
+
return super.serialize(ctx);
|
|
2037
|
+
}
|
|
2038
|
+
toLogEntry(ctx) {
|
|
2039
|
+
return {
|
|
2040
|
+
...super.toLogEntry(ctx),
|
|
2041
|
+
message: {
|
|
2042
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
2043
|
+
"credential slot": this.credentialSlot,
|
|
2044
|
+
"destination user ID": this.destinationUserId,
|
|
2045
|
+
},
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
return UserCredentialCCUserCredentialAssociationSet = _classThis;
|
|
2050
|
+
})();
|
|
2051
|
+
export { UserCredentialCCUserCredentialAssociationSet };
|
|
2052
|
+
let UserCredentialCCUserCredentialAssociationReport = (() => {
|
|
2053
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserCredentialAssociationReport)];
|
|
2054
|
+
let _classDescriptor;
|
|
2055
|
+
let _classExtraInitializers = [];
|
|
2056
|
+
let _classThis;
|
|
2057
|
+
let _classSuper = UserCredentialCC;
|
|
2058
|
+
var UserCredentialCCUserCredentialAssociationReport = class extends _classSuper {
|
|
2059
|
+
static { _classThis = this; }
|
|
2060
|
+
static {
|
|
2061
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2062
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2063
|
+
UserCredentialCCUserCredentialAssociationReport = _classThis = _classDescriptor.value;
|
|
2064
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2065
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2066
|
+
}
|
|
2067
|
+
constructor(options) {
|
|
2068
|
+
super(options);
|
|
2069
|
+
this.credentialType = options.credentialType;
|
|
2070
|
+
this.credentialSlot = options.credentialSlot;
|
|
2071
|
+
this.destinationUserId = options.destinationUserId;
|
|
2072
|
+
this.status = options.status;
|
|
2073
|
+
}
|
|
2074
|
+
static from(raw, ctx) {
|
|
2075
|
+
validatePayload(raw.payload.length >= 6);
|
|
2076
|
+
const credentialType = raw.payload[0];
|
|
2077
|
+
const credentialSlot = raw.payload.readUInt16BE(1);
|
|
2078
|
+
const destinationUserId = raw.payload.readUInt16BE(3);
|
|
2079
|
+
const status = raw.payload[5];
|
|
2080
|
+
return new this({
|
|
2081
|
+
nodeId: ctx.sourceNodeId,
|
|
2082
|
+
credentialType,
|
|
2083
|
+
credentialSlot,
|
|
2084
|
+
destinationUserId: destinationUserId,
|
|
2085
|
+
status,
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
credentialType;
|
|
2089
|
+
credentialSlot;
|
|
2090
|
+
destinationUserId;
|
|
2091
|
+
status;
|
|
2092
|
+
serialize(ctx) {
|
|
2093
|
+
this.payload = Bytes.alloc(6);
|
|
2094
|
+
this.payload[0] = this.credentialType;
|
|
2095
|
+
this.payload.writeUInt16BE(this.credentialSlot, 1);
|
|
2096
|
+
this.payload.writeUInt16BE(this.destinationUserId, 3);
|
|
2097
|
+
this.payload[5] = this.status;
|
|
2098
|
+
return super.serialize(ctx);
|
|
2099
|
+
}
|
|
2100
|
+
toLogEntry(ctx) {
|
|
2101
|
+
return {
|
|
2102
|
+
...super.toLogEntry(ctx),
|
|
2103
|
+
message: {
|
|
2104
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
2105
|
+
"credential slot": this.credentialSlot,
|
|
2106
|
+
"destination user ID": this.destinationUserId,
|
|
2107
|
+
status: this.status,
|
|
2108
|
+
},
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
return UserCredentialCCUserCredentialAssociationReport = _classThis;
|
|
2113
|
+
})();
|
|
2114
|
+
export { UserCredentialCCUserCredentialAssociationReport };
|
|
2115
|
+
let UserCredentialCCAllUsersChecksumReport = (() => {
|
|
2116
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.AllUsersChecksumReport)];
|
|
2117
|
+
let _classDescriptor;
|
|
2118
|
+
let _classExtraInitializers = [];
|
|
2119
|
+
let _classThis;
|
|
2120
|
+
let _classSuper = UserCredentialCC;
|
|
2121
|
+
var UserCredentialCCAllUsersChecksumReport = class extends _classSuper {
|
|
2122
|
+
static { _classThis = this; }
|
|
2123
|
+
static {
|
|
2124
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2125
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2126
|
+
UserCredentialCCAllUsersChecksumReport = _classThis = _classDescriptor.value;
|
|
2127
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2128
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2129
|
+
}
|
|
2130
|
+
constructor(options) {
|
|
2131
|
+
super(options);
|
|
2132
|
+
this.checksum = options.checksum;
|
|
2133
|
+
}
|
|
2134
|
+
static from(raw, ctx) {
|
|
2135
|
+
validatePayload(raw.payload.length >= 2);
|
|
2136
|
+
const checksum = raw.payload.readUInt16BE(0);
|
|
2137
|
+
return new this({
|
|
2138
|
+
nodeId: ctx.sourceNodeId,
|
|
2139
|
+
checksum,
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
checksum;
|
|
2143
|
+
serialize(ctx) {
|
|
2144
|
+
this.payload = Bytes.alloc(2);
|
|
2145
|
+
this.payload.writeUInt16BE(this.checksum, 0);
|
|
2146
|
+
return super.serialize(ctx);
|
|
2147
|
+
}
|
|
2148
|
+
toLogEntry(ctx) {
|
|
2149
|
+
return {
|
|
2150
|
+
...super.toLogEntry(ctx),
|
|
2151
|
+
message: { checksum: this.checksum },
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
return UserCredentialCCAllUsersChecksumReport = _classThis;
|
|
2156
|
+
})();
|
|
2157
|
+
export { UserCredentialCCAllUsersChecksumReport };
|
|
2158
|
+
let UserCredentialCCAllUsersChecksumGet = (() => {
|
|
2159
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.AllUsersChecksumGet), expectedCCResponse(UserCredentialCCAllUsersChecksumReport)];
|
|
2160
|
+
let _classDescriptor;
|
|
2161
|
+
let _classExtraInitializers = [];
|
|
2162
|
+
let _classThis;
|
|
2163
|
+
let _classSuper = UserCredentialCC;
|
|
2164
|
+
var UserCredentialCCAllUsersChecksumGet = class extends _classSuper {
|
|
2165
|
+
static { _classThis = this; }
|
|
2166
|
+
static {
|
|
2167
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2168
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2169
|
+
UserCredentialCCAllUsersChecksumGet = _classThis = _classDescriptor.value;
|
|
2170
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2171
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2172
|
+
}
|
|
2173
|
+
};
|
|
2174
|
+
return UserCredentialCCAllUsersChecksumGet = _classThis;
|
|
2175
|
+
})();
|
|
2176
|
+
export { UserCredentialCCAllUsersChecksumGet };
|
|
2177
|
+
let UserCredentialCCUserChecksumReport = (() => {
|
|
2178
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserChecksumReport)];
|
|
2179
|
+
let _classDescriptor;
|
|
2180
|
+
let _classExtraInitializers = [];
|
|
2181
|
+
let _classThis;
|
|
2182
|
+
let _classSuper = UserCredentialCC;
|
|
2183
|
+
var UserCredentialCCUserChecksumReport = class extends _classSuper {
|
|
2184
|
+
static { _classThis = this; }
|
|
2185
|
+
static {
|
|
2186
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2187
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2188
|
+
UserCredentialCCUserChecksumReport = _classThis = _classDescriptor.value;
|
|
2189
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2190
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2191
|
+
}
|
|
2192
|
+
constructor(options) {
|
|
2193
|
+
super(options);
|
|
2194
|
+
this.userId = options.userId;
|
|
2195
|
+
this.checksum = options.checksum;
|
|
2196
|
+
}
|
|
2197
|
+
static from(raw, ctx) {
|
|
2198
|
+
validatePayload(raw.payload.length >= 4);
|
|
2199
|
+
const userId = raw.payload.readUInt16BE(0);
|
|
2200
|
+
const checksum = raw.payload.readUInt16BE(2);
|
|
2201
|
+
return new this({
|
|
2202
|
+
nodeId: ctx.sourceNodeId,
|
|
2203
|
+
userId,
|
|
2204
|
+
checksum,
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
userId;
|
|
2208
|
+
checksum;
|
|
2209
|
+
serialize(ctx) {
|
|
2210
|
+
this.payload = Bytes.alloc(4);
|
|
2211
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
2212
|
+
this.payload.writeUInt16BE(this.checksum, 2);
|
|
2213
|
+
return super.serialize(ctx);
|
|
2214
|
+
}
|
|
2215
|
+
toLogEntry(ctx) {
|
|
2216
|
+
return {
|
|
2217
|
+
...super.toLogEntry(ctx),
|
|
2218
|
+
message: {
|
|
2219
|
+
"user ID": this.userId,
|
|
2220
|
+
checksum: this.checksum,
|
|
2221
|
+
},
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
return UserCredentialCCUserChecksumReport = _classThis;
|
|
2226
|
+
})();
|
|
2227
|
+
export { UserCredentialCCUserChecksumReport };
|
|
2228
|
+
function testResponseForUserCredentialUserChecksumGet(sent, received) {
|
|
2229
|
+
return received.userId === sent.userId;
|
|
2230
|
+
}
|
|
2231
|
+
let UserCredentialCCUserChecksumGet = (() => {
|
|
2232
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.UserChecksumGet), expectedCCResponse(UserCredentialCCUserChecksumReport, testResponseForUserCredentialUserChecksumGet)];
|
|
2233
|
+
let _classDescriptor;
|
|
2234
|
+
let _classExtraInitializers = [];
|
|
2235
|
+
let _classThis;
|
|
2236
|
+
let _classSuper = UserCredentialCC;
|
|
2237
|
+
var UserCredentialCCUserChecksumGet = class extends _classSuper {
|
|
2238
|
+
static { _classThis = this; }
|
|
2239
|
+
static {
|
|
2240
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2241
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2242
|
+
UserCredentialCCUserChecksumGet = _classThis = _classDescriptor.value;
|
|
2243
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2244
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2245
|
+
}
|
|
2246
|
+
constructor(options) {
|
|
2247
|
+
super(options);
|
|
2248
|
+
this.userId = options.userId;
|
|
2249
|
+
}
|
|
2250
|
+
userId;
|
|
2251
|
+
static from(raw, ctx) {
|
|
2252
|
+
validatePayload(raw.payload.length >= 2);
|
|
2253
|
+
const userId = raw.payload.readUInt16BE(0);
|
|
2254
|
+
return new this({
|
|
2255
|
+
nodeId: ctx.sourceNodeId,
|
|
2256
|
+
userId,
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
serialize(ctx) {
|
|
2260
|
+
this.payload = Bytes.alloc(2);
|
|
2261
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
2262
|
+
return super.serialize(ctx);
|
|
2263
|
+
}
|
|
2264
|
+
toLogEntry(ctx) {
|
|
2265
|
+
return {
|
|
2266
|
+
...super.toLogEntry(ctx),
|
|
2267
|
+
message: {
|
|
2268
|
+
"user ID": this.userId,
|
|
2269
|
+
},
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
};
|
|
2273
|
+
return UserCredentialCCUserChecksumGet = _classThis;
|
|
2274
|
+
})();
|
|
2275
|
+
export { UserCredentialCCUserChecksumGet };
|
|
2276
|
+
let UserCredentialCCCredentialChecksumReport = (() => {
|
|
2277
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialChecksumReport)];
|
|
2278
|
+
let _classDescriptor;
|
|
2279
|
+
let _classExtraInitializers = [];
|
|
2280
|
+
let _classThis;
|
|
2281
|
+
let _classSuper = UserCredentialCC;
|
|
2282
|
+
var UserCredentialCCCredentialChecksumReport = class extends _classSuper {
|
|
2283
|
+
static { _classThis = this; }
|
|
2284
|
+
static {
|
|
2285
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2286
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2287
|
+
UserCredentialCCCredentialChecksumReport = _classThis = _classDescriptor.value;
|
|
2288
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2289
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2290
|
+
}
|
|
2291
|
+
constructor(options) {
|
|
2292
|
+
super(options);
|
|
2293
|
+
this.credentialType = options.credentialType;
|
|
2294
|
+
this.checksum = options.checksum;
|
|
2295
|
+
}
|
|
2296
|
+
static from(raw, ctx) {
|
|
2297
|
+
validatePayload(raw.payload.length >= 3);
|
|
2298
|
+
const credentialType = raw.payload[0];
|
|
2299
|
+
const checksum = raw.payload.readUInt16BE(1);
|
|
2300
|
+
return new this({
|
|
2301
|
+
nodeId: ctx.sourceNodeId,
|
|
2302
|
+
credentialType,
|
|
2303
|
+
checksum,
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
credentialType;
|
|
2307
|
+
checksum;
|
|
2308
|
+
serialize(ctx) {
|
|
2309
|
+
this.payload = Bytes.alloc(3);
|
|
2310
|
+
this.payload[0] = this.credentialType;
|
|
2311
|
+
this.payload.writeUInt16BE(this.checksum, 1);
|
|
2312
|
+
return super.serialize(ctx);
|
|
2313
|
+
}
|
|
2314
|
+
toLogEntry(ctx) {
|
|
2315
|
+
return {
|
|
2316
|
+
...super.toLogEntry(ctx),
|
|
2317
|
+
message: {
|
|
2318
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
2319
|
+
checksum: this.checksum,
|
|
2320
|
+
},
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2324
|
+
return UserCredentialCCCredentialChecksumReport = _classThis;
|
|
2325
|
+
})();
|
|
2326
|
+
export { UserCredentialCCCredentialChecksumReport };
|
|
2327
|
+
function testResponseForUserCredentialCredentialChecksumGet(sent, received) {
|
|
2328
|
+
return received.credentialType === sent.credentialType;
|
|
2329
|
+
}
|
|
2330
|
+
let UserCredentialCCCredentialChecksumGet = (() => {
|
|
2331
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.CredentialChecksumGet), expectedCCResponse(UserCredentialCCCredentialChecksumReport, testResponseForUserCredentialCredentialChecksumGet)];
|
|
2332
|
+
let _classDescriptor;
|
|
2333
|
+
let _classExtraInitializers = [];
|
|
2334
|
+
let _classThis;
|
|
2335
|
+
let _classSuper = UserCredentialCC;
|
|
2336
|
+
var UserCredentialCCCredentialChecksumGet = class extends _classSuper {
|
|
2337
|
+
static { _classThis = this; }
|
|
2338
|
+
static {
|
|
2339
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2340
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2341
|
+
UserCredentialCCCredentialChecksumGet = _classThis = _classDescriptor.value;
|
|
2342
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2343
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2344
|
+
}
|
|
2345
|
+
constructor(options) {
|
|
2346
|
+
super(options);
|
|
2347
|
+
this.credentialType = options.credentialType;
|
|
2348
|
+
}
|
|
2349
|
+
credentialType;
|
|
2350
|
+
static from(raw, ctx) {
|
|
2351
|
+
validatePayload(raw.payload.length >= 1);
|
|
2352
|
+
const credentialType = raw.payload[0];
|
|
2353
|
+
return new this({
|
|
2354
|
+
nodeId: ctx.sourceNodeId,
|
|
2355
|
+
credentialType,
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
serialize(ctx) {
|
|
2359
|
+
this.payload = Bytes.alloc(1);
|
|
2360
|
+
this.payload[0] = this.credentialType;
|
|
2361
|
+
return super.serialize(ctx);
|
|
2362
|
+
}
|
|
2363
|
+
toLogEntry(ctx) {
|
|
2364
|
+
return {
|
|
2365
|
+
...super.toLogEntry(ctx),
|
|
2366
|
+
message: {
|
|
2367
|
+
"credential type": getEnumMemberName(UserCredentialType, this.credentialType),
|
|
2368
|
+
},
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
return UserCredentialCCCredentialChecksumGet = _classThis;
|
|
2373
|
+
})();
|
|
2374
|
+
export { UserCredentialCCCredentialChecksumGet };
|
|
2375
|
+
let UserCredentialCCAdminPinCodeSet = (() => {
|
|
2376
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.AdminPinCodeSet), useSupervision()];
|
|
2377
|
+
let _classDescriptor;
|
|
2378
|
+
let _classExtraInitializers = [];
|
|
2379
|
+
let _classThis;
|
|
2380
|
+
let _classSuper = UserCredentialCC;
|
|
2381
|
+
var UserCredentialCCAdminPinCodeSet = class extends _classSuper {
|
|
2382
|
+
static { _classThis = this; }
|
|
2383
|
+
static {
|
|
2384
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2385
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2386
|
+
UserCredentialCCAdminPinCodeSet = _classThis = _classDescriptor.value;
|
|
2387
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2388
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2389
|
+
}
|
|
2390
|
+
constructor(options) {
|
|
2391
|
+
super(options);
|
|
2392
|
+
this.pinCode = options.pinCode;
|
|
2393
|
+
}
|
|
2394
|
+
pinCode;
|
|
2395
|
+
static from(raw, ctx) {
|
|
2396
|
+
validatePayload(raw.payload.length >= 1);
|
|
2397
|
+
const pinLength = raw.payload[0] & 0b1111;
|
|
2398
|
+
validatePayload(raw.payload.length >= 1 + pinLength);
|
|
2399
|
+
const pinCode = raw.payload
|
|
2400
|
+
.subarray(1, 1 + pinLength)
|
|
2401
|
+
.toString("ascii");
|
|
2402
|
+
return new this({
|
|
2403
|
+
nodeId: ctx.sourceNodeId,
|
|
2404
|
+
pinCode,
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
serialize(ctx) {
|
|
2408
|
+
const pinCode = this.pinCode.slice(0, 15);
|
|
2409
|
+
this.payload = Bytes.concat([
|
|
2410
|
+
[pinCode.length & 0b1111],
|
|
2411
|
+
Bytes.from(pinCode, "ascii"),
|
|
2412
|
+
]);
|
|
2413
|
+
return super.serialize(ctx);
|
|
2414
|
+
}
|
|
2415
|
+
toLogEntry(ctx) {
|
|
2416
|
+
return {
|
|
2417
|
+
...super.toLogEntry(ctx),
|
|
2418
|
+
message: {
|
|
2419
|
+
"PIN code": credentialToLogString(this.pinCode),
|
|
2420
|
+
},
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
};
|
|
2424
|
+
return UserCredentialCCAdminPinCodeSet = _classThis;
|
|
2425
|
+
})();
|
|
2426
|
+
export { UserCredentialCCAdminPinCodeSet };
|
|
2427
|
+
let UserCredentialCCAdminPinCodeReport = (() => {
|
|
2428
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.AdminPinCodeReport)];
|
|
2429
|
+
let _classDescriptor;
|
|
2430
|
+
let _classExtraInitializers = [];
|
|
2431
|
+
let _classThis;
|
|
2432
|
+
let _classSuper = UserCredentialCC;
|
|
2433
|
+
var UserCredentialCCAdminPinCodeReport = class extends _classSuper {
|
|
2434
|
+
static { _classThis = this; }
|
|
2435
|
+
static {
|
|
2436
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2437
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2438
|
+
UserCredentialCCAdminPinCodeReport = _classThis = _classDescriptor.value;
|
|
2439
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2440
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2441
|
+
}
|
|
2442
|
+
constructor(options) {
|
|
2443
|
+
super(options);
|
|
2444
|
+
this.operationResult = options.operationResult;
|
|
2445
|
+
this.pinCode = options.pinCode;
|
|
2446
|
+
}
|
|
2447
|
+
static from(raw, ctx) {
|
|
2448
|
+
validatePayload(raw.payload.length >= 1);
|
|
2449
|
+
const operationResult = (raw.payload[0] >> 4) & 0b1111;
|
|
2450
|
+
const pinLength = raw.payload[0] & 0b1111;
|
|
2451
|
+
validatePayload(raw.payload.length >= 1 + pinLength);
|
|
2452
|
+
const pinCode = raw.payload
|
|
2453
|
+
.subarray(1, 1 + pinLength)
|
|
2454
|
+
.toString("ascii");
|
|
2455
|
+
return new this({
|
|
2456
|
+
nodeId: ctx.sourceNodeId,
|
|
2457
|
+
operationResult,
|
|
2458
|
+
pinCode,
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
operationResult;
|
|
2462
|
+
pinCode;
|
|
2463
|
+
serialize(ctx) {
|
|
2464
|
+
const pinBuffer = Bytes.from(this.pinCode, "ascii");
|
|
2465
|
+
this.payload = Bytes.alloc(1 + pinBuffer.length);
|
|
2466
|
+
this.payload[0] = ((this.operationResult & 0b1111) << 4)
|
|
2467
|
+
| (pinBuffer.length & 0b1111);
|
|
2468
|
+
if (pinBuffer.length > 0) {
|
|
2469
|
+
this.payload.set(pinBuffer, 1);
|
|
2470
|
+
}
|
|
2471
|
+
return super.serialize(ctx);
|
|
2472
|
+
}
|
|
2473
|
+
persistValues(ctx) {
|
|
2474
|
+
if (!super.persistValues(ctx))
|
|
2475
|
+
return false;
|
|
2476
|
+
if (this.operationResult
|
|
2477
|
+
=== UserCredentialAdminCodeOperationResult.Modified
|
|
2478
|
+
|| this.operationResult
|
|
2479
|
+
=== UserCredentialAdminCodeOperationResult.ResponseToGet) {
|
|
2480
|
+
this.setValue(ctx, UserCredentialCCValues.adminPinCode, this.pinCode);
|
|
2481
|
+
}
|
|
2482
|
+
return true;
|
|
2483
|
+
}
|
|
2484
|
+
toLogEntry(ctx) {
|
|
2485
|
+
return {
|
|
2486
|
+
...super.toLogEntry(ctx),
|
|
2487
|
+
message: {
|
|
2488
|
+
"operation result": getEnumMemberName(UserCredentialAdminCodeOperationResult, this.operationResult),
|
|
2489
|
+
"PIN code": credentialToLogString(this.pinCode),
|
|
2490
|
+
},
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
return UserCredentialCCAdminPinCodeReport = _classThis;
|
|
2495
|
+
})();
|
|
2496
|
+
export { UserCredentialCCAdminPinCodeReport };
|
|
2497
|
+
function testResponseForUserCredentialAdminPinCodeGet(_sent, received) {
|
|
2498
|
+
return (received.operationResult
|
|
2499
|
+
=== UserCredentialAdminCodeOperationResult.ResponseToGet);
|
|
2500
|
+
}
|
|
2501
|
+
let UserCredentialCCAdminPinCodeGet = (() => {
|
|
2502
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.AdminPinCodeGet), expectedCCResponse(UserCredentialCCAdminPinCodeReport, testResponseForUserCredentialAdminPinCodeGet)];
|
|
2503
|
+
let _classDescriptor;
|
|
2504
|
+
let _classExtraInitializers = [];
|
|
2505
|
+
let _classThis;
|
|
2506
|
+
let _classSuper = UserCredentialCC;
|
|
2507
|
+
var UserCredentialCCAdminPinCodeGet = class extends _classSuper {
|
|
2508
|
+
static { _classThis = this; }
|
|
2509
|
+
static {
|
|
2510
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2511
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2512
|
+
UserCredentialCCAdminPinCodeGet = _classThis = _classDescriptor.value;
|
|
2513
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2514
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2517
|
+
return UserCredentialCCAdminPinCodeGet = _classThis;
|
|
2518
|
+
})();
|
|
2519
|
+
export { UserCredentialCCAdminPinCodeGet };
|
|
2520
|
+
let UserCredentialCCKeyLockerEntrySet = (() => {
|
|
2521
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.KeyLockerEntrySet), useSupervision()];
|
|
2522
|
+
let _classDescriptor;
|
|
2523
|
+
let _classExtraInitializers = [];
|
|
2524
|
+
let _classThis;
|
|
2525
|
+
let _classSuper = UserCredentialCC;
|
|
2526
|
+
var UserCredentialCCKeyLockerEntrySet = class extends _classSuper {
|
|
2527
|
+
static { _classThis = this; }
|
|
2528
|
+
static {
|
|
2529
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2530
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2531
|
+
UserCredentialCCKeyLockerEntrySet = _classThis = _classDescriptor.value;
|
|
2532
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2533
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2534
|
+
}
|
|
2535
|
+
constructor(options) {
|
|
2536
|
+
super(options);
|
|
2537
|
+
this.entryType = options.entryType;
|
|
2538
|
+
this.entrySlot = options.entrySlot;
|
|
2539
|
+
this.operationType = options.operationType;
|
|
2540
|
+
if (options.operationType !== UserCredentialOperationType.Delete) {
|
|
2541
|
+
this.entryData = options.entryData;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
entryType;
|
|
2545
|
+
entrySlot;
|
|
2546
|
+
operationType;
|
|
2547
|
+
entryData;
|
|
2548
|
+
static from(raw, ctx) {
|
|
2549
|
+
validatePayload(raw.payload.length >= 4);
|
|
2550
|
+
const entryType = raw.payload[0];
|
|
2551
|
+
const entrySlot = raw.payload.readUInt16BE(1);
|
|
2552
|
+
const operationType = raw.payload[3]
|
|
2553
|
+
& 0b11;
|
|
2554
|
+
if (operationType === UserCredentialOperationType.Delete) {
|
|
2555
|
+
return new this({
|
|
2556
|
+
nodeId: ctx.sourceNodeId,
|
|
2557
|
+
entryType,
|
|
2558
|
+
entrySlot,
|
|
2559
|
+
operationType,
|
|
2560
|
+
});
|
|
2561
|
+
}
|
|
2562
|
+
let entryData = new Bytes();
|
|
2563
|
+
if (raw.payload.length >= 6) {
|
|
2564
|
+
const entryDataLength = raw.payload.readUInt16BE(4);
|
|
2565
|
+
validatePayload(raw.payload.length >= 6 + entryDataLength);
|
|
2566
|
+
entryData = Bytes.from(raw.payload.subarray(6, 6 + entryDataLength));
|
|
2567
|
+
}
|
|
2568
|
+
return new this({
|
|
2569
|
+
nodeId: ctx.sourceNodeId,
|
|
2570
|
+
entryType,
|
|
2571
|
+
entrySlot,
|
|
2572
|
+
operationType,
|
|
2573
|
+
entryData,
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
serialize(ctx) {
|
|
2577
|
+
// For Delete, entry data MAY be omitted
|
|
2578
|
+
if (this.operationType === UserCredentialOperationType.Delete) {
|
|
2579
|
+
this.payload = Bytes.alloc(4);
|
|
2580
|
+
this.payload[0] = this.entryType;
|
|
2581
|
+
this.payload.writeUInt16BE(this.entrySlot, 1);
|
|
2582
|
+
this.payload[3] = this.operationType & 0b11;
|
|
2583
|
+
return super.serialize(ctx);
|
|
2584
|
+
}
|
|
2585
|
+
if (this.entryData == undefined) {
|
|
2586
|
+
throw new ZWaveError(`${this.constructor.name}: entry data must be set for Add/Modify operations`, ZWaveErrorCodes.Argument_Invalid);
|
|
2587
|
+
}
|
|
2588
|
+
this.payload = Bytes.alloc(6 + this.entryData.length);
|
|
2589
|
+
this.payload[0] = this.entryType;
|
|
2590
|
+
this.payload.writeUInt16BE(this.entrySlot, 1);
|
|
2591
|
+
this.payload[3] = this.operationType & 0b11;
|
|
2592
|
+
this.payload.writeUInt16BE(this.entryData.length, 4);
|
|
2593
|
+
if (this.entryData.length > 0) {
|
|
2594
|
+
this.payload.set(this.entryData, 6);
|
|
2595
|
+
}
|
|
2596
|
+
return super.serialize(ctx);
|
|
2597
|
+
}
|
|
2598
|
+
toLogEntry(ctx) {
|
|
2599
|
+
const message = {
|
|
2600
|
+
"entry type": getEnumMemberName(UserCredentialKeyLockerEntryType, this.entryType),
|
|
2601
|
+
"entry slot": this.entrySlot,
|
|
2602
|
+
"operation type": getEnumMemberName(UserCredentialOperationType, this.operationType),
|
|
2603
|
+
};
|
|
2604
|
+
if (this.entryData != undefined) {
|
|
2605
|
+
message["entry data length"] = this.entryData.length;
|
|
2606
|
+
}
|
|
2607
|
+
return { ...super.toLogEntry(ctx), message };
|
|
2608
|
+
}
|
|
2609
|
+
};
|
|
2610
|
+
return UserCredentialCCKeyLockerEntrySet = _classThis;
|
|
2611
|
+
})();
|
|
2612
|
+
export { UserCredentialCCKeyLockerEntrySet };
|
|
2613
|
+
let UserCredentialCCKeyLockerEntryReport = (() => {
|
|
2614
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.KeyLockerEntryReport)];
|
|
2615
|
+
let _classDescriptor;
|
|
2616
|
+
let _classExtraInitializers = [];
|
|
2617
|
+
let _classThis;
|
|
2618
|
+
let _classSuper = UserCredentialCC;
|
|
2619
|
+
var UserCredentialCCKeyLockerEntryReport = class extends _classSuper {
|
|
2620
|
+
static { _classThis = this; }
|
|
2621
|
+
static {
|
|
2622
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2623
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2624
|
+
UserCredentialCCKeyLockerEntryReport = _classThis = _classDescriptor.value;
|
|
2625
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2626
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2627
|
+
}
|
|
2628
|
+
constructor(options) {
|
|
2629
|
+
super(options);
|
|
2630
|
+
this.occupied = options.occupied;
|
|
2631
|
+
this.entryType = options.entryType;
|
|
2632
|
+
this.entrySlot = options.entrySlot;
|
|
2633
|
+
}
|
|
2634
|
+
static from(raw, ctx) {
|
|
2635
|
+
validatePayload(raw.payload.length >= 4);
|
|
2636
|
+
const occupied = !!(raw.payload[0] & 0x01);
|
|
2637
|
+
const entryType = raw.payload[1];
|
|
2638
|
+
const entrySlot = raw.payload.readUInt16BE(2);
|
|
2639
|
+
return new this({
|
|
2640
|
+
nodeId: ctx.sourceNodeId,
|
|
2641
|
+
occupied,
|
|
2642
|
+
entryType,
|
|
2643
|
+
entrySlot,
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
occupied;
|
|
2647
|
+
entryType;
|
|
2648
|
+
entrySlot;
|
|
2649
|
+
serialize(ctx) {
|
|
2650
|
+
this.payload = Bytes.alloc(4);
|
|
2651
|
+
this.payload[0] = this.occupied ? 0x01 : 0x00;
|
|
2652
|
+
this.payload[1] = this.entryType;
|
|
2653
|
+
this.payload.writeUInt16BE(this.entrySlot, 2);
|
|
2654
|
+
return super.serialize(ctx);
|
|
2655
|
+
}
|
|
2656
|
+
persistValues(ctx) {
|
|
2657
|
+
if (!super.persistValues(ctx))
|
|
2658
|
+
return false;
|
|
2659
|
+
this.setValue(ctx, UserCredentialCCValues.keyLockerEntry(this.entryType, this.entrySlot), this.occupied);
|
|
2660
|
+
return true;
|
|
2661
|
+
}
|
|
2662
|
+
toLogEntry(ctx) {
|
|
2663
|
+
return {
|
|
2664
|
+
...super.toLogEntry(ctx),
|
|
2665
|
+
message: {
|
|
2666
|
+
occupied: this.occupied,
|
|
2667
|
+
"entry type": getEnumMemberName(UserCredentialKeyLockerEntryType, this.entryType),
|
|
2668
|
+
"entry slot": this.entrySlot,
|
|
2669
|
+
},
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
return UserCredentialCCKeyLockerEntryReport = _classThis;
|
|
2674
|
+
})();
|
|
2675
|
+
export { UserCredentialCCKeyLockerEntryReport };
|
|
2676
|
+
function testResponseForUserCredentialKeyLockerEntryGet(sent, received) {
|
|
2677
|
+
return received.entryType === sent.entryType
|
|
2678
|
+
&& received.entrySlot === sent.entrySlot;
|
|
2679
|
+
}
|
|
2680
|
+
let UserCredentialCCKeyLockerEntryGet = (() => {
|
|
2681
|
+
let _classDecorators = [CCCommand(UserCredentialCommand.KeyLockerEntryGet), expectedCCResponse(UserCredentialCCKeyLockerEntryReport, testResponseForUserCredentialKeyLockerEntryGet)];
|
|
2682
|
+
let _classDescriptor;
|
|
2683
|
+
let _classExtraInitializers = [];
|
|
2684
|
+
let _classThis;
|
|
2685
|
+
let _classSuper = UserCredentialCC;
|
|
2686
|
+
var UserCredentialCCKeyLockerEntryGet = class extends _classSuper {
|
|
2687
|
+
static { _classThis = this; }
|
|
2688
|
+
static {
|
|
2689
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2690
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2691
|
+
UserCredentialCCKeyLockerEntryGet = _classThis = _classDescriptor.value;
|
|
2692
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2693
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2694
|
+
}
|
|
2695
|
+
constructor(options) {
|
|
2696
|
+
super(options);
|
|
2697
|
+
this.entryType = options.entryType;
|
|
2698
|
+
this.entrySlot = options.entrySlot;
|
|
2699
|
+
}
|
|
2700
|
+
entryType;
|
|
2701
|
+
entrySlot;
|
|
2702
|
+
static from(raw, ctx) {
|
|
2703
|
+
validatePayload(raw.payload.length >= 3);
|
|
2704
|
+
const entryType = raw.payload[0];
|
|
2705
|
+
const entrySlot = raw.payload.readUInt16BE(1);
|
|
2706
|
+
return new this({
|
|
2707
|
+
nodeId: ctx.sourceNodeId,
|
|
2708
|
+
entryType,
|
|
2709
|
+
entrySlot,
|
|
2710
|
+
});
|
|
2711
|
+
}
|
|
2712
|
+
serialize(ctx) {
|
|
2713
|
+
this.payload = Bytes.alloc(3);
|
|
2714
|
+
this.payload[0] = this.entryType;
|
|
2715
|
+
this.payload.writeUInt16BE(this.entrySlot, 1);
|
|
2716
|
+
return super.serialize(ctx);
|
|
2717
|
+
}
|
|
2718
|
+
toLogEntry(ctx) {
|
|
2719
|
+
return {
|
|
2720
|
+
...super.toLogEntry(ctx),
|
|
2721
|
+
message: {
|
|
2722
|
+
"entry type": getEnumMemberName(UserCredentialKeyLockerEntryType, this.entryType),
|
|
2723
|
+
"entry slot": this.entrySlot,
|
|
2724
|
+
},
|
|
2725
|
+
};
|
|
2726
|
+
}
|
|
2727
|
+
};
|
|
2728
|
+
return UserCredentialCCKeyLockerEntryGet = _classThis;
|
|
2729
|
+
})();
|
|
2730
|
+
export { UserCredentialCCKeyLockerEntryGet };
|
|
2731
|
+
//# sourceMappingURL=UserCredentialCC.js.map
|