/** * AUTHENTICATION SERVICE * Handles JWT tokens, Shield API integration, and permission management * * Features: * - JWT token validation (RS256) * - Token refresh mechanism * - Permission/role checking * - Shield API integration */ import type { AuthToken, JWTPayload, PermissionLevel, User } from '../types'; /** * Parse and validate JWT token * Returns null if invalid or expired */ export declare function parseJWT(token: string): JWTPayload | null; /** * Check if token is valid and not expired */ export declare function isTokenValid(token: string): boolean; /** * Get remaining time until token expiry (in ms) * Returns 0 if token is expired */ export declare function getTokenExpiryTime(token: string): number; /** * Store tokens securely * Access token: in-memory only (XSS protection via httpOnly fallback) * Refresh token: localStorage (for persistence across sessions) */ export declare function storeTokens(_accessToken: string, refreshToken?: string): void; /** * Get stored refresh token */ export declare function getRefreshToken(): string | null; /** * Clear all auth tokens */ export declare function clearTokens(): void; /** * Refresh access token using refresh token */ export declare function refreshAccessToken(refreshToken: string): Promise; /** * Permission checking utility */ export declare function hasPermission(userPermission: PermissionLevel, requiredPermission: PermissionLevel): boolean; /** * Validate user has specific permission */ export declare function checkPermission(permissions: PermissionLevel[], required: PermissionLevel): boolean; /** * Get current user from token */ export declare function getCurrentUser(token: string): Promise; /** * Login with email/password */ export declare function loginWithCredentials(email: string, password: string): Promise<{ user: User; token: AuthToken; } | null>; /** * OAuth redirect (Google, GitHub, etc.) */ export declare function getOAuthUrl(provider: 'google' | 'github'): string; /** * Logout user */ export declare function logout(token: string): Promise; //# sourceMappingURL=index.d.ts.map