UNPKG

fql-toolkit

Version:
34 lines 1.47 kB
import type { AuthManagerOptions, AuthState, AuthResult, AuthUser } from './types.js'; export declare class AuthManager { private readonly baseURL; private readonly storage; private state; private readonly listeners; private readonly authErrorListeners; constructor({ baseURL, storage }: AuthManagerOptions); getState(): AuthState; getToken(): string | null; subscribe(listener: () => void): () => void; /** Register a listener fired when a request is rejected for a dead token. */ onAuthError(listener: () => void): () => void; /** Fired by the HTTP client on a 401/450 response. */ emitAuthError(): void; enterAsGuest(): Promise<AuthResult>; login(email: string, password: string): Promise<AuthResult>; logout(): Promise<void>; register(email: string, opts?: { activationURL?: string; }): Promise<AuthResult>; activateAccount(nickname: string, activationToken: string, password: string): Promise<AuthResult>; requestPasswordReset(email: string, opts?: { resetPasswordURL?: string; }): Promise<AuthResult>; resetPassword(token: string, newPassword: string): Promise<AuthResult>; protected _setState(next: AuthState): void; protected _setUser(user: AuthUser | null): void; protected _post<T>(path: string, body: Record<string, unknown>): Promise<T>; private _notify; private _persist; private _hydrate; } //# sourceMappingURL=AuthManager.d.ts.map