livekit-client 1.11.3 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/README.md +1 -3
  2. package/dist/livekit-client.e2ee.worker.js +2 -0
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -0
  4. package/dist/livekit-client.e2ee.worker.mjs +1525 -0
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -0
  6. package/dist/livekit-client.esm.mjs +1462 -660
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.umd.js +1 -1
  9. package/dist/livekit-client.umd.js.map +1 -1
  10. package/dist/src/api/SignalClient.d.ts +4 -1
  11. package/dist/src/api/SignalClient.d.ts.map +1 -1
  12. package/dist/src/connectionHelper/checks/turn.d.ts.map +1 -1
  13. package/dist/src/connectionHelper/checks/websocket.d.ts.map +1 -1
  14. package/dist/src/e2ee/E2eeManager.d.ts +45 -0
  15. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -0
  16. package/dist/src/e2ee/KeyProvider.d.ts +42 -0
  17. package/dist/src/e2ee/KeyProvider.d.ts.map +1 -0
  18. package/dist/src/e2ee/constants.d.ts +14 -0
  19. package/dist/src/e2ee/constants.d.ts.map +1 -0
  20. package/dist/src/e2ee/errors.d.ts +11 -0
  21. package/dist/src/e2ee/errors.d.ts.map +1 -0
  22. package/dist/src/e2ee/index.d.ts +4 -0
  23. package/dist/src/e2ee/index.d.ts.map +1 -0
  24. package/dist/src/e2ee/types.d.ts +129 -0
  25. package/dist/src/e2ee/types.d.ts.map +1 -0
  26. package/dist/src/e2ee/utils.d.ts +24 -0
  27. package/dist/src/e2ee/utils.d.ts.map +1 -0
  28. package/dist/src/e2ee/worker/FrameCryptor.d.ts +175 -0
  29. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -0
  30. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +46 -0
  31. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -0
  32. package/dist/src/e2ee/worker/e2ee.worker.d.ts +2 -0
  33. package/dist/src/e2ee/worker/e2ee.worker.d.ts.map +1 -0
  34. package/dist/src/index.d.ts +2 -0
  35. package/dist/src/index.d.ts.map +1 -1
  36. package/dist/src/logger.d.ts +4 -1
  37. package/dist/src/logger.d.ts.map +1 -1
  38. package/dist/src/options.d.ts +5 -0
  39. package/dist/src/options.d.ts.map +1 -1
  40. package/dist/src/proto/livekit_models.d.ts +2 -2
  41. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  42. package/dist/src/room/PCTransport.d.ts +3 -1
  43. package/dist/src/room/PCTransport.d.ts.map +1 -1
  44. package/dist/src/room/RTCEngine.d.ts +17 -3
  45. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  46. package/dist/src/room/Room.d.ts +10 -1
  47. package/dist/src/room/Room.d.ts.map +1 -1
  48. package/dist/src/room/events.d.ts +14 -2
  49. package/dist/src/room/events.d.ts.map +1 -1
  50. package/dist/src/room/participant/LocalParticipant.d.ts +9 -2
  51. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  52. package/dist/src/room/participant/Participant.d.ts +1 -0
  53. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  54. package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
  55. package/dist/src/room/track/LocalTrack.d.ts +3 -2
  56. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  57. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  58. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  59. package/dist/src/room/track/TrackPublication.d.ts +3 -0
  60. package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
  61. package/dist/src/room/track/facingMode.d.ts +41 -0
  62. package/dist/src/room/track/facingMode.d.ts.map +1 -0
  63. package/dist/src/room/track/options.d.ts +2 -2
  64. package/dist/src/room/track/options.d.ts.map +1 -1
  65. package/dist/src/room/track/utils.d.ts +5 -35
  66. package/dist/src/room/track/utils.d.ts.map +1 -1
  67. package/dist/src/room/utils.d.ts +2 -0
  68. package/dist/src/room/utils.d.ts.map +1 -1
  69. package/dist/src/test/MockMediaStreamTrack.d.ts.map +1 -1
  70. package/dist/ts4.2/src/api/SignalClient.d.ts +4 -1
  71. package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +45 -0
  72. package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +42 -0
  73. package/dist/ts4.2/src/e2ee/constants.d.ts +14 -0
  74. package/dist/ts4.2/src/e2ee/errors.d.ts +11 -0
  75. package/dist/ts4.2/src/e2ee/index.d.ts +4 -0
  76. package/dist/ts4.2/src/e2ee/types.d.ts +129 -0
  77. package/dist/ts4.2/src/e2ee/utils.d.ts +24 -0
  78. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +175 -0
  79. package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +46 -0
  80. package/dist/ts4.2/src/e2ee/worker/e2ee.worker.d.ts +2 -0
  81. package/dist/ts4.2/src/index.d.ts +2 -0
  82. package/dist/ts4.2/src/logger.d.ts +4 -1
  83. package/dist/ts4.2/src/options.d.ts +5 -0
  84. package/dist/ts4.2/src/proto/livekit_models.d.ts +2 -2
  85. package/dist/ts4.2/src/room/PCTransport.d.ts +3 -1
  86. package/dist/ts4.2/src/room/RTCEngine.d.ts +17 -3
  87. package/dist/ts4.2/src/room/Room.d.ts +10 -1
  88. package/dist/ts4.2/src/room/events.d.ts +14 -2
  89. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +9 -2
  90. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -0
  91. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +3 -2
  92. package/dist/ts4.2/src/room/track/TrackPublication.d.ts +3 -0
  93. package/dist/ts4.2/src/room/track/facingMode.d.ts +41 -0
  94. package/dist/ts4.2/src/room/track/options.d.ts +6 -6
  95. package/dist/ts4.2/src/room/track/utils.d.ts +5 -35
  96. package/dist/ts4.2/src/room/utils.d.ts +2 -0
  97. package/package.json +17 -7
  98. package/src/api/SignalClient.ts +28 -9
  99. package/src/connectionHelper/checks/turn.ts +1 -0
  100. package/src/connectionHelper/checks/websocket.ts +1 -0
  101. package/src/e2ee/E2eeManager.ts +374 -0
  102. package/src/e2ee/KeyProvider.ts +77 -0
  103. package/src/e2ee/constants.ts +40 -0
  104. package/src/e2ee/errors.ts +16 -0
  105. package/src/e2ee/index.ts +3 -0
  106. package/src/e2ee/types.ts +160 -0
  107. package/src/e2ee/utils.ts +127 -0
  108. package/src/e2ee/worker/FrameCryptor.test.ts +21 -0
  109. package/src/e2ee/worker/FrameCryptor.ts +614 -0
  110. package/src/e2ee/worker/ParticipantKeyHandler.ts +129 -0
  111. package/src/e2ee/worker/e2ee.worker.ts +217 -0
  112. package/src/e2ee/worker/tsconfig.json +6 -0
  113. package/src/index.ts +2 -0
  114. package/src/logger.ts +10 -2
  115. package/src/options.ts +6 -0
  116. package/src/proto/livekit_models.ts +12 -12
  117. package/src/room/PCTransport.ts +39 -9
  118. package/src/room/RTCEngine.ts +127 -34
  119. package/src/room/Room.ts +83 -30
  120. package/src/room/defaults.ts +1 -1
  121. package/src/room/events.ts +14 -0
  122. package/src/room/participant/LocalParticipant.ts +82 -10
  123. package/src/room/participant/Participant.ts +4 -0
  124. package/src/room/track/LocalAudioTrack.ts +11 -4
  125. package/src/room/track/LocalTrack.ts +50 -43
  126. package/src/room/track/LocalVideoTrack.ts +5 -3
  127. package/src/room/track/RemoteVideoTrack.ts +2 -2
  128. package/src/room/track/TrackPublication.ts +9 -1
  129. package/src/room/track/facingMode.test.ts +30 -0
  130. package/src/room/track/facingMode.ts +103 -0
  131. package/src/room/track/options.ts +3 -2
  132. package/src/room/track/utils.test.ts +1 -30
  133. package/src/room/track/utils.ts +16 -91
  134. package/src/room/utils.ts +5 -0
  135. package/src/room/worker.d.ts +4 -0
  136. package/src/test/MockMediaStreamTrack.ts +1 -0
