@contentstack/cli-auth
Version:
Contentstack CLI plugin for authentication activities
42 lines (41 loc) • 1.26 kB
TypeScript
/**
* @class
* MFA handler for managing multi-factor authentication
*/
declare class MFAHandler {
private readonly encrypter;
constructor();
/**
* Validates if a string is a valid base32 secret
* @param secret The secret to validate
* @returns true if valid, false otherwise
*/
private isValidBase32;
/**
* Generates an MFA code from a provided secret
* @param secret The MFA secret to use
* @returns string The generated MFA code
* @throws Error if the secret is invalid or code generation fails
*/
generateMFACode(secret: string): string;
/**
* Gets MFA code from stored configuration
* @returns Promise<string> The MFA code
* @throws Error if MFA code generation fails
*/
getMFACode(): Promise<string>;
/**
* Gets MFA code through manual user input
* @returns Promise<string> The MFA code
* @throws Error if code format is invalid
*/
getManualMFACode(): Promise<string>;
/**
* Validates an MFA code format
* @param code The MFA code to validate
* @returns boolean True if valid, false otherwise
*/
isValidMFACode(code: string): boolean;
}
declare const _default: MFAHandler;
export default _default;