mya-cli
Version:
MYA - AI-Powered Stock & Options Analysis CLI Tool
65 lines (64 loc) • 2.14 kB
TypeScript
/**
* Authentication manager for coordinating authentication operations
* Acts as a facade to simplify authentication operations and maintain backward compatibility
*/
import { OtpSendResponse, SessionResponse } from '../interfaces/auth-interfaces.js';
import type { AuthManagerInterface } from '../interfaces/auth-manager-interface.js';
/**
* Authentication manager singleton
* Single responsibility: Provide unified access to authentication operations
*/
export declare class AuthManager implements AuthManagerInterface {
private static instance;
/**
* Create a new auth manager
* @param authProvider Authentication provider
*/
private constructor();
/**
* Get the singleton instance of AuthManager
* @returns AuthManager instance
*/
static getInstance(): AuthManager;
private get baseUrl();
/**
* Send a one-time code to the provided email
* @param email Email to send code to
* @returns Response with method ID
*/
sendOtpCode(email: string): Promise<OtpSendResponse>;
/**
* Logout the user by clearing the token from the backend
* @returns Success status
*/
logout(): Promise<{
success: boolean;
message: string;
}>;
/**
* Check authentication status from the backend
* @returns Authentication status information
*/
checkAuthStatus(): Promise<{
authenticated: boolean;
user?: {
id: string;
email: string;
};
expiresAt?: number;
}>;
/**
* Verify a one-time code
* @param methodId Method ID from send operation
* @param code OTP code received by user
* @param email Email associated with the OTP
* @returns Session information upon successful verification
*/
verifyOtpCode(methodId: string, code: string, email: string): Promise<SessionResponse>;
/**
* Set a custom authentication provider
* Used primarily for testing or alternative implementations
* @param provider Authentication provider implementation
*/
setAuthProvider(_provider: unknown): void;
}