livekit-client 2.22.3 → 2.22.4

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.
Files changed (214) hide show
  1. package/README.md +35 -0
  2. package/dist/livekit-client.e2ee.worker.js +1 -1
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  4. package/dist/livekit-client.e2ee.worker.mjs +2 -1
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +602 -247
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.fm.worker.js +1 -1
  9. package/dist/livekit-client.fm.worker.js.map +1 -1
  10. package/dist/livekit-client.fm.worker.mjs +2 -1
  11. package/dist/livekit-client.fm.worker.mjs.map +1 -1
  12. package/dist/livekit-client.umd.js +1 -1
  13. package/dist/livekit-client.umd.js.map +1 -1
  14. package/dist/src/api/SignalClient.d.ts +4 -2
  15. package/dist/src/api/SignalClient.d.ts.map +1 -1
  16. package/dist/src/options.d.ts +14 -0
  17. package/dist/src/options.d.ts.map +1 -1
  18. package/dist/src/room/PCTransport.d.ts +78 -7
  19. package/dist/src/room/PCTransport.d.ts.map +1 -1
  20. package/dist/src/room/PCTransportManager.d.ts.map +1 -1
  21. package/dist/src/room/RTCEngine.d.ts +8 -0
  22. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  23. package/dist/src/room/Room.d.ts +1 -1
  24. package/dist/src/room/Room.d.ts.map +1 -1
  25. package/dist/src/room/defaults.d.ts.map +1 -1
  26. package/dist/src/room/errors.d.ts +18 -0
  27. package/dist/src/room/errors.d.ts.map +1 -1
  28. package/dist/src/room/events.d.ts +3 -2
  29. package/dist/src/room/events.d.ts.map +1 -1
  30. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  31. package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
  32. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  33. package/dist/src/room/track/LocalVideoTrack.d.ts +2 -0
  34. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  35. package/dist/src/room/track/utils.d.ts +13 -0
  36. package/dist/src/room/track/utils.d.ts.map +1 -1
  37. package/dist/src/room/utils.d.ts +32 -0
  38. package/dist/src/room/utils.d.ts.map +1 -1
  39. package/dist/src/test/compressionStreamStubs.d.ts +12 -0
  40. package/dist/src/test/compressionStreamStubs.d.ts.map +1 -0
  41. package/dist/ts4.2/api/SignalClient.d.ts +187 -185
  42. package/dist/ts4.2/api/SignalClientStateMachine.d.ts +85 -85
  43. package/dist/ts4.2/api/WebSocketStream.d.ts +33 -33
  44. package/dist/ts4.2/api/utils.d.ts +9 -9
  45. package/dist/ts4.2/connectionHelper/ConnectionCheck.d.ts +30 -30
  46. package/dist/ts4.2/connectionHelper/checks/Checker.d.ts +62 -62
  47. package/dist/ts4.2/connectionHelper/checks/cloudRegion.d.ts +18 -18
  48. package/dist/ts4.2/connectionHelper/checks/connectionProtocol.d.ts +20 -20
  49. package/dist/ts4.2/connectionHelper/checks/publishAudio.d.ts +6 -6
  50. package/dist/ts4.2/connectionHelper/checks/publishVideo.d.ts +7 -7
  51. package/dist/ts4.2/connectionHelper/checks/reconnect.d.ts +6 -6
  52. package/dist/ts4.2/connectionHelper/checks/turn.d.ts +6 -6
  53. package/dist/ts4.2/connectionHelper/checks/webrtc.d.ts +6 -6
  54. package/dist/ts4.2/connectionHelper/checks/websocket.d.ts +6 -6
  55. package/dist/ts4.2/e2ee/E2eeManager.d.ts +111 -111
  56. package/dist/ts4.2/e2ee/KeyProvider.d.ts +54 -54
  57. package/dist/ts4.2/e2ee/constants.d.ts +21 -21
  58. package/dist/ts4.2/e2ee/errors.d.ts +12 -12
  59. package/dist/ts4.2/e2ee/events.d.ts +39 -39
  60. package/dist/ts4.2/e2ee/index.d.ts +6 -6
  61. package/dist/ts4.2/e2ee/types.d.ts +231 -231
  62. package/dist/ts4.2/e2ee/utils.d.ts +32 -32
  63. package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +16 -16
  64. package/dist/ts4.2/e2ee/worker/ErrorRateLimiter.d.ts +21 -21
  65. package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +209 -209
  66. package/dist/ts4.2/e2ee/worker/ParticipantKeyHandler.d.ts +81 -84
  67. package/dist/ts4.2/e2ee/worker/e2ee.worker.d.ts +2 -2
  68. package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +28 -28
  69. package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +23 -23
  70. package/dist/ts4.2/frameMetadata/FrameMetadataManager.d.ts +53 -53
  71. package/dist/ts4.2/frameMetadata/frameMetadata.d.ts +33 -33
  72. package/dist/ts4.2/frameMetadata/types.d.ts +62 -62
  73. package/dist/ts4.2/frameMetadata/utils.d.ts +9 -9
  74. package/dist/ts4.2/frameMetadata/worker/frameMetadata.worker.d.ts +2 -2
  75. package/dist/ts4.2/index.d.ts +76 -76
  76. package/dist/ts4.2/logger.d.ts +66 -66
  77. package/dist/ts4.2/options.d.ts +163 -149
  78. package/dist/ts4.2/room/BackOffStrategy.d.ts +27 -27
  79. package/dist/ts4.2/room/DefaultReconnectPolicy.d.ts +8 -8
  80. package/dist/ts4.2/room/DeviceManager.d.ts +12 -12
  81. package/dist/ts4.2/room/PCTransport.d.ts +246 -175
  82. package/dist/ts4.2/room/PCTransportManager.d.ts +77 -77
  83. package/dist/ts4.2/room/RTCEngine.d.ts +269 -262
  84. package/dist/ts4.2/room/ReconnectPolicy.d.ts +24 -24
  85. package/dist/ts4.2/room/RegionUrlProvider.d.ts +36 -36
  86. package/dist/ts4.2/room/Room.d.ts +354 -365
  87. package/dist/ts4.2/room/attribute-typings.d.ts +35 -35
  88. package/dist/ts4.2/room/data-channel/DataChannelManager.d.ts +62 -62
  89. package/dist/ts4.2/room/data-channel/FlowControlledDataChannel.d.ts +94 -95
  90. package/dist/ts4.2/room/data-channel/LossyDataChannel.d.ts +41 -41
  91. package/dist/ts4.2/room/data-channel/ReliableDataChannel.d.ts +57 -57
  92. package/dist/ts4.2/room/data-channel/types.d.ts +12 -12
  93. package/dist/ts4.2/room/data-stream/compression.d.ts +49 -49
  94. package/dist/ts4.2/room/data-stream/constants.d.ts +18 -18
  95. package/dist/ts4.2/room/data-stream/incoming/IncomingDataStreamManager.d.ts +29 -29
  96. package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +80 -80
  97. package/dist/ts4.2/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +73 -73
  98. package/dist/ts4.2/room/data-stream/outgoing/StreamWriter.d.ts +16 -16
  99. package/dist/ts4.2/room/data-stream/outgoing/header-utils.d.ts +18 -18
  100. package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +79 -80
  101. package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +50 -50
  102. package/dist/ts4.2/room/data-track/depacketizer.d.ts +59 -59
  103. package/dist/ts4.2/room/data-track/frame.d.ts +22 -22
  104. package/dist/ts4.2/room/data-track/handle.d.ts +27 -27
  105. package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +124 -124
  106. package/dist/ts4.2/room/data-track/incoming/errors.d.ts +24 -24
  107. package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +41 -41
  108. package/dist/ts4.2/room/data-track/incoming/types.d.ts +20 -20
  109. package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +126 -126
  110. package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +74 -74
  111. package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +23 -23
  112. package/dist/ts4.2/room/data-track/outgoing/types.d.ts +48 -48
  113. package/dist/ts4.2/room/data-track/packet/constants.d.ts +20 -20
  114. package/dist/ts4.2/room/data-track/packet/errors.d.ts +40 -40
  115. package/dist/ts4.2/room/data-track/packet/extensions.d.ts +69 -69
  116. package/dist/ts4.2/room/data-track/packet/index.d.ts +98 -98
  117. package/dist/ts4.2/room/data-track/packet/serializable.d.ts +13 -13
  118. package/dist/ts4.2/room/data-track/packetizer.d.ts +43 -43
  119. package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -23
  120. package/dist/ts4.2/room/data-track/types.d.ts +22 -22
  121. package/dist/ts4.2/room/data-track/utils.d.ts +60 -60
  122. package/dist/ts4.2/room/debounce.d.ts +11 -11
  123. package/dist/ts4.2/room/defaults.d.ts +9 -9
  124. package/dist/ts4.2/room/errors.d.ts +180 -162
  125. package/dist/ts4.2/room/events.d.ts +638 -637
  126. package/dist/ts4.2/room/participant/LocalParticipant.d.ts +287 -287
  127. package/dist/ts4.2/room/participant/Participant.d.ts +142 -144
  128. package/dist/ts4.2/room/participant/ParticipantTrackPermission.d.ts +26 -26
  129. package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +85 -86
  130. package/dist/ts4.2/room/participant/publishUtils.d.ts +53 -53
  131. package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +43 -43
  132. package/dist/ts4.2/room/rpc/client/events.d.ts +8 -8
  133. package/dist/ts4.2/room/rpc/index.d.ts +7 -7
  134. package/dist/ts4.2/room/rpc/server/RpcServerManager.d.ts +44 -44
  135. package/dist/ts4.2/room/rpc/server/events.d.ts +8 -8
  136. package/dist/ts4.2/room/rpc/utils.d.ts +131 -131
  137. package/dist/ts4.2/room/stats.d.ts +71 -71
  138. package/dist/ts4.2/room/statsSummary.d.ts +13 -13
  139. package/dist/ts4.2/room/timers.d.ts +12 -12
  140. package/dist/ts4.2/room/token-source/TokenSource.d.ts +82 -82
  141. package/dist/ts4.2/room/token-source/types.d.ts +70 -70
  142. package/dist/ts4.2/room/token-source/utils.d.ts +8 -8
  143. package/dist/ts4.2/room/track/FrameMetadataExtractor.d.ts +19 -19
  144. package/dist/ts4.2/room/track/LocalAudioTrack.d.ts +39 -42
  145. package/dist/ts4.2/room/track/LocalTrack.d.ts +125 -125
  146. package/dist/ts4.2/room/track/LocalTrackPublication.d.ts +42 -42
  147. package/dist/ts4.2/room/track/LocalVideoTrack.d.ts +102 -100
  148. package/dist/ts4.2/room/track/RemoteAudioTrack.d.ts +55 -55
  149. package/dist/ts4.2/room/track/RemoteTrack.d.ts +38 -38
  150. package/dist/ts4.2/room/track/RemoteTrackPublication.d.ts +72 -75
  151. package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +73 -76
  152. package/dist/ts4.2/room/track/Track.d.ts +156 -166
  153. package/dist/ts4.2/room/track/TrackPublication.d.ts +75 -81
  154. package/dist/ts4.2/room/track/create.d.ts +25 -25
  155. package/dist/ts4.2/room/track/facingMode.d.ts +41 -41
  156. package/dist/ts4.2/room/track/options.d.ts +403 -403
  157. package/dist/ts4.2/room/track/processor/types.d.ts +31 -31
  158. package/dist/ts4.2/room/track/record.d.ts +13 -13
  159. package/dist/ts4.2/room/track/types.d.ts +28 -28
  160. package/dist/ts4.2/room/track/utils.d.ts +60 -47
  161. package/dist/ts4.2/room/types.d.ts +127 -127
  162. package/dist/ts4.2/room/utils.d.ts +246 -214
  163. package/dist/ts4.2/test/MockMediaStreamTrack.d.ts +26 -26
  164. package/dist/ts4.2/test/compressionStreamStubs.d.ts +12 -0
  165. package/dist/ts4.2/test/mocks.d.ts +12 -12
  166. package/dist/ts4.2/test/promiseState.d.ts +12 -12
  167. package/dist/ts4.2/test/signalToken.d.ts +26 -26
  168. package/dist/ts4.2/type-polyfills/non-shared-typed-arrays.d.ts +2 -2
  169. package/dist/ts4.2/utils/AsyncQueue.d.ts +23 -23
  170. package/dist/ts4.2/utils/TypedPromise.d.ts +17 -17
  171. package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -13
  172. package/dist/ts4.2/utils/browserParser.d.ts +13 -13
  173. package/dist/ts4.2/utils/camelToSnakeCase.d.ts +8 -8
  174. package/dist/ts4.2/utils/cloneDeep.d.ts +2 -2
  175. package/dist/ts4.2/utils/dataPacketBuffer.d.ts +34 -34
  176. package/dist/ts4.2/utils/deferrable-map.d.ts +32 -32
  177. package/dist/ts4.2/utils/machineInspector.d.ts +54 -54
  178. package/dist/ts4.2/utils/serializer.d.ts +48 -48
  179. package/dist/ts4.2/utils/subscribeToEvents.d.ts +15 -15
  180. package/dist/ts4.2/utils/ttlmap.d.ts +20 -20
  181. package/dist/ts4.2/version.d.ts +15 -15
  182. package/package.json +5 -4
  183. package/src/api/SignalClient.e2e.test.ts +1 -3
  184. package/src/api/SignalClient.test.ts +160 -10
  185. package/src/api/SignalClient.ts +75 -54
  186. package/src/options.ts +16 -0
  187. package/src/room/PCTransport.test.ts +183 -7
  188. package/src/room/PCTransport.ts +197 -36
  189. package/src/room/PCTransportManager.ts +3 -1
  190. package/src/room/RTCEngine.test.ts +84 -0
  191. package/src/room/RTCEngine.ts +24 -5
  192. package/src/room/Room.test.ts +32 -6
  193. package/src/room/Room.ts +26 -6
  194. package/src/room/data-stream/incoming/IncomingDataStreamManager.test.ts +16 -20
  195. package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +5 -5
  196. package/src/room/data-stream/outgoing/OutgoingDataStreamManager.test.ts +60 -39
  197. package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +4 -4
  198. package/src/room/defaults.ts +1 -0
  199. package/src/room/errors.test.ts +36 -0
  200. package/src/room/errors.ts +27 -0
  201. package/src/room/events.ts +2 -1
  202. package/src/room/participant/publishUtils.ts +0 -19
  203. package/src/room/rpc/client/RpcClientManager.test.ts +51 -0
  204. package/src/room/rpc/client/RpcClientManager.ts +32 -15
  205. package/src/room/track/LocalTrack.ts +18 -7
  206. package/src/room/track/LocalVideoTrack.ts +10 -3
  207. package/src/room/track/RemoteAudioTrack.ts +3 -3
  208. package/src/room/track/RemoteVideoTrack.test.ts +210 -0
  209. package/src/room/track/RemoteVideoTrack.ts +29 -3
  210. package/src/room/track/utils.test.ts +201 -2
  211. package/src/room/track/utils.ts +88 -0
  212. package/src/room/utils.test.ts +124 -0
  213. package/src/room/utils.ts +70 -0
  214. package/src/test/compressionStreamStubs.ts +53 -0
