import { type UserCredentialCapability, UserCredentialRule, UserCredentialType, UserCredentialUserType } from "@zwave-js/cc"; import { type SupervisionResult } from "@zwave-js/core"; import { FeatureAPI } from "./FeatureAPI.js"; export interface UserCapabilities { maxUsers: number; supportedUserTypes: readonly UserCredentialUserType[]; maxUserNameLength: number | undefined; supportedCredentialRules: readonly UserCredentialRule[]; supportsUsersWithoutCredentials: boolean; } export interface CredentialCapabilities { supportedCredentialTypes: ReadonlyMap; supportsAdminCode: boolean; supportsAdminCodeDeactivation: boolean; /** * Whether existing credentials can be reassigned between users via * {@link AccessControlAPI.assignCredential} without re-enrolling them. */ supportsCredentialAssignment: boolean; } export interface UserData { userId: number; active: boolean; userType: UserCredentialUserType; userName?: string; credentialRule?: UserCredentialRule; expiringTimeoutMinutes?: number; } export interface CredentialData { userId: number; type: UserCredentialType; slot: number; data?: string | Uint8Array; } export interface SetUserOptions { active?: boolean; userType?: UserCredentialUserType; userName?: string; credentialRule?: UserCredentialRule; expiringTimeoutMinutes?: number; } export interface DeleteCredentialsOptions { /** * Only delete credentials owned by this user. When omitted or `0`, the * filter is treated as a wildcard and credentials for all users are * deleted. */ userId?: number; /** * Only delete credentials of this type. When omitted or * {@link UserCredentialType.None}, the filter is treated as a wildcard and * credentials of all types are deleted. */ credentialType?: UserCredentialType; } /** Result of an addUser call */ export interface AddUserResult { /** Result of adding the user. */ user: SetUserResult; /** * Result of adding the credential. Only present when a credential was * provided. On User Code CC, the user and credential are written as a * single operation, so this mirrors {@link AddUserResult.user}. */ credential?: SetCredentialResult; } /** Result of a setUser / deleteUser / deleteAllUsers call */ export declare enum SetUserResult { OK = 0, Error_AddRejectedLocationOccupied = 1, Error_ModifyRejectedLocationEmpty = 2, Error_Unknown = 255 } /** Result of a setCredential / deleteCredential call */ export declare enum SetCredentialResult { OK = 0, Error_AddRejectedLocationOccupied = 1, Error_ModifyRejectedLocationEmpty = 2, Error_DuplicateCredential = 3, Error_ManufacturerSecurityRules = 4, Error_DuplicateAdminPINCode = 5, Error_WrongUserUniqueIdentifier = 6, Error_Unknown = 255 } /** Result of an assignCredential call */ export declare enum AssignCredentialResult { OK = 0, /** Spec statuses 0x01 / 0x02 / 0x03 — credential type / slot invalid or empty */ Error_InvalidCredential = 1, /** Spec statuses 0x04 / 0x05 — destination user invalid or nonexistent */ Error_InvalidUser = 2, Error_Unknown = 255 } /** High-level API for managing users and credentials on access control devices */ export declare class AccessControlAPI extends FeatureAPI { #private; /** * Returns the user-related capabilities of this endpoint. * This method uses cached information from the most recent interview. */ getUserCapabilitiesCached(): UserCapabilities; /** * Returns the credential-related capabilities of this endpoint. * This method uses cached information from the most recent interview. */ getCredentialCapabilitiesCached(): CredentialCapabilities; /** * Returns the data for the user with the given ID. * This communicates with the node to retrieve fresh information. */ getUser(userId: number): Promise; /** * Returns the data for the user with the given ID. * This method uses cached information from the most recent interview. */ getUserCached(userId: number): UserData | undefined; /** * Returns the data for all configured users. * This communicates with the node to retrieve fresh information. */ getUsers(): Promise; /** * Returns the data for all configured users. * This method uses cached information from the most recent interview. */ getUsersCached(): UserData[]; /** * Creates a new user with the given ID, optionally writing a credential at * the same time. * * This communicates with the node. * * @param credential - The credential to set for this user. On devices where `supportsUsersWithoutCredentials` is `false`, this field is required. */ addUser(userId: number, options: SetUserOptions, credential?: { type: UserCredentialType; slot: number; data: string | Uint8Array; }): Promise; /** * Creates or updates the user with the given ID. * This communicates with the node. */ setUser(userId: number, options: SetUserOptions): Promise; /** * Deletes the user with the given ID and all of their credentials. * This communicates with the node. */ deleteUser(userId: number): Promise; /** * Deletes all users and their credentials. * This communicates with the node. */ deleteAllUsers(): Promise; /** * Returns the data for a specific credential type and slot. * This communicates with the node to retrieve fresh information. */ getCredential(type: UserCredentialType, slot: number): Promise; /** * Returns the data for a specific credential type and slot. * This method uses cached information from the most recent interview. */ getCredentialCached(type: UserCredentialType, slot: number): CredentialData | undefined; /** * Returns all credentials for the given user and optional type. * This communicates with the node to retrieve fresh information. */ getCredentialsForUser(userId: number, type?: UserCredentialType): Promise; /** * Returns all credentials for the given user and optional type. * This method uses cached information from the most recent interview. */ getCredentialsForUserCached(userId: number, type?: UserCredentialType): CredentialData[]; /** * Returns all credentials of the given type, regardless of ownership. * This communicates with the node to retrieve fresh information. */ getCredentialsByType(type: UserCredentialType): Promise; /** * Returns all credentials of the given type, regardless of ownership. * This method uses cached information from the most recent interview. */ getCredentialsByTypeCached(type: UserCredentialType): CredentialData[]; /** * Returns all credentials, regardless of ownership or type. * This communicates with the node to retrieve fresh information. */ getAllCredentials(): Promise; /** * Returns all credentials, regardless of ownership or type. * This method uses cached information from the most recent interview. */ getAllCredentialsCached(): CredentialData[]; /** * Creates or updates a credential for the given user. * This communicates with the node. */ setCredential(userId: number, type: UserCredentialType, slot: number, data: string | Uint8Array): Promise; /** * Deletes the given credential. * This communicates with the node. */ deleteCredential(type: UserCredentialType, slot: number): Promise; deleteCredential(userId: number | undefined, type: UserCredentialType, slot: number): Promise; /** * Deletes credentials matching the given filters. */ deleteCredentials(options?: DeleteCredentialsOptions): Promise; /** * Assigns an existing credential to a different user, without re-enrolling * it. Useful for credentials that were added locally on the device (e.g. a * biometric auto-assigned to a fresh user) that need to be attached to an * existing user which already has other credentials. * * Only supported on nodes using the User Credential CC. Use * {@link getCredentialCapabilitiesCached} to check for support via the * `supportsCredentialAssignment` property. * * This communicates with the node. */ assignCredential(type: UserCredentialType, slot: number, destinationUserId: number): Promise; /** * Starts a learn process for the given credential slot, allowing a user * to input a credential directly on the device. * Only supported on nodes using the User Credential CC. * This communicates with the node. */ startCredentialLearn(userId: number, type: UserCredentialType, slot: number, timeout?: number): Promise; /** * Cancels an ongoing credential learn process. * Only supported on nodes using the User Credential CC. * This communicates with the node. */ cancelCredentialLearn(): Promise; /** * Retrieves the admin code from the node. * This communicates with the node to retrieve fresh information. */ getAdminCode(): Promise; /** * Sets the admin code on the node. * This communicates with the node. */ setAdminCode(code: string): Promise; } //# sourceMappingURL=AccessControl.d.ts.map