@@ -0,0 +1,41 @@
1
+ import LocalTrack from './LocalTrack';
2
+ import type { VideoCaptureOptions } from './options';
3
+ type FacingMode = NonNullable<VideoCaptureOptions['facingMode']>;
4
+ type FacingModeFromLocalTrackOptions = {
5
+ /**
6
+ * If no facing mode can be determined, this value will be used.
7
+ * @defaultValue 'user'
8
+ */
9
+ defaultFacingMode?: FacingMode;
10
+ };
11
+ type FacingModeFromLocalTrackReturnValue = {
12
+ /**
13
+ * The (probable) facingMode of the track.
14
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
15
+ */
16
+ facingMode: FacingMode;
17
+ /**
18
+ * The confidence that the returned facingMode is correct.
19
+ */
20
+ confidence: 'high' | 'medium' | 'low';
21
+ };
22
+ /**
23
+ * Try to analyze the local track to determine the facing mode of a track.
24
+ *
25
+ * @remarks
26
+ * There is no property supported by all browsers to detect whether a video track originated from a user- or environment-facing camera device.
27
+ * For this reason, we use the `facingMode` property when available, but will fall back on a string-based analysis of the device label to determine the facing mode.
28
+ * If both methods fail, the default facing mode will be used.
29
+ *
30
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
31
+ * @experimental
32
+ */
33
+ export declare function facingModeFromLocalTrack(localTrack: LocalTrack | MediaStreamTrack, options?: FacingModeFromLocalTrackOptions): FacingModeFromLocalTrackReturnValue;
34
+ /**
35
+ * Attempt to analyze the device label to determine the facing mode.
36
+ *
37
+ * @experimental
38
+ */
39
+ export declare function facingModeFromDeviceLabel(deviceLabel: string): FacingModeFromLocalTrackReturnValue | undefined;
40
+ export {};
41
+ //# sourceMappingURL=facingMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facingMode.d.ts","sourceRoot":"","sources":["../../../../src/room/track/facingMode.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,KAAK,UAAU,GAAG,WAAW,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;AACjE,KAAK,+BAA+B,GAAG;IACrC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AACF,KAAK,mCAAmC,GAAG;IACzC;;;OAGG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,UAAU,GAAG,gBAAgB,EACzC,OAAO,GAAE,+BAAoC,GAC5C,mCAAmC,CA2BrC;AASD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAClB,mCAAmC,GAAG,SAAS,CAgBjD"}
@@ -208,9 +208,9 @@ export interface AudioPreset {
208
208
  maxBitrate: number;
209
209
  priority?: RTCPriorityType;
210
210
  }
