import { type Observable } from "@openlv/core"; import type { Cipher, KeyPair, PublicKey } from "@openlv/core/encryption"; import { EventEmitter } from "eventemitter3"; import { type PeerCapabilities } from "./messages.js"; import type { SignalingChannel } from "./protocol.js"; export * from "./messages.js"; export * from "./protocol.js"; export declare const Status: { readonly STANDBY: "standby"; readonly CONNECTING: "connecting"; readonly READY: "ready"; readonly HANDSHAKE: "handshake"; readonly HANDSHAKE_PARTIAL: "handshake-partial"; readonly ENCRYPTED: "encrypted"; readonly ERROR: "error"; }; export type Status = (typeof Status)[keyof typeof Status]; export type SignalEventMap = { message: (message: object) => void; }; export type SignalingHooks = { isHost: boolean; h: string; handshakeCipher: Cipher; keyPair: KeyPair; capabilities: PeerCapabilities; }; export type Peer = { peerKey: PublicKey; cipher: Cipher; }; export type SignalingContext = { type: string; send: (message: object) => Promise; setup: () => Promise; teardown: () => Promise; status: Observable; peer: Observable; peerCapabilities: Observable; }; export type SignalingLayer = EventEmitter & SignalingContext; export type SignalingLayerFunction = (hooks: SignalingHooks) => Promise; export type CreateSignalingLayerFunction = (base: SignalingChannel) => SignalingLayerFunction; /** * Base Signaling Layer implementation * * https://openlv.sh/api/signaling */ export declare const createSignalingLayer: CreateSignalingLayerFunction;