import { HandshakeMessage, HandshakeResponseMessage } from './types'; export interface HandshakeManagerConfig { type: 'host' | 'client'; targetOrigin?: string; selfOrigin: string; version: string; timeout?: number; } /** * HandshakeManager handles the handshake process between host and client applications. * It abstracts the complexity of establishing a secure connection between the two sides. */ export declare class HandshakeManager { private config; private eventEmitter; private handshakeComplete; private retryCount; private retryTimeout; private pendingInitMessage; constructor(config: HandshakeManagerConfig); /** * Initializes the handshake process for the client side. * This method sends a handshake initialization message and waits for a response. * * @returns A promise that resolves when the handshake is complete. */ initializeClient(sendMessage: (message: HandshakeMessage) => void): Promise; /** * Initializes the handshake process for the host side. * This method listens for handshake initialization messages from the client. */ initializeHost(): void; /** * Handles an incoming handshake message. * If it's an initialization message from the client, it will either respond or store it for later. * If it's a response message from the host, it will complete the handshake. * * @param message The received handshake message * @param sendResponse Function to send a response back (optional, if not provided will buffer the message) */ handleHandshakeMessage(message: HandshakeMessage | HandshakeResponseMessage, sendResponse?: (message: HandshakeResponseMessage) => void): void; /** * Checks if there's a pending handshake init message that was received * before the target was ready. */ hasPendingInitMessage(): boolean; /** * Processes any pending handshake init message that was received before * the target was ready. * * @param sendResponse Function to send a response * @returns True if a pending message was processed, false otherwise */ processPendingInitMessage(sendResponse: (message: HandshakeResponseMessage) => void): boolean; /** * Checks if the handshake has been completed. * * @returns True if the handshake is complete, false otherwise. */ isHandshakeComplete(): boolean; /** * Resets the handshake state, allowing for a new handshake. */ reset(): void; /** * Generates a unique ID for handshake messages. * * @returns A unique ID string. */ private generateId; } //# sourceMappingURL=handshake-manager.d.ts.map