import { PeerNamespace, ChannelNamespace, DiagnosticsNamespace, DeviceNamespace } from './coreClient.js'; import { C as ChannelDescriptor } from './types-D67HlF0p.js'; import { P as PlutoIrohConfiguration, a as PlutoRTCConfiguration, b as PlutoMoQConfiguration, R as RouteOptimization, c as ProtocolName } from './ITransport-yaruAmx3.js'; interface AuthProvider { /** Registered provider ID from the developer app capability manifest. */ readonly providerId?: string; /** * Stable, non-secret, local-only identifier for the currently signed-in * principal. It changes on login, logout, or account switch, but never for * an ordinary access-token refresh. OpenRTC hashes this value together * with the app and installation-key thumbprint before persisting a lookup. * * Optional because assertion-only providers remain valid, though they * cannot skip the assertion exchange on a cold process start. */ getSessionKey?(): Promise; getAssertion(input: { audience: 'https://api.openrtc.app/v2/assertions/exchange'; forceRefresh: boolean; /** * Stable OpenRTC installation ID being enrolled. Consumer backends * may bind product admission (for example a paid device allowance) to * this value in the signed assertion. It is supplied only for an * enrollment/renewal assertion, never for hourly gateway refreshes. */ deviceId: string; /** * Present only after OpenRTC receives the exact structured response * indicating that this installation ID is enrolled with another * public key. Consumer backends should require recent interactive * authentication before authorizing the replacement. */ recoveryReason?: 'device-key-rotation'; }): Promise; /** * Optional identity-epoch observer. Notify only when the signed-in * principal/session changes (login, logout, account switch, or explicit * revocation). Do not notify for ordinary OAuth/Firebase access-token * refreshes: OpenRTC refreshes its own avenue grant in place. */ subscribe?(listener: (event: { type: 'principal-changed'; sessionKey: string | null; }) => void): () => void; } interface EnrolledDevice { deviceId: string; name?: string; platform?: string; enrolledAtMs: number | null; lastGrantAtMs: number | null; current: boolean; } /** * Public, non-secret presentation metadata for one enrolled installation. * OpenRTC derives a useful browser default when these fields are omitted; * native hosts should pass the OS/device information reported by their host. */ interface DeviceProfile { /** Human-readable label such as `Bryant's iPhone` or `Chrome on Android`. */ name?: string; /** Raw OS/runtime label such as `ios`, `android`, `macos`, or `web`. */ platform?: string; /** Optional application-owned public presence metadata, bounded to 4 KiB. */ metadata?: string; } interface AttestationProvider { readonly kind: 'firebase-app-check' | 'apple-app-attest' | 'play-integrity' | `custom:${string}`; /** * Describes what the provider actually signs. Reusable app-integrity * tokens (for example Firebase App Check) do not become request-bound just * because OpenRTC supplies an enrollment challenge. The server derives and * enforces the authoritative binding from the registered provider kind; * this field keeps host integrations and diagnostics honest. */ readonly evidenceBinding: 'app-session' | 'request-challenge'; getEvidence(input: { challenge: string; apiKey: string; }): Promise<{ token: string; }>; } /** * Optional consumer-owned bot challenge. Core OpenRTC does not render a UI or * load a CAPTCHA dependency; the host supplies a fresh token only when its * developer manifest requires anonymous capability verification. */ interface BotVerificationProvider { getToken(input: { action: 'openrtc_capability'; apiKey: string; }): Promise; } interface UsageUpdate { sessionCreditsUsd: number; operation: string; estimated: boolean; } interface UsageWarning extends UsageUpdate { thresholdCreditsUsd: number; kind: 'warning' | 'session-limit'; } interface Transports { iroh?: boolean | PlutoIrohConfiguration; webrtc?: boolean | PlutoRTCConfiguration; relay?: boolean; moq?: boolean | PlutoMoQConfiguration; ble?: boolean; /** * Advanced privacy mode. `relay-only` suppresses direct Iroh addresses, * local discovery, and host/srflx WebRTC candidates. It also requires the * developer manifest's relay opt-in. */ privacy?: 'direct' | 'relay-only'; /** Optimize eligible routes for stability/cost or measured latency. */ optimizeFor?: RouteOptimization; /** * Advanced native integration for hosts whose Rust process owns the * application protocol registry (for example, a Tauri file-transfer host). * Normal SDK consumers should leave this disabled. */ nativeHostProtocols?: boolean; /** Exact route order. Unsupported routes are skipped, never treated as failures. */ priority?: readonly ProtocolName[]; } interface Options { apiKey: string; auth?: AuthProvider; trust?: { attestation?: AttestationProvider; botVerification?: BotVerificationProvider; }; usage?: { warnAtSessionCreditsUsd?: number; maxSessionCreditsUsd?: number; onUsage?: (event: UsageUpdate) => void; onWarning?: (warning: UsageWarning) => void; }; transports?: Transports; } type AccessMode = 'capability' | 'authenticated'; type Delivery = 'reliable' | 'latest-state'; interface Connection { readonly id: string; readonly peerId: string; send(message: unknown): Promise; onMessage(callback: (message: T) => void): () => void; onClose(callback: () => void): () => void; } interface Channel { send(message: T): Promise; sendTo(peerId: string, message: T): Promise; onMessage(callback: (event: { peerId: string; message: T; }) => void): () => void; } interface State { /** Replace the locally published value. Delivery is best-effort and coalesced. */ set(value: T): void; /** A null value means the peer disconnected. */ watch(callback: (event: { peerId: string; value: T | null; }) => void): () => void; } interface Avenue { readonly kind: 'devices' | 'space' | 'room' | 'ticket'; readonly id: string; readonly peers: PeerNamespace; readonly channels: ChannelNamespace; readonly diagnostics: DiagnosticsNamespace; readonly closed: boolean; state(name: string): State; channel(name: string): Channel; /** Observe current and future connections without taking lifecycle ownership. */ onConnection(callback: (connection: Connection) => void): () => void; close(): Promise; } interface Devices extends Avenue { readonly kind: 'devices'; localId(): ReturnType; localInfo(): ReturnType; list(): ReturnType; listWithStatus(): ReturnType; watch: DeviceNamespace['watch']; connect: DeviceNamespace['connect']; disconnect: DeviceNamespace['disconnect']; } interface Space extends Avenue { readonly kind: 'space'; readonly delivery: Delivery; leave(): Promise; } interface Room extends Avenue { readonly kind: 'room'; readonly membership: 'ephemeral' | 'durable'; leave(): Promise; } interface Ticket extends Avenue { readonly kind: 'ticket'; /** * Opaque, install-bound OpenRTC capability credential. This is not a * transferable invitation or recipient redemption token. Do not display, * log, persist, or send it to another installation. * @deprecated This credential exposure is retained only for RC source * compatibility and will not be part of the stable invitation workflow. */ readonly token: string; } interface DeviceOptions { auth?: AuthProvider; autoConnect?: 'none' | 'online'; /** Optional local profile; it does not alter the durable device identity. */ profile?: DeviceProfile; maxPeers?: number; /** Requires the app manifest's advanced-fanout opt-in. */ advancedFanout?: boolean; } interface SpaceOptions { access?: 'capability'; /** Use a new memory-only identity for this OpenRTC client run. */ identity?: 'session'; payload?: Delivery; maxPeers?: number; /** Requires the app manifest's advanced-fanout opt-in. */ advancedFanout?: boolean; } interface RoomOptions { access?: AccessMode; membership?: 'ephemeral' | 'durable'; auth?: AuthProvider; maxPeers?: number; /** * Requires the app manifest's reviewed advanced-fanout opt-in. Rooms then * use a four-neighbor sparse overlay with bounded named-channel gossip. */ advancedFanout?: boolean; } interface TicketOptions { maxPeers?: number; /** Requires the app manifest's advanced-fanout opt-in. */ advancedFanout?: boolean; } interface Channels { register(descriptor: ChannelDescriptor): () => void; list(): readonly ChannelDescriptor[]; } interface Usage { estimate(input: { operation: string; units?: number; }): { creditsUsd: number; estimated: true; }; readonly sessionCreditsUsd: number; } interface Client { readonly devices: { /** * Returns this installation's durable, app-scoped device ID without * starting a capability or performing network work. */ localId(): Promise; start(options?: DeviceOptions): Promise; listEnrolled(options?: { auth?: AuthProvider; }): Promise; revoke(deviceId: string, options?: { auth?: AuthProvider; }): Promise; revokeAll(options?: { auth?: AuthProvider; exceptCurrent?: boolean; }): Promise; }; readonly spaces: { join(id: string, options?: SpaceOptions): Promise; }; readonly rooms: { join(id: string, options?: RoomOptions): Promise; }; readonly tickets: { issue(id: string, options?: TicketOptions): Promise; }; readonly channels: Channels; readonly usage: Usage; close(): Promise; } export type { AttestationProvider as A, BotVerificationProvider as B, Client as C, DeviceOptions as D, EnrolledDevice as E, Options as O, Room as R, Space as S, Ticket as T, UsageUpdate as U, AuthProvider as a, Avenue as b, Channel as c, Connection as d, DeviceProfile as e, Devices as f, RoomOptions as g, SpaceOptions as h, State as i, TicketOptions as j, Transports as k, UsageWarning as l };