@lightninglabs/lnc-web
Version:
Lightning Node Connect npm module for web
69 lines • 2.14 kB
TypeScript
import SessionManager from '../sessions/sessionManager';
import { SessionCredentials } from '../sessions/types';
/**
* Coordinates session-related operations and lifecycle management.
*/
export declare class SessionCoordinator {
private refreshManager?;
private sessionManager?;
constructor(sessionManager?: SessionManager);
/**
* Check if there is an active session
*/
get hasActiveSession(): boolean;
/**
* Check if the session manager is available
*/
get isSessionAvailable(): boolean;
/**
* Get the session expiry
*/
get sessionExpiry(): Date | undefined;
/**
* Check if the automatic session refresh is active
*/
get isAutoRefreshActive(): boolean;
/**
* Get the session manager
*/
getSessionManager(): SessionManager | undefined;
/**
* Clear the current session
*/
clearSession(): void;
/**
* Check if the session can be automatically restored
*/
canAutoRestore(): Promise<boolean>;
/**
* Try to automatically restore the session. Returns the restored
* credentials on success or undefined on failure. Starts the refresh
* manager automatically when restoration succeeds. Defensive try/catch
* ensures callers always get a value, even if a future change introduces
* a throwing path.
*/
tryAutoRestore(): Promise<SessionCredentials | undefined>;
/**
* Create a new session
*/
createSession(credentials: SessionCredentials): Promise<void>;
/**
* Refresh the current session. Infrastructure errors (crypto, storage)
* propagate so that callers can distinguish them from a graceful refusal
* (returned as false).
*/
refreshSession(): Promise<boolean>;
/**
* Get the time remaining until the session expires
*/
getTimeRemaining(): Promise<number>;
/**
* Start the automatic session refresh manager.
*/
private startRefreshManager;
/**
* Stop the automatic session refresh manager
*/
private stopRefreshManager;
}
//# sourceMappingURL=sessionCoordinator.d.ts.map