openrtc 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -5
- package/dist/BrowserManagedBroadcastHost-ARCP5MGJ.js +1 -0
- package/dist/{Connection-DZ5eP5hL.d.ts → Connection-CTpuImO-.d.ts} +168 -4
- package/dist/{DelegatingRuntimeAdapter-4cgiIWMN.d.ts → DelegatingRuntimeAdapter-D67Ozqo3.d.ts} +7 -3
- package/dist/{IpcRuntimeAdapter-Dduaxscj.d.ts → IpcRuntimeAdapter-Ddx0MtSI.d.ts} +8 -2
- package/dist/WasmBridge-ZXBCXBBM.js +1 -0
- package/dist/{assembly-By3UBQsE.d.ts → assembly-DvfsYFCL.d.ts} +7 -2
- package/dist/{capabilities-B2mHv_H7.d.ts → capabilities-CmzzxSvW.d.ts} +13 -2
- package/dist/chunk-2K47N3QP.js +2 -0
- package/dist/chunk-AYHD4X2R.js +1 -0
- package/dist/chunk-BFN3AVHA.js +2 -0
- package/dist/chunk-BGWJHPBC.js +2 -0
- package/dist/chunk-CCCYE3XN.js +1 -0
- package/dist/chunk-DUY34MGT.js +1 -0
- package/dist/chunk-EIJNERKZ.js +1 -0
- package/dist/chunk-FEF3DPPB.js +1 -0
- package/dist/chunk-GHAJW6SZ.js +2 -0
- package/dist/chunk-GTHSRQ7Y.js +2 -0
- package/dist/chunk-LLZT3MR6.js +118 -0
- package/dist/chunk-N6LGTNUI.js +1 -0
- package/dist/{chunk-4MLJXEVV.js → chunk-NDR2ANQB.js} +1 -1
- package/dist/chunk-VFDCIEP6.js +2 -0
- package/dist/{chunk-P2SHJMS3.js → chunk-VTYVIKTM.js} +1 -1
- package/dist/chunk-XTYALGJN.js +2 -0
- package/dist/{chunk-5XOLKH66.js → chunk-Z4KJHIV5.js} +1 -1
- package/dist/chunk-Z54XUIKZ.js +1 -0
- package/dist/{controlPlane-7E6KGQPP.js → controlPlane-IIPEJ77Q.js} +1 -1
- package/dist/coreClient.d.ts +3 -3
- package/dist/coreClient.js +1 -1
- package/dist/{deviceEnrollment-CBJYXZ43.js → deviceEnrollment-ZQZ2WP5H.js} +1 -1
- package/dist/{deviceKey-Y35WSEQQ.js → deviceKey-EIMDBAQS.js} +1 -1
- package/dist/{dist-FIVA6EPA.js → dist-XO466BRG.js} +18 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -1
- package/dist/ipcFactory-PRAJ7JP7.js +1 -0
- package/dist/native.d.ts +5 -5
- package/dist/native.js +1 -1
- package/dist/node-browser.d.ts +8 -0
- package/dist/node-browser.js +1 -0
- package/dist/node.d.ts +87 -0
- package/dist/node.js +2 -0
- package/dist/openrtc-VCS6V3AN.js +2 -0
- package/dist/openrtc_bg.wasm +0 -0
- package/dist/room-ULZ2FGWV.js +1 -0
- package/dist/runtime/WasmRuntimeAdapter.d.ts +3 -3
- package/dist/runtime/WasmRuntimeAdapter.js +1 -1
- package/dist/runtime/device-status.d.ts +1 -1
- package/dist/runtime/factories.d.ts +75 -6
- package/dist/runtime/factories.js +1 -1
- package/dist/runtime/index.d.ts +11 -10
- package/dist/runtime/index.js +1 -1
- package/dist/server-browser.d.ts +14 -0
- package/dist/server-browser.js +1 -0
- package/dist/server.d.ts +44 -0
- package/dist/server.js +2 -0
- package/dist/service-node.d.ts +155 -0
- package/dist/service-node.js +1 -0
- package/dist/testing/native.d.ts +4 -4
- package/dist/testing/native.js +1 -1
- package/dist/testing.d.ts +38 -5
- package/dist/testing.js +1 -1
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-BArEthJr.d.ts → types-Cyc-mPjk.d.ts} +189 -2
- package/package.json +26 -3
- package/dist/WasmBridge-3W2HHADU.js +0 -1
- package/dist/chunk-2LATKLCC.js +0 -118
- package/dist/chunk-6OFAKLDB.js +0 -2
- package/dist/chunk-AJQVMVYW.js +0 -1
- package/dist/chunk-BCGCJGIV.js +0 -2
- package/dist/chunk-BOS554IK.js +0 -2
- package/dist/chunk-GNW63SM6.js +0 -2
- package/dist/chunk-MI3ZMVPK.js +0 -2
- package/dist/chunk-WB66633N.js +0 -1
- package/dist/chunk-XEHBTMJQ.js +0 -1
- package/dist/chunk-YYI6AY6W.js +0 -2
- package/dist/ipcFactory-4PCGKZIN.js +0 -1
- package/dist/openrtc-5HAYVDHT.js +0 -2
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PeerReconciliationStats } from '../assembly-
|
|
2
|
-
export { D as ConnectionActor, d as ConnectionActorError, e as ConnectionActorErrorKind, f as ConnectionActorKey, g as ConnectionActorOptions, h as ConnectionActorState, i as ConnectionActors, j as ConnectionClose, k as ConnectionDial, l as LogicalChannel, P as PolicySnapshot, m as PreferredTransport, n as RUNTIME_POLICY, R as RuntimeClient, o as connectionActorKey, p as connectionActorKeyString, q as getRuntimePolicy } from '../assembly-
|
|
1
|
+
import { a as PeerReconciliationStats } from '../assembly-DvfsYFCL.js';
|
|
2
|
+
export { D as ConnectionActor, d as ConnectionActorError, e as ConnectionActorErrorKind, f as ConnectionActorKey, g as ConnectionActorOptions, h as ConnectionActorState, i as ConnectionActors, j as ConnectionClose, k as ConnectionDial, l as LogicalChannel, P as PolicySnapshot, m as PreferredTransport, n as RUNTIME_POLICY, R as RuntimeClient, o as connectionActorKey, p as connectionActorKeyString, q as getRuntimePolicy } from '../assembly-DvfsYFCL.js';
|
|
3
3
|
import { Client as Client$1 } from '../coreClient.js';
|
|
4
|
-
import { c as Avenue } from '../types-
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import { R as RuntimeCapabilities } from '../capabilities-
|
|
8
|
-
export { B as BROWSER_CAPABILITIES, a as CapabilityHost, C as CapabilityProfile, N as NATIVE_CAPABILITIES,
|
|
4
|
+
import { c as Avenue } from '../types-Cyc-mPjk.js';
|
|
5
|
+
import { aB as SignalingOptions, U as ISignalingBackend, V as RuntimeIdentity, W as RoomMember, _ as SignalingEnvelope, a1 as SignalingSession, X as Device, a0 as DesiredPeerProjection, ae as BackendConnectionState, ay as AppLimits, G as GrantScope, j as Connection, aC as JoinRoomOptions, aD as ChannelMetadata, as as CryptoStreams, aE as RoomCreationMode, Q as ClientOptions, ar as PayloadCrypto, K as DiscoveryMode, aF as ProtocolCapabilityMap, aG as ScanningLoopOptions, aH as ScanningLoopHandle, aI as RuntimeBootstrapOptions, aJ as RuntimeBootstrapResult, aK as ApplicationPayloadReadinessOptions, aL as ManagedApplicationRouteOptions, aM as PeerState, aN as PeerScope, aO as PeerHealth, aP as ChannelDescriptor, aQ as JoinRequest, ac as NativeConnectParams, ad as NativeConnectResult, az as ConnectionTarget, A as RawConnection } from '../Connection-CTpuImO-.js';
|
|
6
|
+
export { aR as AutoConnectPolicy, aj as BrowserProtocolStore, C as ChannelDescriptor, aS as ChannelFraming, t as ConnectionEvent, r as ConnectionState, aT as ConnectionStatus, v as DeviceConnectOptions, aU as DevicePresence, z as DeviceProfile, D as DeviceStatus, I as IncomingStream, am as IrohDocEntry, al as IrohMutationReceipt, J as JoinRoomOptions, L as LocalDeviceInfo, M as ManagedOptions, u as ManagedSession, ak as NamespaceDescriptor, aV as PayloadRouteOptions, i as PeerConnectOptions, aW as PeerLifecycleStatus, l as PeerReadiness, aX as PeerSessionSnapshot, o as PeerStreamOptions, aa as PortableMediaChunk, ab as PortableMediaControl, a8 as PortableMediaPublicationStart, a7 as PortableMediaPublish, a9 as PortableMediaSample, aA as PresenceLoopOptions, aY as PresencePolicy, s as ReadinessOptions, aZ as RuntimeAuthContext, aw as RuntimeAuthIdentity, H as RuntimeClientOptions, p as RuntimeDevice, m as RuntimePeerHealth, a_ as RuntimePeerScope, h as RuntimePeerState, B as RuntimeRoomMember, ax as RuntimeSession, S as ScopedChannelOptions, q as ScopedLogicalChannel, a$ as SessionKind, b0 as SessionPlatform } from '../Connection-CTpuImO-.js';
|
|
7
|
+
import { R as RuntimeCapabilities } from '../capabilities-CmzzxSvW.js';
|
|
8
|
+
export { B as BROWSER_CAPABILITIES, a as CapabilityHost, b as CapabilityMaturity, C as CapabilityProfile, N as NATIVE_CAPABILITIES, c as NativeRuntimeStatus, P as ProductCapabilityMaturity, d as RuntimeAdapterKind, T as TransportStatus, e as browserCapabilities, f as capabilityProfile, g as cloneCapabilities, s as statusCapabilities } from '../capabilities-CmzzxSvW.js';
|
|
9
9
|
export { DeviceActiveOptions, isDeviceActive, isDeviceConnectable, isDeviceRoutable } from './device-status.js';
|
|
10
|
-
export { a as IpcAdapterOptions, I as IpcRuntimeAdapter } from '../IpcRuntimeAdapter-
|
|
10
|
+
export { a as IpcAdapterOptions, I as IpcRuntimeAdapter } from '../IpcRuntimeAdapter-Ddx0MtSI.js';
|
|
11
11
|
export { P as NativeBridge, N as NativeIpcFailureKind, P as PlutoIpcBridge, a as PlutoIpcUnlisten, c as classifyIpcFailure, i as isIpcUnavailable } from '../ipc-DgzKqHH3.js';
|
|
12
|
-
import '../DelegatingRuntimeAdapter-
|
|
12
|
+
import '../DelegatingRuntimeAdapter-D67Ozqo3.js';
|
|
13
13
|
|
|
14
14
|
declare class Signaling {
|
|
15
15
|
private readonly appTag;
|
|
@@ -52,7 +52,7 @@ declare class Signaling {
|
|
|
52
52
|
startAutoConnect(userId: string, localDeviceId: string): void;
|
|
53
53
|
submitDesiredPeerProjection(revision: number, peers: DesiredPeerProjection[]): Promise<void>;
|
|
54
54
|
notifyDisconnectRequested(remoteNodeId: string): void;
|
|
55
|
-
startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): void
|
|
55
|
+
startPresenceLoop(userId: string, localNodeId: string, deviceName: string, ticket: string, metadata?: string): Promise<void>;
|
|
56
56
|
forceReconnect(): void;
|
|
57
57
|
isConnected(nodeId: string): Promise<boolean>;
|
|
58
58
|
getConnectionStates(): Promise<BackendConnectionState[]>;
|
|
@@ -120,6 +120,7 @@ type IncomingStreamEvent = {
|
|
|
120
120
|
protocolHint?: ProtocolHint;
|
|
121
121
|
channel?: ChannelMetadata | null;
|
|
122
122
|
applicationAuthorized?: boolean;
|
|
123
|
+
admissionCandidate?: boolean;
|
|
123
124
|
applicationCrypto?: CryptoStreams;
|
|
124
125
|
invalid?: boolean;
|
|
125
126
|
};
|
package/dist/runtime/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as
|
|
1
|
+
export{a as isDeviceActive,c as isDeviceConnectable,b as isDeviceRoutable}from'../chunk-CK6WQV7J.js';export{h as ConnectionActor,e as ConnectionActorError,i as ConnectionActors,a as ConnectionController,s as IpcRuntimeAdapter,r as RuntimeClient,d as clog,p as concatRuntimeBytes,f as connectionActorKey,g as connectionActorKeyString,o as createJsonDecoder,k as createU32Decoder,m as decodeJsonPayload,n as encodeJsonFrame,l as encodeJsonPayload,j as encodeU32Frame,c as grantCorrelation,q as readRuntimeU32BE,b as renderCorrelation}from'../chunk-2K47N3QP.js';import'../chunk-BGWJHPBC.js';import'../chunk-FEF3DPPB.js';export{q as BROWSER_CAPABILITIES,r as NATIVE_CAPABILITIES,o as RUNTIME_POLICY,t as browserCapabilities,v as capabilityProfile,s as cloneCapabilities,p as getRuntimePolicy,h as logTeardownTrace,d as openRtcDebug,c as openRtcDebugEnabled,e as openRtcDebugInfo,f as openRtcDebugLog,u as statusCapabilities}from'../chunk-GTHSRQ7Y.js';import'../chunk-XTYALGJN.js';import'../chunk-TYZS5LXQ.js';import'../chunk-OT7IPLZE.js';import'../chunk-OWKAJPOI.js';export{a as classifyIpcFailure,b as isIpcUnavailable}from'../chunk-72NEEJQG.js';export{a as runtimeFromCapability}from'../chunk-Z54XUIKZ.js';import'../chunk-ZA44REGI.js';import'../chunk-LLZT3MR6.js';import'../chunk-DUY34MGT.js';import'../chunk-CCCYE3XN.js';import'../chunk-N6LGTNUI.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { AuthorityAssignmentInput, AuthorityInterestAssignment, AuthorityServiceGrant, AuthorityServiceGrantRequest, Ed25519Signer } from './service-node.js';
|
|
2
|
+
import './types-Cyc-mPjk.js';
|
|
3
|
+
import './coreClient.js';
|
|
4
|
+
import './assembly-DvfsYFCL.js';
|
|
5
|
+
import './Connection-CTpuImO-.js';
|
|
6
|
+
import './capabilities-CmzzxSvW.js';
|
|
7
|
+
|
|
8
|
+
/** Browser export for `openrtc/server`; secret-bearing helpers are unavailable. */
|
|
9
|
+
|
|
10
|
+
declare class AuthorityServiceControlPlane {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { AuthorityServiceControlPlane };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{constructor(){throw new Error("[OpenRTC] openrtc/server is unavailable in browsers; request a delegated grant from your backend.")}};export{e as AuthorityServiceControlPlane};
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Ed25519Signer, AuthorityServiceGrantRequest, AuthorityServiceGrant, AuthorityAssignmentInput, AuthorityInterestAssignment, DelegatedAuthorityGrantRequest } from './service-node.js';
|
|
2
|
+
import './types-Cyc-mPjk.js';
|
|
3
|
+
import './coreClient.js';
|
|
4
|
+
import './assembly-DvfsYFCL.js';
|
|
5
|
+
import './Connection-CTpuImO-.js';
|
|
6
|
+
import './capabilities-CmzzxSvW.js';
|
|
7
|
+
|
|
8
|
+
/** Secret-bearing Node/server helpers. Do not import this entrypoint in browsers. */
|
|
9
|
+
|
|
10
|
+
interface AuthorityServiceOptions {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
secretKey: string;
|
|
13
|
+
serviceId: string;
|
|
14
|
+
generation: number;
|
|
15
|
+
shardIds: string[];
|
|
16
|
+
deviceId: string;
|
|
17
|
+
deviceSigner: Ed25519Signer;
|
|
18
|
+
assignmentSigner: Ed25519Signer;
|
|
19
|
+
endpoint?: string;
|
|
20
|
+
fetch?: typeof globalThis.fetch;
|
|
21
|
+
}
|
|
22
|
+
/** Direct secret-backed grant issuer for a trusted Node/server process. */
|
|
23
|
+
declare class AuthorityServiceControlPlane {
|
|
24
|
+
private readonly authority;
|
|
25
|
+
constructor(options: AuthorityServiceOptions);
|
|
26
|
+
requestGrant(input: AuthorityServiceGrantRequest): Promise<AuthorityServiceGrant>;
|
|
27
|
+
signAssignment(input: AuthorityAssignmentInput): Promise<{
|
|
28
|
+
assignment: AuthorityInterestAssignment;
|
|
29
|
+
signature: string;
|
|
30
|
+
}>;
|
|
31
|
+
devicePublicKey(): Promise<{
|
|
32
|
+
kty: "OKP";
|
|
33
|
+
crv: "Ed25519";
|
|
34
|
+
x: string;
|
|
35
|
+
}>;
|
|
36
|
+
signDeviceBytes(payload: Uint8Array): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Adapt this trusted issuer to `openrtc/service-node` in Node. Browser
|
|
39
|
+
* applications must call their own authenticated backend instead.
|
|
40
|
+
*/
|
|
41
|
+
grantIssuer(): (request: DelegatedAuthorityGrantRequest) => Promise<AuthorityServiceGrant>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { AuthorityAssignmentInput, AuthorityInterestAssignment, AuthorityServiceControlPlane, AuthorityServiceGrant, AuthorityServiceGrantRequest, type AuthorityServiceOptions, Ed25519Signer };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-GHAJW6SZ.js';import'./chunk-Z54XUIKZ.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-DUY34MGT.js';import'./chunk-CCCYE3XN.js';import'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function y(n){let e=new URL(n??"https://api.openrtc.app"),t=e.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(e.hostname.toLowerCase());if(e.protocol!=="https:"&&!t||e.username||e.password||e.search||e.hash)throw new TypeError("[OpenRTC] authority control-plane endpoint is invalid.");return e.toString().replace(/\/$/,"")}function h(){if(typeof document<"u"||typeof window<"u")throw new Error("[OpenRTC] openrtc/server is unavailable in browsers; use openrtc/service-node with a delegated grant.")}var c=class{constructor(e){h();let t=e.secretKey?.trim()??"";if(!/^sk_(?:live|test)_[A-Za-z0-9_-]+$/.test(t))throw new TypeError("[OpenRTC] secretKey is invalid.");let i=e.fetch??globalThis.fetch;if(typeof i!="function")throw new TypeError("[OpenRTC] a Fetch-compatible implementation is required.");let u=y(e.endpoint);this.authority=new a({apiKey:e.apiKey,serviceId:e.serviceId,generation:e.generation,shardIds:e.shardIds,deviceId:e.deviceId,deviceSigner:e.deviceSigner,assignmentSigner:e.assignmentSigner,grantIssuer:async s=>{let r=await i(`${u}/v2/developer/authority/grants`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","x-openrtc-idempotency-key":s.idempotencyKey},body:JSON.stringify(s.body)});if(!r.ok){let o=await r.json().catch(()=>null),d=typeof o?.error=="string"?o.error.slice(0,256):`HTTP ${r.status}`;throw new Error(`[OpenRTC] authority service grant failed: ${d}`)}return r.json()}});}requestGrant(e){return this.authority.requestGrant(e)}signAssignment(e){return this.authority.signAssignment(e)}devicePublicKey(){return this.authority.devicePublicKey()}signDeviceBytes(e){return this.authority.signDeviceBytes(e)}grantIssuer(){return async e=>{let t=e.body;return this.requestGrant({roomId:String(t.avenue?.id??""),runtimeInstanceId:String(t.runtimeInstanceId??""),ticketFingerprint:String(t.ticketFingerprint??""),maxPeers:typeof t.maxPeers=="number"?t.maxPeers:void 0,refreshGrant:typeof t.refreshGrant=="string"?t.refreshGrant:void 0,features:typeof t.features=="object"&&t.features?t.features:void 0})}}};
|
|
2
|
+
export{c as AuthorityServiceControlPlane};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { C as Client, X as Room, r as Connection } from './types-Cyc-mPjk.js';
|
|
2
|
+
import './coreClient.js';
|
|
3
|
+
import './assembly-DvfsYFCL.js';
|
|
4
|
+
import './Connection-CTpuImO-.js';
|
|
5
|
+
import './capabilities-CmzzxSvW.js';
|
|
6
|
+
|
|
7
|
+
/** Browser-safe and Node-host-neutral developer service-node facade. */
|
|
8
|
+
|
|
9
|
+
interface Ed25519Signer {
|
|
10
|
+
publicJwk(): JsonWebKey | Promise<JsonWebKey>;
|
|
11
|
+
sign(payload: Uint8Array): Uint8Array | Promise<Uint8Array>;
|
|
12
|
+
}
|
|
13
|
+
interface AuthorityServiceOptions {
|
|
14
|
+
apiKey: string;
|
|
15
|
+
/**
|
|
16
|
+
* App-backend delegation. Browser code must call a trusted developer
|
|
17
|
+
* backend here; it must never close over or embed an `sk_*` secret.
|
|
18
|
+
*/
|
|
19
|
+
grantIssuer: AuthorityGrantIssuer;
|
|
20
|
+
serviceId: string;
|
|
21
|
+
generation: number;
|
|
22
|
+
shardIds: string[];
|
|
23
|
+
deviceId: string;
|
|
24
|
+
deviceSigner: Ed25519Signer;
|
|
25
|
+
assignmentSigner: Ed25519Signer;
|
|
26
|
+
}
|
|
27
|
+
interface DelegatedAuthorityGrantRequest {
|
|
28
|
+
apiKey: string;
|
|
29
|
+
idempotencyKey: string;
|
|
30
|
+
body: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
type AuthorityGrantIssuer = (request: DelegatedAuthorityGrantRequest) => Promise<unknown>;
|
|
33
|
+
interface AuthorityServiceGrantRequest {
|
|
34
|
+
roomId: string;
|
|
35
|
+
runtimeInstanceId: string;
|
|
36
|
+
ticketFingerprint: string;
|
|
37
|
+
maxPeers?: number;
|
|
38
|
+
refreshGrant?: string;
|
|
39
|
+
features?: Partial<{
|
|
40
|
+
irohRelay: boolean;
|
|
41
|
+
managedTurn: boolean;
|
|
42
|
+
moq: boolean;
|
|
43
|
+
ble: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
interface AuthorityServiceGrant {
|
|
47
|
+
protocolVersion: 2;
|
|
48
|
+
gatewayUrl: string;
|
|
49
|
+
routeKey: string;
|
|
50
|
+
token: string;
|
|
51
|
+
expiresAtMs: number;
|
|
52
|
+
avenue: {
|
|
53
|
+
kind: 'room';
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
56
|
+
maxPeers: number;
|
|
57
|
+
architecture: 'authority';
|
|
58
|
+
roomAuthority: {
|
|
59
|
+
serviceId: string;
|
|
60
|
+
generation: number;
|
|
61
|
+
shardIds: string[];
|
|
62
|
+
assignmentPublicKeyJwk: {
|
|
63
|
+
kty: 'OKP';
|
|
64
|
+
crv: 'Ed25519';
|
|
65
|
+
x: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
interface AuthorityInterestAssignment {
|
|
70
|
+
policyVersion: 'room-authority-assignment-v1';
|
|
71
|
+
serviceId: string;
|
|
72
|
+
generation: number;
|
|
73
|
+
revision: number;
|
|
74
|
+
subjectDeviceId: string;
|
|
75
|
+
shardId: string;
|
|
76
|
+
priorityDeviceIds: string[];
|
|
77
|
+
relevantEntityIds: string[];
|
|
78
|
+
issuedAtMs: number;
|
|
79
|
+
expiresAtMs: number;
|
|
80
|
+
}
|
|
81
|
+
interface AuthorityAssignmentInput {
|
|
82
|
+
revision: number;
|
|
83
|
+
subjectDeviceId: string;
|
|
84
|
+
shardId: string;
|
|
85
|
+
priorityDeviceIds?: string[];
|
|
86
|
+
relevantEntityIds?: string[];
|
|
87
|
+
ttlMs?: number;
|
|
88
|
+
}
|
|
89
|
+
interface ServiceNodeOptions extends AuthorityServiceOptions {
|
|
90
|
+
/** Browser uses WASM with delegated grants; `openrtc/node` uses the bundled Rust host. */
|
|
91
|
+
client: Client;
|
|
92
|
+
maxPeers?: number;
|
|
93
|
+
irohRelay?: boolean;
|
|
94
|
+
}
|
|
95
|
+
interface ServiceNodeConnectionEvent {
|
|
96
|
+
room: ServiceNodeRoom;
|
|
97
|
+
connection: Connection;
|
|
98
|
+
}
|
|
99
|
+
interface ServiceNodeRoom extends Room {
|
|
100
|
+
publishAssignment(input: AuthorityAssignmentInput): Promise<AuthorityInterestAssignment>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Data-only server boundary for service grant issuance and signed AOI input.
|
|
104
|
+
* It does not own sockets, retries, topology, or transport selection.
|
|
105
|
+
*/
|
|
106
|
+
declare class DelegatedAuthorityService {
|
|
107
|
+
private readonly apiKey;
|
|
108
|
+
private readonly applicationTag;
|
|
109
|
+
private readonly grantIssuer;
|
|
110
|
+
private readonly serviceId;
|
|
111
|
+
private readonly generation;
|
|
112
|
+
private readonly shardIds;
|
|
113
|
+
private readonly deviceId;
|
|
114
|
+
private readonly deviceSigner;
|
|
115
|
+
private readonly assignmentSigner;
|
|
116
|
+
constructor(options: AuthorityServiceOptions);
|
|
117
|
+
requestGrant(input: AuthorityServiceGrantRequest): Promise<AuthorityServiceGrant>;
|
|
118
|
+
devicePublicKey(): Promise<{
|
|
119
|
+
kty: 'OKP';
|
|
120
|
+
crv: 'Ed25519';
|
|
121
|
+
x: string;
|
|
122
|
+
}>;
|
|
123
|
+
assignmentPublicKey(): Promise<{
|
|
124
|
+
kty: 'OKP';
|
|
125
|
+
crv: 'Ed25519';
|
|
126
|
+
x: string;
|
|
127
|
+
}>;
|
|
128
|
+
signDeviceBytes(payload: Uint8Array): Promise<string>;
|
|
129
|
+
signAssignment(input: AuthorityAssignmentInput): Promise<{
|
|
130
|
+
assignment: AuthorityInterestAssignment;
|
|
131
|
+
signature: string;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Familiar application server facade. It handles application events only;
|
|
136
|
+
* OpenRTC's Rust/WASM owner still controls admission, dialing, retry, routes,
|
|
137
|
+
* and carrier switching.
|
|
138
|
+
*/
|
|
139
|
+
declare class ServiceNode {
|
|
140
|
+
private readonly options;
|
|
141
|
+
private readonly authority;
|
|
142
|
+
private readonly rooms;
|
|
143
|
+
private readonly connectionListeners;
|
|
144
|
+
private readonly connectionCleanups;
|
|
145
|
+
private closed;
|
|
146
|
+
constructor(options: ServiceNodeOptions);
|
|
147
|
+
listen(roomId: string): Promise<ServiceNodeRoom>;
|
|
148
|
+
onConnection(listener: (event: ServiceNodeConnectionEvent) => void): () => void;
|
|
149
|
+
close(): Promise<void>;
|
|
150
|
+
private openRoom;
|
|
151
|
+
private evictRoom;
|
|
152
|
+
private attachConnectionListener;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { type AuthorityAssignmentInput, type AuthorityGrantIssuer, type AuthorityInterestAssignment, type AuthorityServiceGrant, type AuthorityServiceGrantRequest, type AuthorityServiceOptions, type DelegatedAuthorityGrantRequest, DelegatedAuthorityService, type Ed25519Signer, ServiceNode, type ServiceNodeConnectionEvent, type ServiceNodeOptions, type ServiceNodeRoom };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as DelegatedAuthorityService,b as ServiceNode}from'./chunk-GHAJW6SZ.js';import'./chunk-Z54XUIKZ.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-DUY34MGT.js';import'./chunk-CCCYE3XN.js';import'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';
|
package/dist/testing/native.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { O as Options, C as Client } from '../types-
|
|
1
|
+
import { O as Options, C as Client } from '../types-Cyc-mPjk.js';
|
|
2
2
|
import { E as Endpoints } from '../protocol-BSBjMb7p.js';
|
|
3
3
|
import { P as PlutoIpcBridge } from '../ipc-DgzKqHH3.js';
|
|
4
4
|
import '../coreClient.js';
|
|
5
|
-
import '../assembly-
|
|
6
|
-
import '../Connection-
|
|
7
|
-
import '../capabilities-
|
|
5
|
+
import '../assembly-DvfsYFCL.js';
|
|
6
|
+
import '../Connection-CTpuImO-.js';
|
|
7
|
+
import '../capabilities-CmzzxSvW.js';
|
|
8
8
|
|
|
9
9
|
declare function OpenRTC(options: Options, endpoints: Endpoints, bridge: PlutoIpcBridge): Client;
|
|
10
10
|
|
package/dist/testing/native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'../chunk-
|
|
1
|
+
import {a as a$1}from'../chunk-VFDCIEP6.js';import {a}from'../chunk-VTYVIKTM.js';import'../chunk-NDR2ANQB.js';import {f}from'../chunk-Z54XUIKZ.js';import'../chunk-ZA44REGI.js';import'../chunk-LLZT3MR6.js';import'../chunk-DUY34MGT.js';import'../chunk-CCCYE3XN.js';import'../chunk-N6LGTNUI.js';import'../chunk-JPBW67B3.js';import'../chunk-2GX6GB6L.js';function v(c,p,e){let o=new a;return f(c,{endpoints:p,testingAllowInsecureLoopback:true,platform:"native",close:()=>o.close(),deviceKeyProvider:a$1(e),deviceIdProvider:async()=>{let t=await e.invoke("get_rtc_local_device_info");return String(t?.deviceId??"")},runtimeFactory:async t=>{let{createIpcClient:a}=await import('../ipcFactory-PRAJ7JP7.js');return a(t,e,o)}})}export{v as OpenRTC};
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as AttestationProvider, b as AuthProvider, B as BotVerificationProvider,
|
|
1
|
+
import { R as RoomArchitectureMode, ag as CoordinationGatewayGrantRequest, ah as CoordinationGatewayGrant } from './Connection-CTpuImO-.js';
|
|
2
|
+
import { a as AttestationProvider, b as AuthProvider, B as BotVerificationProvider, e as BroadcastGrant, d as BroadcastCreateOptions, f as BroadcastInvite, g as BroadcastInviteOptions, D as Delivery, t as DeviceProfile, O as Options, C as Client } from './types-Cyc-mPjk.js';
|
|
3
3
|
import { E as Endpoints } from './protocol-BSBjMb7p.js';
|
|
4
4
|
import './coreClient.js';
|
|
5
|
-
import './assembly-
|
|
6
|
-
import './capabilities-
|
|
5
|
+
import './assembly-DvfsYFCL.js';
|
|
6
|
+
import './capabilities-CmzzxSvW.js';
|
|
7
7
|
|
|
8
8
|
interface DeviceProof {
|
|
9
9
|
publicKeyJwk: JsonWebKey;
|
|
@@ -14,6 +14,8 @@ interface DeviceProof {
|
|
|
14
14
|
interface DeviceKey {
|
|
15
15
|
readonly publicKeyJwk: JsonWebKey;
|
|
16
16
|
readonly thumbprint: string;
|
|
17
|
+
/** Signs Rust-canonical protocol bytes without exporting private key material. */
|
|
18
|
+
sign(message: Uint8Array): Promise<string>;
|
|
17
19
|
proof(challenge: (nonce: string, issuedAt: number) => string): Promise<DeviceProof>;
|
|
18
20
|
}
|
|
19
21
|
interface DeviceKeyProvider {
|
|
@@ -80,8 +82,37 @@ declare class ControlPlane {
|
|
|
80
82
|
private authEpoch;
|
|
81
83
|
dispose(): void;
|
|
82
84
|
private key;
|
|
85
|
+
/** Public half of the existing platform-issued device signer. */
|
|
86
|
+
deviceSigningPublicKey(): Promise<JsonWebKey>;
|
|
87
|
+
signDeviceBytes(message: Uint8Array): Promise<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Resolve one opaque grant into a private provider allocation. The public
|
|
90
|
+
* grant is only a signed, device-bound authorization; relay credentials
|
|
91
|
+
* are returned solely to the private broadcast mechanics host.
|
|
92
|
+
*/
|
|
93
|
+
resolveBroadcastAccess(grant: string, publicationVerifyingKey?: Uint8Array): Promise<{
|
|
94
|
+
token: string;
|
|
95
|
+
issuerPublicKey: Uint8Array;
|
|
96
|
+
signBindingChallenge(message: Uint8Array): Promise<Uint8Array>;
|
|
97
|
+
relay: {
|
|
98
|
+
relayUrl: string;
|
|
99
|
+
token: string;
|
|
100
|
+
namespace: string;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
/** Authenticated owner operations. The server performs the atomic hard
|
|
104
|
+
* reservation before minting a grant or allocating provider capacity. */
|
|
105
|
+
manageBroadcast(input: {
|
|
106
|
+
action: 'create' | 'invite' | 'accept' | 'renew' | 'revoke' | 'leave' | 'close';
|
|
107
|
+
deviceId: string;
|
|
108
|
+
auth: AuthProvider;
|
|
109
|
+
grant?: BroadcastGrant;
|
|
110
|
+
create?: BroadcastCreateOptions;
|
|
111
|
+
invite?: BroadcastInvite;
|
|
112
|
+
invitation?: BroadcastInviteOptions;
|
|
113
|
+
}): Promise<BroadcastGrant | BroadcastInvite | undefined>;
|
|
83
114
|
private post;
|
|
84
|
-
capability(kind: 'space' | 'room' | 'ticket', id: string, maxPeers?: number, advancedFanout?: boolean): Promise<CredentialSource>;
|
|
115
|
+
capability(kind: 'space' | 'room' | 'ticket', id: string, maxPeers?: number, advancedFanout?: boolean, architecture?: RoomArchitectureMode, roomDelivery?: Delivery): Promise<CredentialSource>;
|
|
85
116
|
deviceCertificate(auth: AuthProvider, deviceId: string, avenue?: CoordinationGatewayGrantRequest['avenue'], profile?: DeviceProfile, rejected?: AuthenticatedDeviceCertificate): Promise<{
|
|
86
117
|
source: CredentialSource;
|
|
87
118
|
principalId: string;
|
|
@@ -106,6 +137,8 @@ declare class ControlPlane {
|
|
|
106
137
|
grantProvider(source: CredentialSource, input?: {
|
|
107
138
|
maxPeers?: number;
|
|
108
139
|
features?: Record<string, boolean>;
|
|
140
|
+
architecture?: RoomArchitectureMode;
|
|
141
|
+
roomDelivery?: Delivery;
|
|
109
142
|
deviceProfile?: Pick<DeviceProfile, 'name' | 'platform'>;
|
|
110
143
|
/**
|
|
111
144
|
* Keeps the transport/admission credential relay synchronized
|
package/dist/testing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-BFN3AVHA.js';import {c}from'./chunk-NDR2ANQB.js';import {f}from'./chunk-Z54XUIKZ.js';import'./chunk-ZA44REGI.js';import'./chunk-LLZT3MR6.js';import'./chunk-DUY34MGT.js';import'./chunk-CCCYE3XN.js';import'./chunk-N6LGTNUI.js';import'./chunk-JPBW67B3.js';import'./chunk-2GX6GB6L.js';function s(i){let r=e=>`${e}:${i}`;return {getOrCreate:e=>c.getOrCreate(r(e)),delete:async e=>{await c.delete?.(r(e));},readSecureRecord:(e,o)=>c.readSecureRecord?.(r(e),o)??Promise.resolve(null),writeSecureRecord:(e,o,n)=>c.writeSecureRecord?.(r(e),o,n)??Promise.resolve(),deleteSecureRecord:(e,o)=>c.deleteSecureRecord?.(r(e),o)??Promise.resolve()}}function m(i,r,e){return new a(i,r,s(e))}function u(i,r,e={}){return f(i,{endpoints:r,testingAllowInsecureLoopback:true,platform:"web",...e.deviceId?{deviceIdProvider:async()=>e.deviceId}:{},...e.irohTestRelayUrl?{irohTestRelayUrl:e.irohTestRelayUrl}:{},runtimeFactory:async o=>{let{createWasmClient:n}=await import('./runtime/factories.js');return n(o)}})}export{u as OpenRTC,m as controlPlane};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { g as ProtocolName, aq as RouteDescriptor, ar as PayloadCrypto, as as CryptoStreams } from '../Connection-CTpuImO-.js';
|
|
2
|
+
export { at as CryptoBiStream, au as RouteFamily, av as RouteKind } from '../Connection-CTpuImO-.js';
|
|
3
3
|
|
|
4
4
|
declare const TRANSPORT_LABELS: readonly ProtocolName[];
|
|
5
5
|
declare function normalizeTransport(value: unknown): ProtocolName | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PeerNamespace, ChannelNamespace, DiagnosticsNamespace, DeviceNamespace } from './coreClient.js';
|
|
2
|
-
import { C as ChannelDescriptor, P as PlutoIrohConfiguration,
|
|
2
|
+
import { R as RoomArchitectureMode, b as RoomArchitectureSnapshot, c as RoomAuthorityAssignment, C as ChannelDescriptor, P as PlutoIrohConfiguration, d as PlutoRTCConfiguration, e as PlutoMoQConfiguration, f as RouteOptimization, g as ProtocolName } from './Connection-CTpuImO-.js';
|
|
3
3
|
|
|
4
4
|
interface AuthProvider {
|
|
5
5
|
/** Registered provider ID from the developer app capability manifest. */
|
|
@@ -317,6 +317,10 @@ interface Connection {
|
|
|
317
317
|
interface Channel<T> {
|
|
318
318
|
send(message: T): Promise<void>;
|
|
319
319
|
sendTo(peerId: string, message: T): Promise<void>;
|
|
320
|
+
/**
|
|
321
|
+
* The event peerId is the authenticated device ID for sparse broadcasts;
|
|
322
|
+
* direct channels retain the connection peer ID.
|
|
323
|
+
*/
|
|
320
324
|
onMessage(callback: (event: {
|
|
321
325
|
peerId: string;
|
|
322
326
|
message: T;
|
|
@@ -362,6 +366,14 @@ interface Space extends Avenue {
|
|
|
362
366
|
interface Room extends Avenue {
|
|
363
367
|
readonly kind: 'room';
|
|
364
368
|
readonly membership: 'ephemeral' | 'durable';
|
|
369
|
+
/** Current room-wide architecture chosen by the gateway policy owner. */
|
|
370
|
+
architecture(): RoomArchitectureSnapshot;
|
|
371
|
+
/** Emits the current snapshot immediately, then later committed changes. */
|
|
372
|
+
onArchitectureChanged(callback: (snapshot: RoomArchitectureSnapshot) => void): () => void;
|
|
373
|
+
/** Current signed application-interest assignment, if authority mode has assigned this client. */
|
|
374
|
+
authorityAssignment(): RoomAuthorityAssignment | null;
|
|
375
|
+
/** Emits the current assignment immediately, then later admitted revisions. */
|
|
376
|
+
onAuthorityAssignmentChanged(callback: (assignment: RoomAuthorityAssignment | null) => void): () => void;
|
|
365
377
|
leave(): Promise<void>;
|
|
366
378
|
}
|
|
367
379
|
interface Ticket extends Avenue {
|
|
@@ -378,6 +390,12 @@ interface Ticket extends Avenue {
|
|
|
378
390
|
interface DeviceOptions {
|
|
379
391
|
auth?: AuthProvider;
|
|
380
392
|
autoConnect?: 'none' | 'online';
|
|
393
|
+
/**
|
|
394
|
+
* Durable device IDs that automatic discovery must not connect to.
|
|
395
|
+
* Load persisted exclusions before calling `devices.start()` so the Rust
|
|
396
|
+
* owner and the first coordination presence share one atomic policy.
|
|
397
|
+
*/
|
|
398
|
+
autoConnectExcludedDeviceIds?: readonly string[];
|
|
381
399
|
/** Optional local profile; it does not alter the durable device identity. */
|
|
382
400
|
profile?: DeviceProfile;
|
|
383
401
|
maxPeers?: number;
|
|
@@ -400,9 +418,20 @@ interface RoomOptions {
|
|
|
400
418
|
identity?: 'session';
|
|
401
419
|
auth?: AuthProvider;
|
|
402
420
|
maxPeers?: number;
|
|
421
|
+
/**
|
|
422
|
+
* Declares the room's delivery semantics for architecture selection.
|
|
423
|
+
* Reliable is the safe default. Sparse rooms require latest-state data.
|
|
424
|
+
*/
|
|
425
|
+
payload?: Delivery;
|
|
426
|
+
/**
|
|
427
|
+
* Defaults to auto. A fixed mode is room-wide and may still fail safety or
|
|
428
|
+
* budget gates. Managed is reserved but unavailable in 2.5.
|
|
429
|
+
*/
|
|
430
|
+
architecture?: RoomArchitectureMode;
|
|
403
431
|
/**
|
|
404
432
|
* Requires the app manifest's reviewed advanced-fanout opt-in. Rooms then
|
|
405
433
|
* use a four-neighbor sparse overlay with bounded named-channel gossip.
|
|
434
|
+
* @deprecated Use `architecture: 'sparse'`. Removed in the next major.
|
|
406
435
|
*/
|
|
407
436
|
advancedFanout?: boolean;
|
|
408
437
|
}
|
|
@@ -425,9 +454,133 @@ interface Usage {
|
|
|
425
454
|
creditsUsd: number;
|
|
426
455
|
estimated: true;
|
|
427
456
|
};
|
|
457
|
+
estimateRoom(input: RoomUsageEstimateInput): RoomUsageEstimate;
|
|
428
458
|
readonly sessionCreditsUsd: number;
|
|
429
459
|
}
|
|
460
|
+
interface RoomUsageEstimateInput {
|
|
461
|
+
/** Managed quotes are unavailable in 2.5 and fail with `room-architecture-unavailable`. */
|
|
462
|
+
architecture?: RoomArchitectureMode;
|
|
463
|
+
maxMembers: number;
|
|
464
|
+
durationSeconds: number;
|
|
465
|
+
delivery: Delivery;
|
|
466
|
+
maxPayloadBytes: number;
|
|
467
|
+
maxMessagesPerSecond: number;
|
|
468
|
+
}
|
|
469
|
+
interface RoomUsageEstimate {
|
|
470
|
+
architecture: RoomArchitectureMode;
|
|
471
|
+
effectiveArchitecture: Exclude<RoomArchitectureMode, 'auto'>;
|
|
472
|
+
creditsUsd: number;
|
|
473
|
+
estimated: true;
|
|
474
|
+
expiresAtMs: number;
|
|
475
|
+
assumptions: readonly string[];
|
|
476
|
+
}
|
|
477
|
+
type OfflineAssurance = 'software' | 'hardware-backed' | 'manufacturer' | 'gateway';
|
|
478
|
+
interface OfflineRuntimeSupport {
|
|
479
|
+
provisioning: boolean;
|
|
480
|
+
localMesh: boolean;
|
|
481
|
+
cloudRequired: false;
|
|
482
|
+
reason?: string;
|
|
483
|
+
}
|
|
484
|
+
interface OfflineEnrollmentRequest {
|
|
485
|
+
body: {
|
|
486
|
+
protocol: 'openrtc-offline-device/1';
|
|
487
|
+
trustDomain: string;
|
|
488
|
+
deviceId: string;
|
|
489
|
+
endpointId: string;
|
|
490
|
+
proofPublicKey: string;
|
|
491
|
+
enrollmentNonce: string;
|
|
492
|
+
requestedRoles: string[];
|
|
493
|
+
/** Informational request metadata; the fleet issuer certifies the credential assurance. */
|
|
494
|
+
requestedAssurance: OfflineAssurance;
|
|
495
|
+
createdAtMs: number;
|
|
496
|
+
};
|
|
497
|
+
proofSignature: string;
|
|
498
|
+
}
|
|
499
|
+
interface Offline {
|
|
500
|
+
support(): Promise<OfflineRuntimeSupport>;
|
|
501
|
+
/** Native Rust signs this request; private key bytes never enter JavaScript. */
|
|
502
|
+
createEnrollmentRequest(options: {
|
|
503
|
+
trustDomain: string;
|
|
504
|
+
requestedRoles: string[];
|
|
505
|
+
}): Promise<OfflineEnrollmentRequest>;
|
|
506
|
+
}
|
|
507
|
+
/** Opaque, short-lived, installation-bound broadcast authority. */
|
|
508
|
+
type BroadcastGrant = string & {
|
|
509
|
+
readonly __openrtcBroadcastGrant: unique symbol;
|
|
510
|
+
};
|
|
511
|
+
/** Single-use bearer invitation. Send it only to the intended recipient. */
|
|
512
|
+
type BroadcastInvite = string & {
|
|
513
|
+
readonly __openrtcBroadcastInvite: unique symbol;
|
|
514
|
+
};
|
|
515
|
+
type BroadcastRole = 'owner' | 'publisher' | 'subscriber' | 'processor';
|
|
516
|
+
type BroadcastState = 'opening' | 'live' | 'retrying' | 'closed' | 'failed';
|
|
517
|
+
interface BroadcastSource {
|
|
518
|
+
/** Anonymous slot such as `host-a`; never a device, endpoint, or provider ID. */
|
|
519
|
+
readonly id: string;
|
|
520
|
+
readonly alias?: string;
|
|
521
|
+
}
|
|
522
|
+
interface BroadcastTrackEvent extends MediaTrackEvent {
|
|
523
|
+
readonly source: BroadcastSource;
|
|
524
|
+
}
|
|
525
|
+
interface BroadcastMedia {
|
|
526
|
+
addTrack(track: MediaStreamTrack, options?: MediaTrackOptions): Promise<MediaSender>;
|
|
527
|
+
removeTrack(sender: MediaSender): Promise<void>;
|
|
528
|
+
onTrack(callback: (event: BroadcastTrackEvent) => void): () => void;
|
|
529
|
+
senders(): readonly MediaSender[];
|
|
530
|
+
receivers(): readonly MediaReceiver[];
|
|
531
|
+
}
|
|
532
|
+
interface BroadcastStats {
|
|
533
|
+
queuedMediaBytes: number;
|
|
534
|
+
droppedMediaObjects: number;
|
|
535
|
+
publishedBytes: number;
|
|
536
|
+
deliveredBytes: number;
|
|
537
|
+
retries: number;
|
|
538
|
+
}
|
|
539
|
+
/** Non-peer relay publication/subscription. It never exposes a carrier or provider handle. */
|
|
540
|
+
interface BroadcastSession {
|
|
541
|
+
readonly id: string;
|
|
542
|
+
readonly role: BroadcastRole;
|
|
543
|
+
readonly state: BroadcastState;
|
|
544
|
+
readonly media: BroadcastMedia;
|
|
545
|
+
getStats(): Promise<BroadcastStats>;
|
|
546
|
+
close(): Promise<void>;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Runtime-owned publisher identity. Only its public verification key is
|
|
550
|
+
* exportable; the sign-only private key remains inside native Rust or WASM.
|
|
551
|
+
*/
|
|
552
|
+
interface BroadcastPublisher {
|
|
553
|
+
readonly verificationKey: Uint8Array;
|
|
554
|
+
open(grant: BroadcastGrant): Promise<BroadcastSession>;
|
|
555
|
+
close(): Promise<void>;
|
|
556
|
+
}
|
|
557
|
+
interface BroadcastCreateOptions {
|
|
558
|
+
/** Rust/WASM/native signer whose public key is bound into the owner grant. */
|
|
559
|
+
publisher: BroadcastPublisher;
|
|
560
|
+
auth?: AuthProvider;
|
|
561
|
+
sourceSlot?: string;
|
|
562
|
+
maxPublishers: number;
|
|
563
|
+
maxSubscribers: number;
|
|
564
|
+
maxBitrateBps: number;
|
|
565
|
+
maxDurationSeconds: number;
|
|
566
|
+
maxEgressBytes: number;
|
|
567
|
+
/** Actual initial owner publication reservation, not the broadcast ceiling. */
|
|
568
|
+
publisherBitrateBps: number;
|
|
569
|
+
/** Actual initial owner/viewer egress reservation, not the broadcast ceiling. */
|
|
570
|
+
reservedEgressBytes: number;
|
|
571
|
+
}
|
|
572
|
+
interface BroadcastInviteOptions {
|
|
573
|
+
role: 'publisher' | 'subscriber';
|
|
574
|
+
/** Required for publishers; obtained from that co-host's prepared signer. */
|
|
575
|
+
publicationVerificationKey?: Uint8Array;
|
|
576
|
+
/** Required and unique for publishers; omitted for subscribers. */
|
|
577
|
+
sourceSlot?: string;
|
|
578
|
+
bitrateBps: number;
|
|
579
|
+
durationSeconds: number;
|
|
580
|
+
reservedEgressBytes: number;
|
|
581
|
+
}
|
|
430
582
|
interface Client {
|
|
583
|
+
readonly offline: Offline;
|
|
431
584
|
readonly devices: {
|
|
432
585
|
/**
|
|
433
586
|
* Returns this installation's durable, app-scoped device ID without
|
|
@@ -455,9 +608,43 @@ interface Client {
|
|
|
455
608
|
readonly tickets: {
|
|
456
609
|
issue(id: string, options?: TicketOptions): Promise<Ticket>;
|
|
457
610
|
};
|
|
611
|
+
readonly broadcasts: {
|
|
612
|
+
/** Reserve hard limits and mint a device/key-bound owner grant. */
|
|
613
|
+
create(options: BroadcastCreateOptions): Promise<BroadcastGrant>;
|
|
614
|
+
/** The signed grant decides the role; options cannot promote the caller. */
|
|
615
|
+
open(grant: BroadcastGrant): Promise<BroadcastSession>;
|
|
616
|
+
/** Familiar viewer alias for `open`; the grant still decides the role. */
|
|
617
|
+
subscribe(grant: BroadcastGrant): Promise<BroadcastSession>;
|
|
618
|
+
/** Prepare a runtime-owned signer before requesting a publisher grant. */
|
|
619
|
+
preparePublisher(): Promise<BroadcastPublisher>;
|
|
620
|
+
/** Renewal advances the grant generation; it never mutates in place. */
|
|
621
|
+
renew(grant: BroadcastGrant, options?: {
|
|
622
|
+
auth?: AuthProvider;
|
|
623
|
+
}): Promise<BroadcastGrant>;
|
|
624
|
+
/** Create a single-use role invitation; capacity is reserved on accept. */
|
|
625
|
+
invite(ownerGrant: BroadcastGrant, options: BroadcastInviteOptions & {
|
|
626
|
+
auth?: AuthProvider;
|
|
627
|
+
}): Promise<BroadcastInvite>;
|
|
628
|
+
/** Bind an invitation to this installation and mint its role grant. */
|
|
629
|
+
accept(invite: BroadcastInvite, options?: {
|
|
630
|
+
auth?: AuthProvider;
|
|
631
|
+
}): Promise<BroadcastGrant>;
|
|
632
|
+
/** Owner-only targeted revoke; the accepted invitation identifies one role/source. */
|
|
633
|
+
revoke(ownerGrant: BroadcastGrant, options: {
|
|
634
|
+
invite: BroadcastInvite;
|
|
635
|
+
auth?: AuthProvider;
|
|
636
|
+
}): Promise<void>;
|
|
637
|
+
/** Retire this installation's own role grant. */
|
|
638
|
+
leave(grant: BroadcastGrant, options?: {
|
|
639
|
+
auth?: AuthProvider;
|
|
640
|
+
}): Promise<void>;
|
|
641
|
+
close(grant: BroadcastGrant, options?: {
|
|
642
|
+
auth?: AuthProvider;
|
|
643
|
+
}): Promise<void>;
|
|
644
|
+
};
|
|
458
645
|
readonly channels: Channels;
|
|
459
646
|
readonly usage: Usage;
|
|
460
647
|
close(): Promise<void>;
|
|
461
648
|
}
|
|
462
649
|
|
|
463
|
-
export type { AccessMode as A, BotVerificationProvider as B, Client as C, Delivery as D, EnrolledDevice as E,
|
|
650
|
+
export type { Space as $, AccessMode as A, BotVerificationProvider as B, Client as C, Delivery as D, EnrolledDevice as E, MediaReceiverStats as F, MediaSender as G, MediaSenderStats as H, IncomingPeerBidirectionalStream as I, MediaStats as J, MediaTrackEvent as K, MediaTrackOptions as L, MediaConnection as M, Offline as N, Options as O, OfflineAssurance as P, OfflineEnrollmentRequest as Q, OfflineRuntimeSupport as R, PeerBidirectionalStream as S, PeerDatagramDuplexStream as T, PeerDatagramStats as U, PeerStreamOptions as V, PeerStreamTransport as W, Room as X, RoomOptions as Y, RoomUsageEstimate as Z, RoomUsageEstimateInput as _, AttestationProvider as a, SpaceOptions as a0, State as a1, Ticket as a2, TicketOptions as a3, Transports as a4, Usage as a5, UsageUpdate as a6, UsageWarning as a7, AuthProvider as b, Avenue as c, BroadcastCreateOptions as d, BroadcastGrant as e, BroadcastInvite as f, BroadcastInviteOptions as g, BroadcastMedia as h, BroadcastPublisher as i, BroadcastRole as j, BroadcastSession as k, BroadcastSource as l, BroadcastState as m, BroadcastStats as n, BroadcastTrackEvent as o, Channel as p, Channels as q, Connection as r, DeviceOptions as s, DeviceProfile as t, Devices as u, IncomingPeerUnidirectionalStream as v, MediaIncomingDemuxStats as w, MediaKind as x, MediaLatencySummary as y, MediaReceiver as z };
|