211
- declare const codecs: readonly ["vp8", "h264", "vp9", "av1"];
212
211
  declare const backupCodecs: readonly ["vp8", "h264"];
213
- export type VideoCodec = (typeof codecs)[number];
212
+ export declare const videoCodecs: readonly ["vp8", "h264", "vp9", "av1"];
213
+ export type VideoCodec = (typeof videoCodecs)[number];
214
214
  export type BackupVideoCodec = (typeof backupCodecs)[number];
215
215
  export declare function isBackupCodec(codec: string): codec is BackupVideoCodec;
216
216
  export declare function isCodecEqual(c1: string | undefined, c2: string | undefined): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/room/track/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,gBAAgB,CAAC;QAAC,QAAQ,EAAE,aAAa,CAAA;KAAE,GAAG,KAAK,CAAC;IAE3E;;O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AAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAElD,yBAAiB,YAAY,CAAC;IACrB,MAAM,SAAS,EAAE,WAEvB,CAAC;IACK,MAAM,MAAM,EAAE,WAEpB,CAAC;IACK,MAAM,KAAK,EAAE,WAEnB,CAAC;IACK,MAAM,WAAW,EAAE,WAEzB,CAAC;IACK,MAAM,gBAAgB,EAAE,WAE9B,CAAC;IACK,MAAM,sBAAsB,EAAE,WAEpC,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC"}
@@ -1,4 +1,4 @@
1
- import LocalTrack from './LocalTrack';
1
+ import { Track } from './Track';
2
2
  import type { AudioCaptureOptions, CreateLocalTracksOptions, VideoCaptureOptions } from './options';
3
3
  import type { AudioTrack } from './types';
4
4
  export declare function mergeDefaultOptions(options?: CreateLocalTracksOptions, audioDefaults?: AudioCaptureOptions, videoDefaults?: VideoCaptureOptions): CreateLocalTracksOptions;
@@ -12,42 +12,12 @@ export declare function detectSilence(track: AudioTrack, timeOffset?: number): P
12
12
  * @internal
13
13
  */
14
14
  export declare function getNewAudioContext(): AudioContext | void;
15
- type FacingMode = NonNullable<VideoCaptureOptions['facingMode']>;
16
- type FacingModeFromLocalTrackOptions = {
17
- /**
18
- * If no facing mode can be determined, this value will be used.
19
- * @defaultValue 'user'
20
- */
21
- defaultFacingMode?: FacingMode;
22
- };
23
- type FacingModeFromLocalTrackReturnValue = {
24
- /**
25
- * The (probable) facingMode of the track.
26
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
27
- */
28
- facingMode: FacingMode;
29
- /**
30
- * The confidence that the returned facingMode is correct.
31
- */
32
- confidence: 'high' | 'medium' | 'low';
33
- };
34
15
  /**
35
- * Try to analyze the local track to determine the facing mode of a track.
36
- *
37
- * @remarks
38
- * There is no property supported by all browsers to detect whether a video track originated from a user- or environment-facing camera device.
39
- * For this reason, we use the `facingMode` property when available, but will fall back on a string-based analysis of the device label to determine the facing mode.
40
- * If both methods fail, the default facing mode will be used.
41
- *
42
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
43
- * @experimental
16
+ * @internal
44
17
  */
