import { Sub } from "@e280/stz"; import { AgentInfo } from "../signaller/types.js"; import { SignallerApi } from "../signaller/api.js"; export declare const generalTimeout = 60000; export type Prospect = { id: string; reputation: string; peer: RTCPeerConnection; onFailed: Sub; }; export type Connection = { id: string; reputation: string; peer: RTCPeerConnection; cable: Cable; disconnect: () => void; }; export type RtcConfigurator = (options: { signaller: SignallerApi["v1"]; }) => Promise; export type BrowserApiOptions = { rtcConfigurator: RtcConfigurator; cableConfig: CableConfig; signallerApi: SignallerApi; allow: AllowFn; welcome: WelcomeFn; }; export type SendIceCandidateFn = (candidate: RTCIceCandidate) => Promise; export type CableConfig = { offering: (peer: RTCPeerConnection) => Promise; answering: (peer: RTCPeerConnection) => Promise; }; export type StdCable = { reliable: RTCDataChannel; unreliable: RTCDataChannel; }; export declare function asCableConfig(config: CableConfig): CableConfig; export type CommonOptions = { url: string; timeout: number; rtcConfigurator: RtcConfigurator; cableConfig: CableConfig; }; export type ConnectOptions = { welcome: WelcomeFn; closed: () => void; allow?: AllowFn; } & Partial>; export type JoinOptions = { invite: string; disconnected: () => void; allow?: AllowFn; welcome?: WelcomeFn; } & Partial>; export type AllowFn = (agent: AgentInfo) => Promise; export type WelcomeFn = (prospect: Prospect) => (connection: Connection) => () => void;