@@ -1,231 +1,231 @@
1
- import type { FrameMetadataPayload } from '../frameMetadata/frameMetadata';
2
- import type { FrameMetadataPublishOptions } from '../frameMetadata/types';
3
- import type { LogLevel } from '../logger';
4
- import type { VideoCodec } from '../room/track/options';
5
- import type { NonSharedUint8Array } from '../type-polyfills/non-shared-typed-arrays';
6
- import type { BaseE2EEManager } from './E2eeManager';
7
- import type { BaseKeyProvider } from './KeyProvider';
8
- export interface BaseMessage {
9
- kind: string;
10
- data?: unknown;
11
- }
12
- export interface InitMessage extends BaseMessage {
13
- kind: 'init';
14
- data: {
15
- keyProviderOptions: KeyProviderOptions;
16
- loglevel: LogLevel;
17
- };
18
- }
19
- export interface SetKeyMessage extends BaseMessage {
20
- kind: 'setKey';
21
- data: {
22
- participantIdentity?: string;
23
- isPublisher: boolean;
24
- key: CryptoKey;
25
- keyIndex?: number;
26
- updateCurrentKeyIndex: boolean;
27
- };
28
- }
29
- export interface RTPVideoMapMessage extends BaseMessage {
30
- kind: 'setRTPMap';
31
- data: {
32
- map: Map<number, VideoCodec>;
33
- participantIdentity: string;
34
- };
35
- }
36
- export interface SifTrailerMessage extends BaseMessage {
37
- kind: 'setSifTrailer';
38
- data: {
39
- trailer: NonSharedUint8Array;
40
- };
41
- }
42
- export interface EncodeMessage extends BaseMessage {
43
- kind: 'decode' | 'encode';
44
- data: {
45
- participantIdentity: string;
46
- readableStream: ReadableStream;
47
- writableStream: WritableStream;
48
- trackId: string;
49
- codec?: VideoCodec;
50
- /**
51
- * Whether the published track advertises packet trailer features.
52
- * When false, the cryptor skips the per-frame trailer extraction path
53
- * entirely on decode.
54
- */
55
- hasPacketTrailer: boolean;
56
- /**
57
- * Packet trailer metadata to append on published video frames.
58
- */
59
- packetTrailer?: FrameMetadataPublishOptions;
60
- };
61
- }
62
- export interface RemoveTransformMessage extends BaseMessage {
63
- kind: 'removeTransform';
64
- data: {
65
- participantIdentity: string;
66
- trackId: string;
67
- };
68
- }
69
- export interface UpdateCodecMessage extends BaseMessage {
70
- kind: 'updateCodec';
71
- data: {
72
- participantIdentity: string;
73
- trackId: string;
74
- /** undefined for audio tracks */
75
- codec?: VideoCodec;
76
- /**
77
- * trackId this receiver's pipeline was previously set up for, set when a
78
- * transceiver gets reused for a new track. Lets the worker find the cryptor
79
- * that still owns the (already transferred) encoded streams and re-point it,
80
- * rather than creating a fresh cryptor with no pipeline at all.
81
- */
82
- previousTrackId?: string;
83
- hasPacketTrailer: boolean;
84
- };
85
- }
86
- export interface RatchetRequestMessage extends BaseMessage {
87
- kind: 'ratchetRequest';
88
- data: {
89
- participantIdentity?: string;
90
- keyIndex?: number;
91
- };
92
- }
93
- export interface RatchetMessage extends BaseMessage {
94
- kind: 'ratchetKey';
95
- data: {
96
- participantIdentity: string;
97
- keyIndex?: number;
98
- ratchetResult: RatchetResult;
99
- };
100
- }
101
- export interface ErrorMessage extends BaseMessage {
102
- kind: 'error';
103
- data: {
104
- error: Error;
105
- participantIdentity?: string;
106
- uuid?: string;
107
- };
108
- }
109
- export interface EnableMessage extends BaseMessage {
110
- kind: 'enable';
111
- data: {
112
- participantIdentity: string;
113
- enabled: boolean;
114
- };
115
- }
116
- export interface InitAck extends BaseMessage {
117
- kind: 'initAck';
118
- data: {
119
- enabled: boolean;
120
- };
121
- }
122
- export interface DecryptDataRequestMessage extends BaseMessage {
123
- kind: 'decryptDataRequest';
124
- data: {
125
- uuid: string;
126
- payload: NonSharedUint8Array;
127
- iv: NonSharedUint8Array;
128
- participantIdentity: string;
129
- keyIndex: number;
130
- };
131
- }
132
- export interface DecryptDataResponseMessage extends BaseMessage {
133
- kind: 'decryptDataResponse';
134
- data: {
135
- uuid: string;
136
- payload: NonSharedUint8Array;
137
- };
138
- }
139
- export interface EncryptDataRequestMessage extends BaseMessage {
140
- kind: 'encryptDataRequest';
141
- data: {
142
- uuid: string;
143
- payload: NonSharedUint8Array;
144
- participantIdentity: string;
145
- };
146
- }
147
- export interface EncryptDataResponseMessage extends BaseMessage {
148
- kind: 'encryptDataResponse';
149
- data: {
150
- uuid: string;
151
- payload: NonSharedUint8Array;
152
- iv: NonSharedUint8Array;
153
- keyIndex: number;
154
- };
155
- }
156
- export interface PTMetadataFromE2EEMessage extends BaseMessage {
157
- kind: 'packetTrailerMetadata';
158
- data: FrameMetadataPayload;
159
- }
160
- export interface LogMessage extends BaseMessage {
161
- kind: 'log';
162
- data: {
163
- level: 'trace' | 'debug' | 'info' | 'warn' | 'error';
164
- msg: string;
165
- context?: object;
166
- };
167
- }
168
- export interface SetLogLevelMessage extends BaseMessage {
169
- kind: 'setLogLevel';
170
- data: {
171
- level: LogLevel;
172
- };
173
- }
174
- export type E2EEWorkerMessage = InitMessage | SetKeyMessage | EncodeMessage | ErrorMessage | EnableMessage | RemoveTransformMessage | RTPVideoMapMessage | UpdateCodecMessage | RatchetRequestMessage | RatchetMessage | SifTrailerMessage | InitAck | DecryptDataRequestMessage | DecryptDataResponseMessage | EncryptDataRequestMessage | EncryptDataResponseMessage | PTMetadataFromE2EEMessage | LogMessage | SetLogLevelMessage;
175
- export type KeySet = {
176
- material: CryptoKey;
177
- encryptionKey: CryptoKey;
178
- };
179
- export type RatchetResult = {
180
- chainKey: ArrayBuffer;
181
- cryptoKey: CryptoKey;
182
- };
183
- export type KeyProviderOptions = {
184
- sharedKey: boolean;
185
- ratchetSalt: string;
186
- ratchetWindowSize: number;
187
- failureTolerance: number;
188
- keyringSize: number;
189
- /**
190
- * Size of the encryption key in bits.
191
- * Defaults to 128. Note that 128 is currently the only value
192
- * supported by non-web SDKs.
193
- */
194
- keySize: 128 | 256;
195
- };
196
- export type KeyInfo = {
197
- key: CryptoKey;
198
- participantIdentity?: string;
199
- keyIndex?: number;
200
- };
201
- export type E2EEManagerOptions = {
202
- keyProvider: BaseKeyProvider;
203
- worker: Worker;
204
- };
205
- export type E2EEOptions = E2EEManagerOptions | {
206
- /** For react-native usage. */
207
- e2eeManager: BaseE2EEManager;
208
- };
209
- export type DecodeRatchetOptions = {
210
- /** attempts */
211
- ratchetCount: number;
212
- /** ratcheted key to try */
213
- encryptionKey?: CryptoKey;
214
- };
215
- export type ScriptTransformOptions = {
216
- kind: 'decode' | 'encode';
217
- participantIdentity: string;
218
- trackId: string;
219
- codec?: VideoCodec;
220
- /**
221
- * Whether the published track advertises packet trailer features.
222
- * When false, the cryptor skips the per-frame trailer extraction path
223
- * entirely on decode.
224
- */
225
- hasPacketTrailer: boolean;
226
- /**
227
- * Packet trailer metadata to append on published video frames.
228
- */
229
- packetTrailer?: FrameMetadataPublishOptions;
230
- };
231
- //# sourceMappingURL=types.d.ts.map
1
+ import type { FrameMetadataPayload } from '../frameMetadata/frameMetadata';
2
+ import type { FrameMetadataPublishOptions } from '../frameMetadata/types';
3
+ import type { LogLevel } from '../logger';
4
+ import type { VideoCodec } from '../room/track/options';
5
+ import type { NonSharedUint8Array } from '../type-polyfills/non-shared-typed-arrays';
6
+ import type { BaseE2EEManager } from './E2eeManager';
7
+ import type { BaseKeyProvider } from './KeyProvider';
8
+ export interface BaseMessage {
9
+ kind: string;
10
+ data?: unknown;
11
+ }
12
+ export interface InitMessage extends BaseMessage {
13
+ kind: 'init';
14
+ data: {
15
+ keyProviderOptions: KeyProviderOptions;
16
+ loglevel: LogLevel;
17
+ };
18
+ }
19
+ export interface SetKeyMessage extends BaseMessage {
20
+ kind: 'setKey';
21
+ data: {
22
+ participantIdentity?: string;
23
+ isPublisher: boolean;
24
+ key: CryptoKey;
25
+ keyIndex?: number;
26
+ updateCurrentKeyIndex: boolean;
27
+ };
28
+ }
29
+ export interface RTPVideoMapMessage extends BaseMessage {
30
+ kind: 'setRTPMap';
31
+ data: {
32
+ map: Map<number, VideoCodec>;
33
+ participantIdentity: string;
34
+ };
35
+ }
36
+ export interface SifTrailerMessage extends BaseMessage {
37
+ kind: 'setSifTrailer';
38
+ data: {
39
+ trailer: NonSharedUint8Array;
40
+ };
41
+ }
42
+ export interface EncodeMessage extends BaseMessage {
43
+ kind: 'decode' | 'encode';
44
+ data: {
45
+ participantIdentity: string;
46
+ readableStream: ReadableStream;
47
+ writableStream: WritableStream;
48
+ trackId: string;
49
+ codec?: VideoCodec;
50
+ /**
51
+ * Whether the published track advertises packet trailer features.
52
+ * When false, the cryptor skips the per-frame trailer extraction path
53
+ * entirely on decode.
54
+ */
55
+ hasPacketTrailer: boolean;
56
+ /**
57
+ * Packet trailer metadata to append on published video frames.
58
+ */
59
+ packetTrailer?: FrameMetadataPublishOptions;
60
+ };
61
+ }
62
+ export interface RemoveTransformMessage extends BaseMessage {
63
+ kind: 'removeTransform';
64
+ data: {
65
+ participantIdentity: string;
66
+ trackId: string;
67
+ };
68
+ }
69
+ export interface UpdateCodecMessage extends BaseMessage {
70
+ kind: 'updateCodec';
71
+ data: {
72
+ participantIdentity: string;
73
+ trackId: string;
74
+ /** undefined for audio tracks */
75
+ codec?: VideoCodec;
76
+ /**
77
+ * trackId this receiver's pipeline was previously set up for, set when a
78
+ * transceiver gets reused for a new track. Lets the worker find the cryptor
79
+ * that still owns the (already transferred) encoded streams and re-point it,
80
+ * rather than creating a fresh cryptor with no pipeline at all.
81
+ */
82
+ previousTrackId?: string;
83
+ hasPacketTrailer: boolean;
84
+ };
85
+ }
86
+ export interface RatchetRequestMessage extends BaseMessage {
87
+ kind: 'ratchetRequest';
88
+ data: {
89
+ participantIdentity?: string;
90
+ keyIndex?: number;
91
+ };
92
+ }
93
+ export interface RatchetMessage extends BaseMessage {
94
+ kind: 'ratchetKey';
95
+ data: {
96
+ participantIdentity: string;
97
+ keyIndex?: number;
98
+ ratchetResult: RatchetResult;
99
+ };
100
+ }
101
+ export interface ErrorMessage extends BaseMessage {
102
+ kind: 'error';
103
+ data: {
104
+ error: Error;
105
+ participantIdentity?: string;
106
+ uuid?: string;
107
+ };
108
+ }
109
+ export interface EnableMessage extends BaseMessage {
110
+ kind: 'enable';
111
+ data: {
112
+ participantIdentity: string;
113
+ enabled: boolean;
114
+ };
115
+ }
116
+ export interface InitAck extends BaseMessage {
117
+ kind: 'initAck';
118
+ data: {
119
+ enabled: boolean;
120
+ };
121
+ }
122
+ export interface DecryptDataRequestMessage extends BaseMessage {
123
+ kind: 'decryptDataRequest';
124
+ data: {
125
+ uuid: string;
126
+ payload: NonSharedUint8Array;
127
+ iv: NonSharedUint8Array;
128
+ participantIdentity: string;
129
+ keyIndex: number;
130
+ };
131
+ }
132
+ export interface DecryptDataResponseMessage extends BaseMessage {
133
+ kind: 'decryptDataResponse';
134
+ data: {
135
+ uuid: string;
136
+ payload: NonSharedUint8Array;
137
+ };
138
+ }
139
+ export interface EncryptDataRequestMessage extends BaseMessage {
140
+ kind: 'encryptDataRequest';
141
+ data: {
142
+ uuid: string;
143
+ payload: NonSharedUint8Array;
144
+ participantIdentity: string;
145
+ };
146
+ }
147
+ export interface EncryptDataResponseMessage extends BaseMessage {
148
+ kind: 'encryptDataResponse';
149
+ data: {
150
+ uuid: string;
151
+ payload: NonSharedUint8Array;
152
+ iv: NonSharedUint8Array;
153
+ keyIndex: number;
154
+ };
155
+ }
156
+ export interface PTMetadataFromE2EEMessage extends BaseMessage {
157
+ kind: 'packetTrailerMetadata';
158
+ data: FrameMetadataPayload;
159
+ }
160
+ export interface LogMessage extends BaseMessage {
161
+ kind: 'log';
162
+ data: {
163
+ level: 'trace' | 'debug' | 'info' | 'warn' | 'error';
164
+ msg: string;
165
+ context?: object;
166
+ };
167
+ }
168
+ export interface SetLogLevelMessage extends BaseMessage {
169
+ kind: 'setLogLevel';
170
+ data: {
171
+ level: LogLevel;
172
+ };
173
+ }
174
+ export type E2EEWorkerMessage = InitMessage | SetKeyMessage | EncodeMessage | ErrorMessage | EnableMessage | RemoveTransformMessage | RTPVideoMapMessage | UpdateCodecMessage | RatchetRequestMessage | RatchetMessage | SifTrailerMessage | InitAck | DecryptDataRequestMessage | DecryptDataResponseMessage | EncryptDataRequestMessage | EncryptDataResponseMessage | PTMetadataFromE2EEMessage | LogMessage | SetLogLevelMessage;
175
+ export type KeySet = {
176
+ material: CryptoKey;
177
+ encryptionKey: CryptoKey;
178
+ };
179
+ export type RatchetResult = {
180
+ chainKey: ArrayBuffer;
181
+ cryptoKey: CryptoKey;
182
+ };
183
+ export type KeyProviderOptions = {
184
+ sharedKey: boolean;
185
+ ratchetSalt: string;
186
+ ratchetWindowSize: number;
187
+ failureTolerance: number;
188
+ keyringSize: number;
189
+ /**
190
+ * Size of the encryption key in bits.
191
+ * Defaults to 128. Note that 128 is currently the only value
192
+ * supported by non-web SDKs.
193
+ */
194
+ keySize: 128 | 256;
195
+ };
196
+ export type KeyInfo = {
197
+ key: CryptoKey;
198
+ participantIdentity?: string;
199
+ keyIndex?: number;
200
+ };
201
+ export type E2EEManagerOptions = {
202
+ keyProvider: BaseKeyProvider;
203
+ worker: Worker;
204
+ };
205
+ export type E2EEOptions = E2EEManagerOptions | {
206
+ /** For react-native usage. */
207
+ e2eeManager: BaseE2EEManager;
208
+ };
209
+ export type DecodeRatchetOptions = {
210
+ /** attempts */
211
+ ratchetCount: number;
212
+ /** ratcheted key to try */
213
+ encryptionKey?: CryptoKey;
214
+ };
215
+ export type ScriptTransformOptions = {
216
+ kind: 'decode' | 'encode';
217
+ participantIdentity: string;
218
+ trackId: string;
219
+ codec?: VideoCodec;
220
+ /**
221
+ * Whether the published track advertises packet trailer features.
222
+ * When false, the cryptor skips the per-frame trailer extraction path
223
+ * entirely on decode.
224
+ */
225
+ hasPacketTrailer: boolean;
226
+ /**
227
+ * Packet trailer metadata to append on published video frames.
228
+ */
229
+ packetTrailer?: FrameMetadataPublishOptions;
230
+ };
231
+ //# sourceMappingURL=types.d.ts.map
@@ -1,32 +1,32 @@
1
- import type { DataPacket } from '@livekit/protocol';
2
- import { EncryptedPacketPayload } from '@livekit/protocol';
3
- import type { NonSharedUint8Array } from '../type-polyfills/non-shared-typed-arrays';
4
- import type { KeyProviderOptions } from './types';
5
- export declare function isE2EESupported(): boolean;
6
- export declare function isScriptTransformSupported(): boolean;
7
- export declare function isInsertableStreamSupported(): boolean;
8
- export declare function isVideoFrame(frame: RTCEncodedAudioFrame | RTCEncodedVideoFrame): frame is RTCEncodedVideoFrame;
9
- export declare function importKey(keyBytes: NonSharedUint8Array | ArrayBuffer, algorithm?: string | {
10
- name: string;
11
- }, usage?: 'derive' | 'encrypt'): Promise<CryptoKey>;
12
- export declare function createKeyMaterialFromString(password: string): Promise<CryptoKey>;
13
- export declare function createKeyMaterialFromBuffer(cryptoBuffer: ArrayBuffer): Promise<CryptoKey>;
14
- /**
15
- * Derives a set of keys from the master key.
16
- * See https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.1
17
- */
18
- export declare function deriveKeys(material: CryptoKey, options: KeyProviderOptions): Promise<{
19
- material: CryptoKey;
20
- encryptionKey: CryptoKey;
21
- }>;
22
- export declare function createE2EEKey(): NonSharedUint8Array;
23
- /**
24
- * Ratchets a key. See
25
- * https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
26
- */
27
- export declare function ratchet(material: CryptoKey, salt: string): Promise<ArrayBuffer>;
28
- export declare function needsRbspUnescaping(frameData: NonSharedUint8Array): boolean;
29
- export declare function parseRbsp(stream: NonSharedUint8Array): NonSharedUint8Array;
30
- export declare function writeRbsp(data_in: NonSharedUint8Array): NonSharedUint8Array;
31
- export declare function asEncryptablePacket(packet: DataPacket): EncryptedPacketPayload | undefined;
32
- //# sourceMappingURL=utils.d.ts.map
1
+ import type { DataPacket } from '@livekit/protocol';
2
+ import { EncryptedPacketPayload } from '@livekit/protocol';
3
+ import type { NonSharedUint8Array } from '../type-polyfills/non-shared-typed-arrays';
4
+ import type { KeyProviderOptions } from './types';
5
+ export declare function isE2EESupported(): boolean;
6
+ export declare function isScriptTransformSupported(): boolean;
7
+ export declare function isInsertableStreamSupported(): boolean;
8
+ export declare function isVideoFrame(frame: RTCEncodedAudioFrame | RTCEncodedVideoFrame): frame is RTCEncodedVideoFrame;
9
+ export declare function importKey(keyBytes: NonSharedUint8Array | ArrayBuffer, algorithm?: string | {
10
+ name: string;
11
+ }, usage?: 'derive' | 'encrypt'): Promise<CryptoKey>;
12
+ export declare function createKeyMaterialFromString(password: string): Promise<CryptoKey>;
13
+ export declare function createKeyMaterialFromBuffer(cryptoBuffer: ArrayBuffer): Promise<CryptoKey>;
14
+ /**
15
+ * Derives a set of keys from the master key.
16
+ * See https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.1
17
+ */
18
+ export declare function deriveKeys(material: CryptoKey, options: KeyProviderOptions): Promise<{
19
+ material: CryptoKey;
20
+ encryptionKey: CryptoKey;
21
+ }>;
22
+ export declare function createE2EEKey(): NonSharedUint8Array;
23
+ /**
24
+ * Ratchets a key. See
25
+ * https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
26
+ */
27
+ export declare function ratchet(material: CryptoKey, salt: string): Promise<ArrayBuffer>;
28
+ export declare function needsRbspUnescaping(frameData: NonSharedUint8Array): boolean;
29
+ export declare function parseRbsp(stream: NonSharedUint8Array): NonSharedUint8Array;
30
+ export declare function writeRbsp(data_in: NonSharedUint8Array): NonSharedUint8Array;
31
+ export declare function asEncryptablePacket(packet: DataPacket): EncryptedPacketPayload | undefined;
32
+ //# sourceMappingURL=utils.d.ts.map
@@ -1,16 +1,16 @@
1
- import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
2
- import type { DecodeRatchetOptions, KeySet } from '../types';
3
- import type { ParticipantKeyHandler } from './ParticipantKeyHandler';
4
- export declare class DataCryptor {
5
- private static sendCount;
6
- private static makeIV;
7
- static encrypt(data: NonSharedUint8Array, keys: ParticipantKeyHandler): Promise<{
8
- payload: NonSharedUint8Array;
9
- iv: NonSharedUint8Array;
10
- keyIndex: number;
11
- }>;
12
- static decrypt(data: NonSharedUint8Array, iv: NonSharedUint8Array, keys: ParticipantKeyHandler, keyIndex?: number, initialMaterial?: KeySet, ratchetOpts?: DecodeRatchetOptions): Promise<{
13
- payload: NonSharedUint8Array;
14
- }>;
15
- }
16
- //# sourceMappingURL=DataCryptor.d.ts.map
1
+ import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
2
+ import type { DecodeRatchetOptions, KeySet } from '../types';
3
+ import type { ParticipantKeyHandler } from './ParticipantKeyHandler';
4
+ export declare class DataCryptor {
5
+ private static sendCount;
6
+ private static makeIV;
7
+ static encrypt(data: NonSharedUint8Array, keys: ParticipantKeyHandler): Promise<{
8
+ payload: NonSharedUint8Array;
9
+ iv: NonSharedUint8Array;
10
+ keyIndex: number;
11
+ }>;
12
+ static decrypt(data: NonSharedUint8Array, iv: NonSharedUint8Array, keys: ParticipantKeyHandler, keyIndex?: number, initialMaterial?: KeySet, ratchetOpts?: DecodeRatchetOptions): Promise<{
13
+ payload: NonSharedUint8Array;
14
+ }>;
15
+ }
16
+ //# sourceMappingURL=DataCryptor.d.ts.map
@@ -1,21 +1,21 @@
1
- /**
2
- * Per-key rate limiter for repeated errors. Prevents log/emit floods and the
3
- * unbounded map growth that a per-event log would cause when a broken key
4
- * keeps producing failures.
5
- */
6
- export declare class ErrorRateLimiter {
7
- private readonly throttleMs;
8
- private readonly windowMs;
9
- private readonly maxPerWindow;
10
- private lastAt;
11
- private counts;
12
- constructor(throttleMs?: number, windowMs?: number, maxPerWindow?: number);
13
- reset(): void;
14
- countFor(key: string): number;
15
- /**
16
- * Returns true if the caller should emit for this key. Invokes `onSuppress`
17
- * exactly once per window when the per-window limit is first crossed.
18
- */
19
- shouldEmit(key: string, onSuppress?: () => void): boolean;
20
- }
21
- //# sourceMappingURL=ErrorRateLimiter.d.ts.map
1
+ /**
2
+ * Per-key rate limiter for repeated errors. Prevents log/emit floods and the
3
+ * unbounded map growth that a per-event log would cause when a broken key
4
+ * keeps producing failures.
5
+ */
6
+ export declare class ErrorRateLimiter {
7
+ private readonly throttleMs;
8
+ private readonly windowMs;
9
+ private readonly maxPerWindow;
10
+ private lastAt;
11
+ private counts;
12
+ constructor(throttleMs?: number, windowMs?: number, maxPerWindow?: number);
13
+ reset(): void;
14
+ countFor(key: string): number;
15
+ /**
16
+ * Returns true if the caller should emit for this key. Invokes `onSuppress`
17
+ * exactly once per window when the per-window limit is first crossed.
18
+ */
19
+ shouldEmit(key: string, onSuppress?: () => void): boolean;
20
+ }
21
+ //# sourceMappingURL=ErrorRateLimiter.d.ts.map