45
- export declare function facingModeFromLocalTrack(localTrack: LocalTrack | MediaStreamTrack, options?: FacingModeFromLocalTrackOptions): FacingModeFromLocalTrackReturnValue;
18
+ export declare function kindToSource(kind: MediaDeviceKind): Track.Source.Camera | Track.Source.Microphone | Track.Source.Unknown;
46
19
  /**
47
- * Attempt to analyze the device label to determine the facing mode.
48
- *
49
- * @experimental
20
+ * @internal
50
21
  */
51
- export declare function facingModeFromDeviceLabel(deviceLabel: string): FacingModeFromLocalTrackReturnValue | undefined;
52
- export {};
22
+ export declare function sourceToKind(source: Track.Source): MediaDeviceKind | undefined;
53
23
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,wBAAwB,EAClC,aAAa,CAAC,EAAE,mBAAmB,EACnC,aAAa,CAAC,EAAE,mBAAmB,GAClC,wBAAwB,CAqB1B;AAYD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB,CAqC/F;AACD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,SAAM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AkBzF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,CAOxD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,wEAQjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,eAAe,GAAG,SAAS,CAQ9E"}
@@ -1,6 +1,7 @@
1
1
  import { ClientInfo } from '../proto/livekit_models';
2
2
  import type LocalAudioTrack from './track/LocalAudioTrack';
3
3
  import type RemoteAudioTrack from './track/RemoteAudioTrack';
4
+ import { VideoCodec } from './track/options';
4
5
  export declare const ddExtensionURI = "https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";
5
6
  export declare function unpackStreamId(packed: string): string[];
6
7
  export declare function sleep(duration: number): Promise<void>;
@@ -84,5 +85,6 @@ export declare class Mutex {
84
85
  isLocked(): boolean;
85
86
  lock(): Promise<() => void>;
86
87
  }
88
+ export declare function isVideoCodec(maybeCodec: string): maybeCodec is VideoCodec;
87
89
  export declare function unwrapConstraint(constraint: ConstrainDOMString): string;
88
90
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/room/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,yBAAyB,CAAC;AAIrE,OAAO,KAAK,eAAe,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAC;AAK7D,eAAO,MAAM,cAAc,4FACgE,CAAC;AAE5F,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAMvD;AAED,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3D;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,YAElC;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,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,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI;IAKP,mBAAmB,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAC1D,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC,KAAK,GAAG,EAC1E,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI;IACP,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI;IAKP,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;CAGrC"}
@@ -19,6 +19,7 @@ export interface SignalOptions {
19
19
  publishOnly?: string;
20
20
  adaptiveStream?: boolean;
21
21
  maxRetries: number;
22
+ e2eeEnabled: boolean;
22
23
  }
23
24
  type SignalMessage = SignalRequest['message'];
24
25
  /** @internal */
