@enteocode/nestjs-mfa
Version:
Implementation agnostic RFC-compliant Multi-Factor Authentication (2FA/MFA) module for NestJS with recovery code support
36 lines (35 loc) • 1.05 kB
TypeScript
import { StorageService } from './storage.service';
import { EventEmitter2 as EventEmitter } from '@nestjs/event-emitter';
import { OtpService } from './otp.service';
import type { Identifier, RecoveryCode } from './types';
export declare class MfaRecoveryService {
private readonly storage;
private readonly otp;
private readonly emitter;
private readonly logger;
constructor(storage: StorageService, otp: OtpService, emitter: EventEmitter);
/**
* Persists the generated recovery codes
*
* @public
* @param user
* @param count
* @param byteLength
*/
enable(user: Identifier, count?: number, byteLength?: number): Promise<Set<RecoveryCode> | null>;
/**
* Disables recovery
*
* @public
* @param user
*/
disable(user: Identifier): Promise<boolean>;
/**
* Recovers the lost account by creating a new secret
*
* @public
* @param user
* @param code
*/
recover(user: Identifier, code: RecoveryCode): Promise<boolean>;
}