homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
60 lines (59 loc) • 2.65 kB
TypeScript
import { JwtService } from '@nestjs/jwt';
import { PluginsSettingsUiTicketService } from '../../modules/custom-plugins/plugins-settings-ui/plugins-settings-ui-ticket.service.js';
import { UserDto } from '../../modules/users/users.dto.js';
import { ConfigService } from '../config/config.service.js';
import { JsonFileStoreService } from '../fs/json-file-store.service.js';
import { Logger } from '../logger/logger.service.js';
export declare class AuthService {
private readonly jwtService;
private readonly configService;
private readonly jsonStore;
private readonly logger;
private readonly pluginUiTicketService;
private otpUsageCache;
private loginFailureCache;
private userCache;
private firstUserSetupInProgress;
private legacyOtpGuardrails;
constructor(jwtService: JwtService, configService: ConfigService, jsonStore: JsonFileStoreService, logger: Logger, pluginUiTicketService: PluginsSettingsUiTicketService);
authenticate(username: string, password: string, otp?: string, clientId?: string): Promise<any>;
signIn(username: string, password: string, otp?: string, clientId?: string): Promise<any>;
private checkPassword;
private upgradePasswordHashIfNeeded;
generateNoAuthToken(): Promise<{
access_token: string;
token_type: string;
expires_in: number;
}>;
refreshToken(user: any, reason?: string): Promise<any>;
private refreshTokenLogMessage;
validateUser(payload: any): Promise<any>;
private validateServiceToken;
private findCurrentUser;
private invalidateUserCache;
private hashPassword;
private genSalt;
setupFirstUser(user: UserDto): Promise<UserDto>;
generateSetupWizardToken(): Promise<{
access_token: string;
token_type: string;
expires_in: number;
}>;
checkAuthFile(): Promise<void>;
desensitiseUserProfile(user: UserDto): UserDto;
getUsers(strip?: boolean): Promise<UserDto[]>;
findByUsername(username: string): Promise<UserDto>;
private withAuthFile;
addUser(user: UserDto): Promise<UserDto>;
deleteUser(id: number): Promise<void>;
updateUser(id: number, update: UserDto): Promise<UserDto>;
updateOwnPassword(username: string, currentPassword: string, newPassword: string): Promise<UserDto>;
setupOtp(username: string): Promise<{
timestamp: Date;
otpauth: string;
}>;
activateOtp(username: string, code: string): Promise<UserDto>;
deactivateOtp(username: string, password: string): Promise<UserDto>;
verifyOtpToken(user: UserDto, otp: string): Promise<boolean>;
private markUserAsLegacyOtp;
}