@@ -61,7 +62,9 @@ export declare class SignalClient {
61
62
  constructor(useJSON?: boolean);
62
63
  join(url: string, token: string, opts: SignalOptions, abortSignal?: AbortSignal): Promise<JoinResponse>;
63
64
  reconnect(url: string, token: string, sid?: string, reason?: ReconnectReason): Promise<ReconnectResponse | void>;
64
- connect(url: string, token: string, opts: ConnectOpts, abortSignal?: AbortSignal): Promise<JoinResponse | ReconnectResponse | void>;
65
+ private connect;
66
+ /** @internal */
67
+ resetCallbacks: () => void;
65
68
  close(): Promise<void>;
66
69
  sendOffer(offer: RTCSessionDescriptionInit): void;
67
70
  sendAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
@@ -0,0 +1,45 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import type RTCEngine from '../room/RTCEngine';
3
+ import type Room from '../room/Room';
4
+ import type { E2EEManagerCallbacks, E2EEOptions } from './types';
5
+ /**
6
+ * @experimental
7
+ */
8
+ export declare class E2EEManager extends EventEmitter<E2EEManagerCallbacks> {
9
+ protected worker: Worker;
10
+ protected room?: Room;
11
+ private encryptionEnabled;
12
+ private keyProvider;
13
+ get isEnabled(): boolean;
14
+ constructor(options: E2EEOptions);
15
+ /**
16
+ * @internal
17
+ */
18
+ setup(room: Room): void;
19
+ /**
20
+ * @internal
21
+ */
22
+ setParticipantCryptorEnabled(enabled: boolean, participantId?: string): Promise<void>;
23
+ private onWorkerMessage;
24
+ private onWorkerError;
25
+ setupEngine(engine: RTCEngine): void;
26
+ private setupEventListeners;
27
+ private postRatchetRequest;
28
+ private postKey;
29
+ private postRTPMap;
30
+ private setupE2EEReceiver;
31
+ private setupE2EESender;
32
+ /**
33
+ * Handles the given {@code RTCRtpReceiver} by creating a {@code TransformStream} which will inject
34
+ * a frame decoder.
35
+ *
36
+ */
37
+ private handleReceiver;
38
+ /**
39
+ * Handles the given {@code RTCRtpSender} by creating a {@code TransformStream} which will inject
40
+ * a frame encoder.
41
+ *
42
+ */
43
+ private handleSender;
44
+ }
45
+ //# sourceMappingURL=E2eeManager.d.ts.map
@@ -0,0 +1,42 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import type { KeyInfo, KeyProviderCallbacks, KeyProviderOptions } from './types';
3
+ /**
4
+ * @experimental
5
+ */
6
+ export declare class BaseKeyProvider extends EventEmitter<KeyProviderCallbacks> {
7
+ private keyInfoMap;
8
+ private options;
9
+ constructor(options?: Partial<KeyProviderOptions>);
10
+ /**
11
+ * callback to invoke once a key has been set for a participant
12
+ * @param key
13
+ * @param participantId
14
+ * @param keyIndex
15
+ */
16
+ protected onSetEncryptionKey(key: CryptoKey, participantId?: string, keyIndex?: number): void;
17
+ /**
18
+ * callback being invoked after a ratchet request has been performed on the local participant
19
+ * that surfaces the new key material.
20
+ * @param material
21
+ * @param keyIndex
22
+ */
23
+ protected onKeyRatcheted: (material: CryptoKey, keyIndex?: number) => void;
24
+ getKeys(): KeyInfo[];
25
+ getOptions(): KeyProviderOptions;
26
+ ratchetKey(participantId?: string, keyIndex?: number): void;
27
+ }
28
+ /**
29
+ * A basic KeyProvider implementation intended for a single shared
30
+ * passphrase between all participants
31
+ * @experimental
32
+ */
33
+ export declare class ExternalE2EEKeyProvider extends BaseKeyProvider {
34
+ ratchetInterval: number | undefined;
35
+ constructor(options?: Partial<Omit<KeyProviderOptions, 'sharedKey'>>);
36
+ /**
37
+ * Accepts a passphrase that's used to create the crypto keys
38
+ * @param key
39
+ */
40
+ setKey(key: string): Promise<void>;
41
+ }
42
+ //# sourceMappingURL=KeyProvider.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { KeyProviderOptions } from './types';
2
+ export declare const ENCRYPTION_ALGORITHM = "AES-GCM";
3
+ export declare const KEYRING_SIZE = 16;
4
+ export declare const UNENCRYPTED_BYTES: {
5
+ readonly key: 10;
6
+ readonly delta: 3;
7
+ readonly audio: 1;
8
+ readonly empty: 0;
9
+ };
10
+ export declare const IV_LENGTH = 12;
11
+ export declare const E2EE_FLAG = "lk_e2ee";
12
+ export declare const SALT = "LKFrameEncryptionKey";
13
+ export declare const KEY_PROVIDER_DEFAULTS: KeyProviderOptions;
14
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { LivekitError } from '../room/errors';
2
+ export declare enum CryptorErrorReason {
3
+ InvalidKey = 0,
4
+ MissingKey = 1,
5
+ InternalError = 2
6
+ }
7
+ export declare class CryptorError extends LivekitError {
8
+ reason: CryptorErrorReason;
9
+ constructor(message?: string, reason?: CryptorErrorReason);
10
+ }
11
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './KeyProvider';
2
+ export * from './utils';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,129 @@
1
+ import type Participant from '../room/participant/Participant';
2
+ import type { VideoCodec } from '../room/track/options';
3
+ import type { BaseKeyProvider } from './KeyProvider';
4
+ import type { CryptorError } from './errors';
5
+ export interface BaseMessage {
6
+ kind: string;
7
+ data?: unknown;
8
+ }
9
+ export interface InitMessage extends BaseMessage {
10
+ kind: 'init';
11
+ data: {
12
+ keyProviderOptions: KeyProviderOptions;
13
+ };
14
+ }
15
+ export interface SetKeyMessage extends BaseMessage {
16
+ kind: 'setKey';
17
+ data: {
18
+ participantId?: string;
19
+ key: CryptoKey;
20
+ keyIndex?: number;
21
+ };
22
+ }
23
+ export interface RTPVideoMapMessage extends BaseMessage {
24
+ kind: 'setRTPMap';
25
+ data: {
26
+ map: Map<number, VideoCodec>;
27
+ };
28
+ }
29
+ export interface EncodeMessage extends BaseMessage {
30
+ kind: 'decode' | 'encode';
31
+ data: {
32
+ participantId: string;
33
+ readableStream: ReadableStream;
34
+ writableStream: WritableStream;
35
+ trackId: string;
36
+ codec?: VideoCodec;
37
+ };
38
+ }
39
+ export interface RemoveTransformMessage extends BaseMessage {
40
+ kind: 'removeTransform';
41
+ data: {
42
+ participantId: string;
43
+ trackId: string;
44
+ };
45
+ }
46
+ export interface UpdateCodecMessage extends BaseMessage {
47
+ kind: 'updateCodec';
48
+ data: {
49
+ participantId: string;
50
+ trackId: string;
51
+ codec: VideoCodec;
52
+ };
53
+ }
54
+ export interface RatchetRequestMessage extends BaseMessage {
55
+ kind: 'ratchetRequest';
56
+ data: {
57
+ participantId: string | undefined;
58
+ keyIndex?: number;
59
+ };
60
+ }
61
+ export interface RatchetMessage extends BaseMessage {
62
+ kind: 'ratchetKey';
63
+ data: {
64
+ keyIndex?: number;
65
+ material: CryptoKey;
66
+ };
67
+ }
68
+ export interface ErrorMessage extends BaseMessage {
69
+ kind: 'error';
70
+ data: {
71
+ error: Error;
72
+ };
73
+ }
74
+ export interface EnableMessage extends BaseMessage {
75
+ kind: 'enable';
76
+ data: {
77
+ participantId?: string;
78
+ enabled: boolean;
79
+ };
80
+ }
81
+ export type E2EEWorkerMessage = InitMessage | SetKeyMessage | EncodeMessage | ErrorMessage | EnableMessage | RemoveTransformMessage | RTPVideoMapMessage | UpdateCodecMessage | RatchetRequestMessage | RatchetMessage;
82
+ export type KeySet = {
83
+ material: CryptoKey;
84
+ encryptionKey: CryptoKey;
85
+ };
86
+ export type KeyProviderOptions = {
87
+ sharedKey: boolean;
88
+ ratchetSalt: string;
89
+ ratchetWindowSize: number;
90
+ };
91
+ export type KeyProviderCallbacks = {
92
+ setKey: (keyInfo: KeyInfo) => void;
93
+ ratchetRequest: (participantId?: string, keyIndex?: number) => void;
94
+ /** currently only emitted for local participant */
95
+ keyRatcheted: (material: CryptoKey, keyIndex?: number) => void;
96
+ };
97
+ export type ParticipantKeyHandlerCallbacks = {
98
+ keyRatcheted: (material: CryptoKey, keyIndex?: number, participantId?: string) => void;
99
+ };
100
+ export type E2EEManagerCallbacks = {
101
+ participantEncryptionStatusChanged: (enabled: boolean, participant?: Participant) => void;
102
+ encryptionError: (error: Error) => void;
103
+ };
104
+ export declare const EncryptionEvent: {
105
+ readonly ParticipantEncryptionStatusChanged: "participantEncryptionStatusChanged";
106
+ readonly Error: "encryptionError";
107
+ };
108
+ export type CryptorCallbacks = {
109
+ cryptorError: (error: CryptorError) => void;
110
+ };
111
+ export declare const CryptorEvent: {
112
+ readonly Error: "cryptorError";
113
+ };
114
+ export type KeyInfo = {
115
+ key: CryptoKey;
116
+ participantId?: string;
117
+ keyIndex?: number;
118
+ };
119
+ export type E2EEOptions = {
120
+ keyProvider: BaseKeyProvider;
121
+ worker: Worker;
122
+ };
123
+ export type DecodeRatchetOptions = {
124
+ /** attempts */
125
+ ratchetCount: number;
126
+ /** ratcheted key to try */
127
+ encryptionKey?: CryptoKey;
128
+ };
129
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,24 @@
1
+ export declare function isE2EESupported(): boolean;
2
+ export declare function isScriptTransformSupported(): boolean;
3
+ export declare function isInsertableStreamSupported(): boolean;
4
+ export declare function isVideoFrame(frame: RTCEncodedAudioFrame | RTCEncodedVideoFrame): frame is RTCEncodedVideoFrame;
5
+ export declare function importKey(keyBytes: Uint8Array | ArrayBuffer, algorithm?: string | {
6
+ name: string;
7
+ }, usage?: 'derive' | 'encrypt'): Promise<CryptoKey>;
8
+ export declare function createKeyMaterialFromString(password: string): Promise<CryptoKey>;
9
+ /**
10
+ * Derives a set of keys from the master key.
11
+ * See https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.1
12
+ */
13
+ export declare function deriveKeys(material: CryptoKey, salt: string): Promise<{
14
+ material: CryptoKey;
15
+ encryptionKey: CryptoKey;
16
+ }>;
17
+ export declare function createE2EEKey(): Uint8Array;
18
+ export declare function mimeTypeToVideoCodecString(mimeType: string): "vp8" | "h264" | "vp9" | "av1";
19
+ /**
20
+ * Ratchets a key. See
21
+ * https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
22
+ */
23
+ export declare function ratchet(material: CryptoKey, salt: string): Promise<ArrayBuffer>;
24
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,175 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import type { VideoCodec } from '../../room/track/options';
3
+ import { CryptorCallbacks, DecodeRatchetOptions, KeyProviderOptions, KeySet } from '../types';
4
+ import type { ParticipantKeyHandler } from './ParticipantKeyHandler';
5
+ export interface FrameCryptorConstructor {
6
+ new (opts?: unknown): BaseFrameCryptor;
7
+ }
8
+ export interface TransformerInfo {
9
+ readable: ReadableStream;
10
+ writable: WritableStream;
11
+ transformer: TransformStream;
12
+ abortController: AbortController;
13
+ }
14
+ export declare class BaseFrameCryptor extends EventEmitter<CryptorCallbacks> {
15
+ encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<any>;
16
+ decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<any>;
17
+ }
18
+ /**
19
+ * Cryptor is responsible for en-/decrypting media frames.
20
+ * Each Cryptor instance is responsible for en-/decrypting a single mediaStreamTrack.
21
+ */
22
+ export declare class FrameCryptor extends BaseFrameCryptor {
23
+ private sendCounts;
24
+ private isKeyInvalid;
25
+ private participantId;
26
+ private trackId;
27
+ private keys;
28
+ private videoCodec?;
29
+ private rtpMap;
30
+ private keyProviderOptions;
31
+ /**
32
+ * used for detecting server injected unencrypted frames
33
+ */
34
+ private unencryptedFrameByteTrailer;
35
+ constructor(opts: {
36
+ keys: ParticipantKeyHandler;
37
+ participantId: string;
38
+ keyProviderOptions: KeyProviderOptions;
39
+ unencryptedFrameBytes?: Uint8Array;
40
+ });
41
+ /**
42
+ * Assign a different participant to the cryptor.
43
+ * useful for transceiver re-use
44
+ * @param id
45
+ * @param keys
46
+ */
47
+ setParticipant(id: string, keys: ParticipantKeyHandler): void;
48
+ unsetParticipant(): void;
49
+ getParticipantId(): string | undefined;
50
+ getTrackId(): string | undefined;
51
+ /**
52
+ * Update the video codec used by the mediaStreamTrack
53
+ * @param codec
54
+ */
55
+ setVideoCodec(codec: VideoCodec): void;
56
+ /**
57
+ * rtp payload type map used for figuring out codec of payload type when encoding
58
+ * @param map
59
+ */
60
+ setRtpMap(map: Map<number, VideoCodec>): void;
61
+ setupTransform(operation: 'encode' | 'decode', readable: ReadableStream, writable: WritableStream, trackId: string, codec?: VideoCodec): void;
62
+ /**
63
+ * Function that will be injected in a stream and will encrypt the given encoded frames.
64
+ *
65
+ * @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
66
+ * @param {TransformStreamDefaultController} controller - TransportStreamController.
67
+ *
68
+ * The VP8 payload descriptor described in
69
+ * https://tools.ietf.org/html/rfc7741#section-4.2
70
+ * is part of the RTP packet and not part of the frame and is not controllable by us.
71
+ * This is fine as the SFU keeps having access to it for routing.
72
+ *
73
+ * The encrypted frame is formed as follows:
74
+ * 1) Find unencrypted byte length, depending on the codec, frame type and kind.
75
+ * 2) Form the GCM IV for the frame as described above.
76
+ * 3) Encrypt the rest of the frame using AES-GCM.
77
+ * 4) Allocate space for the encrypted frame.
78
+ * 5) Copy the unencrypted bytes to the start of the encrypted frame.
79
+ * 6) Append the ciphertext to the encrypted frame.
80
+ * 7) Append the IV.
81
+ * 8) Append a single byte for the key identifier.
82
+ * 9) Enqueue the encrypted frame for sending.
83
+ */
84
+ encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
85
+ /**
86
+ * Function that will be injected in a stream and will decrypt the given encoded frames.
87
+ *
88
+ * @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
89
+ * @param {TransformStreamDefaultController} controller - TransportStreamController.
90
+ */
91
+ decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
92
+ /**
93
+ * Function that will decrypt the given encoded frame. If the decryption fails, it will
94
+ * ratchet the key for up to RATCHET_WINDOW_SIZE times.
95
+ */
96
+ decryptFrame(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, keyIndex: number, initialMaterial?: KeySet | undefined, ratchetOpts?: DecodeRatchetOptions): Promise<RTCEncodedVideoFrame | RTCEncodedAudioFrame | undefined>;
97
+ /**
98
+ * Construct the IV used for AES-GCM and sent (in plain) with the packet similar to
99
+ * https://tools.ietf.org/html/rfc7714#section-8.1
100
+ * It concatenates
101
+ * - the 32 bit synchronization source (SSRC) given on the encoded frame,
102
+ * - the 32 bit rtp timestamp given on the encoded frame,
103
+ * - a send counter that is specific to the SSRC. Starts at a random number.
104
+ * The send counter is essentially the pictureId but we currently have to implement this ourselves.
105
+ * There is no XOR with a salt. Note that this IV leaks the SSRC to the receiver but since this is
106
+ * randomly generated and SFUs may not rewrite this is considered acceptable.
107
+ * The SSRC is used to allow demultiplexing multiple streams with the same key, as described in
108
+ * https://tools.ietf.org/html/rfc3711#section-4.1.1
109
+ * The RTP timestamp is 32 bits and advances by the codec clock rate (90khz for video, 48khz for
110
+ * opus audio) every second. For video it rolls over roughly every 13 hours.
111
+ * The send counter will advance at the frame rate (30fps for video, 50fps for 20ms opus audio)
112
+ * every second. It will take a long time to roll over.
113
+ *
114
+ * See also https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams
115
+ */
116
+ private makeIV;
117
+ getUnencryptedBytes(frame: RTCEncodedVideoFrame | RTCEncodedAudioFrame): number;
118
+ /**
119
+ * inspects frame payloadtype if available and maps it to the codec specified in rtpMap
120
+ */
121
+ getVideoCodec(frame: RTCEncodedVideoFrame): VideoCodec | undefined;
122
+ }
123
+ /**
124
+ * Slice the NALUs present in the supplied buffer, assuming it is already byte-aligned
125
+ * code adapted from https://github.com/medooze/h264-frame-parser/blob/main/lib/NalUnits.ts to return indices only
126
+ */
127
+ export declare function findNALUIndices(stream: Uint8Array): number[];
128
+ export declare function parseNALUType(startByte: number): NALUType;
129
+ export declare enum NALUType {
130
+ /** Coded slice of a non-IDR picture */
131
+ SLICE_NON_IDR = 1,
132
+ /** Coded slice data partition A */
133
+ SLICE_PARTITION_A = 2,
134
+ /** Coded slice data partition B */
135
+ SLICE_PARTITION_B = 3,
136
+ /** Coded slice data partition C */
137
+ SLICE_PARTITION_C = 4,
138
+ /** Coded slice of an IDR picture */
139
+ SLICE_IDR = 5,
140
+ /** Supplemental enhancement information */
141
+ SEI = 6,
142
+ /** Sequence parameter set */
143
+ SPS = 7,
144
+ /** Picture parameter set */
145
+ PPS = 8,
146
+ /** Access unit delimiter */
147
+ AUD = 9,
148
+ /** End of sequence */
149
+ END_SEQ = 10,
150
+ /** End of stream */
151
+ END_STREAM = 11,
152
+ /** Filler data */
153
+ FILLER_DATA = 12,
154
+ /** Sequence parameter set extension */
155
+ SPS_EXT = 13,
156
+ /** Prefix NAL unit */
157
+ PREFIX_NALU = 14,
158
+ /** Subset sequence parameter set */
159
+ SUBSET_SPS = 15,
160
+ /** Depth parameter set */
161
+ DPS = 16,
162
+ /** Coded slice of an auxiliary coded picture without partitioning */
163
+ SLICE_AUX = 19,
164
+ /** Coded slice extension */
165
+ SLICE_EXT = 20,
166
+ /** Coded slice extension for a depth view component or a 3D-AVC texture view component */
167
+ SLICE_LAYER_EXT = 21
168
+ }
169
+ /**
170
+ * we use a magic frame trailer to detect whether a frame is injected
171
+ * by the livekit server and thus to be treated as unencrypted
172
+ * @internal
173
+ */
174
+ export declare function isFrameServerInjected(frameData: ArrayBuffer, trailerBytes: Uint8Array): boolean;
175
+ //# sourceMappingURL=FrameCryptor.d.ts.map