import { BaseOAuthProvider } from './providers/index.js'; import { AuthConfig, AuthProvider, AuthRequiredType, AuthToken, ConfigStore, MfaService, SessionManager, User, EmailVerificationService, SmsVerificationService } from './types.js'; import { KnexUserService } from './userService.js'; import { AuthPlugin } from './plugins/types.js'; import { Knex } from 'knex'; export declare class DynamicAuthManager { private config; private pluginRegistry; private knex; private configStore; providers: Record; private sessionManager; private userService; private refreshInterval; private enableConfigIntervalCheck; private emailVerificationService?; private smsVerificationService?; private mfaService?; constructor(knex: Knex, configStore: ConfigStore, sessionManager: SessionManager, userService: KnexUserService, refreshInterval?: number, enableConfigIntervalCheck?: boolean, emailVerificationService?: EmailVerificationService | null, smsVerificationService?: SmsVerificationService | null, mfaService?: MfaService | null); getUserService(): KnexUserService; registerProvider(provider: string, authProvider: AuthProvider | BaseOAuthProvider): void; private watchConfig; private executeHooks; registerPlugin(plugin: AuthPlugin): Promise; getPlugins(): AuthPlugin[]; getPlugin(name: string): AuthPlugin; getEmailVerificationService(): EmailVerificationService | undefined; getProviders(): Record; getProvider(provider: string): AuthProvider | BaseOAuthProvider | undefined; getProviderConfig(provider: string): Promise> | Promise<{ clientID: any; clientSecret: any; callbackURL: string; scopes: any; redirect_url: string; }>; getConfig(): { enabledProviders: string[]; authPolicy: { emailVerificationRequired: boolean; passwordReset: boolean; passwordChange: boolean; accountDeletion: boolean; smsVerificationRequired: boolean; loginAfterRegistration: boolean; }; passwordPolicy: { minLength: number; requireUppercase: boolean; requireLowercase: boolean; requireNumber: boolean; requireSpecialChar: boolean; maxAttempts: number; }; sessionSettings: { accessTokenTTL: string; refreshTokenTTL: string; tokenRotation: boolean; multipleSessions: boolean; }; mfaSettings: { required: boolean; allowedMethods: ("totp" | "sms" | "email")[]; }; adminFeature: { enabled: boolean; createInitialApiKey: boolean; initialApiKeyName: string; initialApiKeyScopes: string[]; }; rateLimiting: Record; id?: number | undefined; }; getMfaStatus(): boolean; register(provider: string, credentials: Partial, password: string): Promise<{ user?: User; token: AuthToken | string | AuthRequiredType; url?: URL; verificationToken?: string; }>; oauthCallback(provider: string, { code, state }: { code: string; state: string; }): Promise<{ user?: User; token: AuthToken | string | AuthRequiredType; }>; login(provider: string, credentials: Record): Promise<{ user?: User; token: AuthToken | string | AuthRequiredType; url?: URL; }>; refreshToken(refreshToken: string): Promise; createToken(user: User): Promise; validateSessionToken(token: string): Promise; validateToken(token: string, provider: string): Promise<{ user: User; token?: string | AuthToken; }>; logout(token: string): Promise; verifyEmail(userId: string, verificationCode: string): Promise<{ user: User; token: AuthToken | string; }>; /** * Send a verification email to the user * @param email The recipient's email address * @param verificationUrl Optional custom verification URL base * @returns The generated verification token if the service returns one */ sendVerificationEmail(email: string, verificationUrl?: string): Promise; /** * Send a password reset email to the user * @param email The recipient's email address * @param resetUrl Optional custom reset URL base * @returns The generated reset token if the service returns one */ sendPasswordResetEmail(email: string, resetUrl?: string): Promise; /** * Verify a password reset token * @param userId The user ID * @param token The reset token * @returns Whether the token is valid */ verifyPasswordResetToken(userId: string, token: string): Promise; sendVerificationSms(phone: string): Promise; verifySms(userId: string, verificationCode: string): Promise<{ user: User; token: string | AuthToken; }>; /** * Reset a user's password * @param userId The user ID * @param newPassword The new password * @param token Optional reset token for token-based password reset * @returns True if the password was reset successfully */ resetPassword(userId: string, newPassword: string, token?: string): Promise; verifyMfa(userId: string, code: string): Promise; enableMfa(userId: string, code?: string): Promise<{ secret?: string; uri?: string; } | { recoveryCodes: string[]; }>; disableMfa(userId: string, code: string): Promise; /** * Change a user's password (requires authentication) * @param userId The user ID * @param oldPassword The current password * @param newPassword The new password * @returns True if the password was changed successfully */ changePassword(userId: string, oldPassword: string, newPassword: string): Promise; updateConfig(update: Partial): Promise<{ enabledProviders: string[]; authPolicy: { emailVerificationRequired: boolean; passwordReset: boolean; passwordChange: boolean; accountDeletion: boolean; smsVerificationRequired: boolean; loginAfterRegistration: boolean; }; passwordPolicy: { minLength: number; requireUppercase: boolean; requireLowercase: boolean; requireNumber: boolean; requireSpecialChar: boolean; maxAttempts: number; }; sessionSettings: { accessTokenTTL: string; refreshTokenTTL: string; tokenRotation: boolean; multipleSessions: boolean; }; mfaSettings: { required: boolean; allowedMethods: ("totp" | "sms" | "email")[]; }; adminFeature: { enabled: boolean; createInitialApiKey: boolean; initialApiKeyName: string; initialApiKeyScopes: string[]; }; rateLimiting: Record; id?: number | undefined; }>; setRTP(userId: string, list: string[], type: 'teams' | 'permissions' | 'labels'): Promise; removeRTP(userId: string, list: string[], type: 'teams' | 'permissions' | 'labels'): Promise; addRTP(userId: string, list: string[], type: 'teams' | 'permissions' | 'labels'): Promise; setRole(userId: string, role: string): Promise; } export declare class AuthConfigAPI { private configStore; constructor(configStore: ConfigStore); getConfig(): Promise<{ enabledProviders: string[]; authPolicy: { emailVerificationRequired: boolean; passwordReset: boolean; passwordChange: boolean; accountDeletion: boolean; smsVerificationRequired: boolean; loginAfterRegistration: boolean; }; passwordPolicy: { minLength: number; requireUppercase: boolean; requireLowercase: boolean; requireNumber: boolean; requireSpecialChar: boolean; maxAttempts: number; }; sessionSettings: { accessTokenTTL: string; refreshTokenTTL: string; tokenRotation: boolean; multipleSessions: boolean; }; mfaSettings: { required: boolean; allowedMethods: ("totp" | "sms" | "email")[]; }; adminFeature: { enabled: boolean; createInitialApiKey: boolean; initialApiKeyName: string; initialApiKeyScopes: string[]; }; rateLimiting: Record; id?: number | undefined; }>; updateConfig(update: Partial, initiator: string): Promise<{ enabledProviders: string[]; authPolicy: { emailVerificationRequired: boolean; passwordReset: boolean; passwordChange: boolean; accountDeletion: boolean; smsVerificationRequired: boolean; loginAfterRegistration: boolean; }; passwordPolicy: { minLength: number; requireUppercase: boolean; requireLowercase: boolean; requireNumber: boolean; requireSpecialChar: boolean; maxAttempts: number; }; sessionSettings: { accessTokenTTL: string; refreshTokenTTL: string; tokenRotation: boolean; multipleSessions: boolean; }; mfaSettings: { required: boolean; allowedMethods: ("totp" | "sms" | "email")[]; }; adminFeature: { enabled: boolean; createInitialApiKey: boolean; initialApiKeyName: string; initialApiKeyScopes: string[]; }; rateLimiting: Record; id?: number | undefined; }>; private auditLog; } //# sourceMappingURL=authManager.d.ts.map