import type { AuthUser, AuthSession, SessionConfig, SessionManagerStorage } from "../types/index.js";
/**
 * In-memory session storage
 *
 * Simple session storage using Map. Suitable for single-instance deployments
 * or development. Sessions are lost on restart.
 */
export declare class MemorySessionStorage implements SessionManagerStorage {
    private sessions;
    private userSessions;
    get(sessionId: string): Promise<AuthSession | null>;
    set(session: AuthSession): Promise<void>;
    delete(sessionId: string): Promise<void>;
    getUserSessions(userId: string): Promise<AuthSession[]>;
    deleteUserSessions(userId: string): Promise<void>;
    clear(): Promise<void>;
    isHealthy(): Promise<boolean>;
}
/**
 * Redis session storage
 *
 * Distributed session storage using Redis. Suitable for multi-instance
 * deployments. Requires the "redis" (node-redis) package.
 *
 * Note: Redis client must be provided or configured via environment.
 */
export declare class RedisSessionStorage implements SessionManagerStorage {
    private prefix;
    private ttl;
    private redisUrl;
    private client;
    private initPromise;
    constructor(config: {
        url: string;
        prefix?: string;
        ttl?: number;
    });
    private getClient;
    private createClient;
    private sessionKey;
    private userSessionsKey;
    get(sessionId: string): Promise<AuthSession | null>;
    set(session: AuthSession): Promise<void>;
    delete(sessionId: string): Promise<void>;
    getUserSessions(userId: string): Promise<AuthSession[]>;
    deleteUserSessions(userId: string): Promise<void>;
    clear(): Promise<void>;
    isHealthy(): Promise<boolean>;
    disconnect(): Promise<void>;
}
/**
 * Session Manager
 *
 * High-level session management that handles session lifecycle,
 * automatic refresh, and storage abstraction.
 */
export declare class SessionManager {
    private storage;
    private config;
    constructor(config?: SessionConfig);
    private createStorage;
    /**
     * Create a new session
     */
    createSession(user: AuthUser, metadata?: {
        ipAddress?: string;
        userAgent?: string;
        deviceId?: string;
    }): Promise<AuthSession>;
    private _createSession;
    /**
     * Get a session by ID
     *
     * Optionally auto-refreshes if close to expiration.
     */
    getSession(sessionId: string, autoRefresh?: boolean | undefined): Promise<AuthSession | null>;
    private _getSession;
    /**
     * Check if session should be refreshed
     */
    private shouldRefresh;
    /**
     * Refresh a session
     */
    refreshSession(sessionId: string): Promise<AuthSession | null>;
    /**
     * Destroy a session
     */
    destroySession(sessionId: string): Promise<void>;
    /**
     * Get all sessions for a user
     */
    getUserSessions(userId: string): Promise<AuthSession[]>;
    /**
     * Destroy all sessions for a user (global logout)
     */
    destroyAllUserSessions(userId: string): Promise<void>;
    /**
     * Validate a session is still active
     */
    validateSession(sessionId: string): Promise<boolean>;
    /**
     * Update session metadata
     */
    updateSessionMetadata(sessionId: string, metadata: Record<string, unknown>): Promise<AuthSession | null>;
    /**
     * Health check
     */
    isHealthy(): Promise<boolean>;
    /**
     * Clear all sessions (for testing/cleanup)
     */
    clear(): Promise<void>;
}
/**
 * Create session storage based on configuration
 */
export declare function createSessionStorage(config: SessionConfig): SessionManagerStorage;
