import { User, AuthToken, LoginCredentials, SecurityEvent, AuthConfig } from './types.js'; /** * Authentication service for miura Framework. * * Acts as a client-side session consumer: it calls your server-side auth API, * stores the tokens it receives, and manages refresh/expiry locally. * * Tokens are ALWAYS issued by the server. This service never generates tokens. * * Configure endpoints via `AuthenticationService.configure()` before first use. */ export declare class AuthenticationService { private static instance; private config; private currentUser; private currentToken; private loginAttempts; private eventListeners; private refreshTimer; private constructor(); static getInstance(): AuthenticationService; /** * Configure auth endpoints and behaviour before first use. * Call this once at app startup (e.g. in miuraFramework.connectedCallback). */ configure(config: Partial): void; /** * Login with credentials. * Calls `config.loginEndpoint`; the server response must match `AuthLoginResponse`. */ login(credentials: LoginCredentials): Promise<{ success: boolean; user?: User; error?: string; }>; /** * Logout the current user. * Notifies the server (best-effort) and clears local session. */ logout(): Promise; /** * Attempt to refresh the access token using the stored refresh token. * Returns true if the token was successfully refreshed. */ refreshToken(): Promise; getCurrentUser(): User | null; getCurrentToken(): AuthToken | null; /** * Returns the Bearer token string ready to use in an Authorization header, * or null if the session is invalid/expired. */ getBearerToken(): string | null; isAuthenticated(): boolean; on(event: string, callback: (event: SecurityEvent) => void): void; off(event: string, callback: (event: SecurityEvent) => void): void; private scheduleTokenRefresh; private isAccountLocked; private recordFailedAttempt; private emitSecurityEvent; private saveToStorage; private loadFromStorage; private clearStorage; } export declare const auth: AuthenticationService; //# sourceMappingURL=authentication.d.ts.map