import { CyphlensErrorCallback, CyphlensEvent, DisconnectEvent, EventCallback, EventType, FileKeyEvent, StatusType, TwoFactorEvent } from './types'; import { DEFAULT_BASE_URL } from "./constants"; export { EventType, StatusType, DEFAULT_BASE_URL, }; export type { EventCallback, TwoFactorEvent, CyphlensErrorCallback, DisconnectEvent, CyphlensEvent, FileKeyEvent }; export declare class Cyphlens { private baseUrl; private eventSource; private sessionID?; private onSuccess?; private onError?; private timeoutId; private isFileKeySwipe; /** * Initializes the Cyphlens service with a base URL. * @param baseUrl The base API URL for connecting to the Cyphlens service. * @param isFileKeySwipe set true if listening to FileKey swipe events */ constructor(baseUrl?: string, isFileKeySwipe?: boolean); /** * Updates the base API URL. * @param baseUrl The new base URL. */ setBaseUrl(baseUrl: string): void; /** * Updates the isFileKeySwipe flag. * @param isFileKeySwipe set true if listening to FileKey swipe events. */ setIsFileKeySwipe(isFileKeySwipe: boolean): void; /** * Starts the Server-Sent Events (SSE) connection to listen for authentication events. * @returns The EventSource instance if successful, otherwise null. */ private start; /** * Sets up a timeout to automatically stop the SSE connection when the event expires. * @param expiresAt The expiration timestamp (milliseconds). * @param createdAt The creation timestamp (milliseconds). */ private setupTimeout; /** * Starts listening for authentication events. * @param sessionId The session ID used for authentication. * @param onData Callback function for handling successful authentication events. * @param onError Callback function for handling errors. * @returns The EventSource instance if successfully started, otherwise null. */ listen(sessionId: string, onData?: EventCallback, onError?: CyphlensErrorCallback): EventSource | null; /** * Stops the SSE connection and clears any active timeouts. */ stop(): void; /** * Handles browser visibility changes to restart the SSE connection when the page becomes visible. * This is primarily to prevent connection loss in Safari when the tab goes to the background. * Only applies to Mobile Safari. */ private readonly onVisibilityChange; } export type CyphlensExports = { Cyphlens: typeof Cyphlens; EventType: typeof EventType; StatusType: typeof StatusType; TwoFactorEvent: TwoFactorEvent; CyphlensEvent: CyphlensEvent; DisconnectEvent: DisconnectEvent; EventCallback: EventCallback; CyphlensErrorCallback: CyphlensErrorCallback; }; //# sourceMappingURL=index.d.ts.map