livekit-client 1.11.4 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) 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 +4749 -4055
  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 +1 -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 -0
  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 +7 -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/LocalTrack.d.ts.map +1 -1
  55. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  56. package/dist/src/room/track/TrackPublication.d.ts +3 -0
  57. package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
  58. package/dist/src/room/track/options.d.ts +2 -2
  59. package/dist/src/room/track/options.d.ts.map +1 -1
  60. package/dist/src/room/track/utils.d.ts +9 -0
  61. package/dist/src/room/track/utils.d.ts.map +1 -1
  62. package/dist/src/room/utils.d.ts +2 -0
  63. package/dist/src/room/utils.d.ts.map +1 -1
  64. package/dist/src/test/MockMediaStreamTrack.d.ts.map +1 -1
  65. package/dist/ts4.2/src/api/SignalClient.d.ts +4 -1
  66. package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +45 -0
  67. package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +42 -0
  68. package/dist/ts4.2/src/e2ee/constants.d.ts +14 -0
  69. package/dist/ts4.2/src/e2ee/errors.d.ts +11 -0
  70. package/dist/ts4.2/src/e2ee/index.d.ts +4 -0
  71. package/dist/ts4.2/src/e2ee/types.d.ts +129 -0
  72. package/dist/ts4.2/src/e2ee/utils.d.ts +24 -0
  73. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +175 -0
  74. package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +46 -0
  75. package/dist/ts4.2/src/e2ee/worker/e2ee.worker.d.ts +2 -0
  76. package/dist/ts4.2/src/index.d.ts +1 -0
  77. package/dist/ts4.2/src/logger.d.ts +4 -1
  78. package/dist/ts4.2/src/options.d.ts +5 -0
  79. package/dist/ts4.2/src/proto/livekit_models.d.ts +2 -2
  80. package/dist/ts4.2/src/room/PCTransport.d.ts +3 -1
  81. package/dist/ts4.2/src/room/RTCEngine.d.ts +17 -3
  82. package/dist/ts4.2/src/room/Room.d.ts +10 -0
  83. package/dist/ts4.2/src/room/events.d.ts +14 -2
  84. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +7 -2
  85. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -0
  86. package/dist/ts4.2/src/room/track/TrackPublication.d.ts +3 -0
  87. package/dist/ts4.2/src/room/track/options.d.ts +6 -6
  88. package/dist/ts4.2/src/room/track/utils.d.ts +9 -0
  89. package/dist/ts4.2/src/room/utils.d.ts +2 -0
  90. package/package.json +17 -7
  91. package/src/api/SignalClient.ts +28 -9
  92. package/src/connectionHelper/checks/turn.ts +1 -0
  93. package/src/connectionHelper/checks/websocket.ts +1 -0
  94. package/src/e2ee/E2eeManager.ts +374 -0
  95. package/src/e2ee/KeyProvider.ts +77 -0
  96. package/src/e2ee/constants.ts +40 -0
  97. package/src/e2ee/errors.ts +16 -0
  98. package/src/e2ee/index.ts +3 -0
  99. package/src/e2ee/types.ts +160 -0
  100. package/src/e2ee/utils.ts +127 -0
  101. package/src/e2ee/worker/FrameCryptor.test.ts +21 -0
  102. package/src/e2ee/worker/FrameCryptor.ts +614 -0
  103. package/src/e2ee/worker/ParticipantKeyHandler.ts +129 -0
  104. package/src/e2ee/worker/e2ee.worker.ts +217 -0
  105. package/src/e2ee/worker/tsconfig.json +6 -0
  106. package/src/index.ts +1 -0
  107. package/src/logger.ts +10 -2
  108. package/src/options.ts +6 -0
  109. package/src/proto/livekit_models.ts +12 -12
  110. package/src/room/PCTransport.ts +39 -9
  111. package/src/room/RTCEngine.ts +127 -34
  112. package/src/room/Room.ts +77 -22
  113. package/src/room/defaults.ts +1 -1
  114. package/src/room/events.ts +14 -0
  115. package/src/room/participant/LocalParticipant.ts +52 -8
  116. package/src/room/participant/Participant.ts +4 -0
  117. package/src/room/track/LocalTrack.ts +5 -4
  118. package/src/room/track/RemoteVideoTrack.ts +2 -2
  119. package/src/room/track/TrackPublication.ts +9 -1
  120. package/src/room/track/options.ts +3 -2
  121. package/src/room/track/utils.ts +27 -0
  122. package/src/room/utils.ts +5 -0
  123. package/src/room/worker.d.ts +4 -0
  124. package/src/test/MockMediaStreamTrack.ts +1 -0
@@ -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,YAE/B;AAED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O,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
@@ -0,0 +1,46 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import type { KeyProviderOptions, KeySet, ParticipantKeyHandlerCallbacks } from '../types';
3
+ /**
4
+ * ParticipantKeyHandler is responsible for providing a cryptor instance with the
5
+ * en-/decryption key of a participant. It assumes that all tracks of a specific participant
6
+ * are encrypted with the same key.
7
+ * Additionally it exposes a method to ratchet a key which can be used by the cryptor either automatically
8
+ * if decryption fails or can be triggered manually on both sender and receiver side.
9
+ *
10
+ */
11
+ export declare class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHandlerCallbacks> {
12
+ private currentKeyIndex;
13
+ private cryptoKeyRing;
14
+ private enabled;
15
+ private keyProviderOptions;
16
+ private ratchetPromiseMap;
17
+ private participantId;
18
+ constructor(participantId: string | undefined, isEnabled: boolean, keyProviderOptions: KeyProviderOptions);
19
+ setEnabled(enabled: boolean): void;
20
+ /**
21
+ * Ratchets the current key (or the one at keyIndex if provided) and
22
+ * returns the ratcheted material
23
+ * if `setKey` is true (default), it will also set the ratcheted key directly on the crypto key ring
24
+ * @param keyIndex
25
+ * @param setKey
26
+ */
27
+ ratchetKey(keyIndex?: number, setKey?: boolean): Promise<CryptoKey>;
28
+ /**
29
+ * takes in a key material with `deriveBits` and `deriveKey` set as key usages
30
+ * and derives encryption keys from the material and sets it on the key ring buffer
31
+ * together with the material
32
+ * also updates the currentKeyIndex
33
+ */
34
+ setKeyFromMaterial(material: CryptoKey, keyIndex?: number, emitRatchetEvent?: boolean): Promise<void>;
35
+ setKeySet(keySet: KeySet, keyIndex: number, emitRatchetEvent?: boolean): Promise<void>;
36
+ setCurrentKeyIndex(index: number): Promise<void>;
37
+ isEnabled(): boolean;
38
+ getCurrentKeyIndex(): number;
39
+ /**
40
+ * returns currently used KeySet or the one at `keyIndex` if provided
41
+ * @param keyIndex
42
+ * @returns
43
+ */
44
+ getKeySet(keyIndex?: number): KeySet;
45
+ }
46
+ //# sourceMappingURL=ParticipantKeyHandler.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=e2ee.worker.d.ts.map
@@ -31,6 +31,7 @@ export { facingModeFromDeviceLabel, facingModeFromLocalTrack } from './room/trac
31
31
  export * from './room/track/types';
32
32
  export type { DataPublishOptions, SimulationScenario } from './room/types';
33
33
  export * from './version';
34
+ export * from './e2ee';
34
35
  export * from './room/track/processor/types';
35
36
  export { setLogLevel, setLogExtension, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, isBrowserSupported, supportsAdaptiveStream, supportsDynacast, supportsAV1, supportsVP9, createAudioAnalyser, LogLevel, Room, ConnectionState, RoomState, DataPacket_Kind, DisconnectReason, Participant, RemoteParticipant, LocalParticipant, LocalAudioTrack, LocalVideoTrack, LocalTrack, LocalTrackPublication, RemoteTrack, RemoteAudioTrack, RemoteVideoTrack, RemoteTrackPublication, TrackPublication, VideoQuality, ConnectionQuality, DefaultReconnectPolicy, CriticalTimers, };
36
37
  export type { ElementInfo, ParticipantTrackPermission, AudioAnalyserOptions, LiveKitReactNativeInfo, };
@@ -1,3 +1,4 @@
1
+ import * as log from 'loglevel';
1
2
  export declare enum LogLevel {
2
3
  trace = 0,
3
4
  debug = 1,
@@ -13,14 +14,16 @@ type StructuredLogger = {
13
14
  info: (msg: string, context?: object) => void;
14
15
  warn: (msg: string, context?: object) => void;
15
16
  error: (msg: string, context?: object) => void;
17
+ setDefaultLevel: (level: log.LogLevelDesc) => void;
16
18
  };
17
19
  declare const _default: StructuredLogger;
18
20
  export default _default;
19
- export declare function setLogLevel(level: LogLevel | LogLevelString): void;
21
+ export declare function setLogLevel(level: LogLevel | LogLevelString, loggerName?: 'livekit' | 'lk-e2ee'): void;
20
22
  export type LogExtension = (level: LogLevel, msg: string, context?: object) => void;
21
23
  /**
22
24
  * use this to hook into the logging function to allow sending internal livekit logs to third party services
23
25
  * if set, the browser logs will lose their stacktrace information (see https://github.com/pimterry/loglevel#writing-plugins)
24
26
  */
25
27
  export declare function setLogExtension(extension: LogExtension): void;
28
+ export declare const workerLogger: StructuredLogger;
26
29
  //# sourceMappingURL=logger.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { E2EEOptions } from './e2ee/types';
1
2
  import type { ReconnectPolicy } from './room/ReconnectPolicy';
2
3
  import type { AudioCaptureOptions, AudioOutputOptions, TrackPublishDefaults, VideoCaptureOptions } from './room/track/options';
3
4
  import type { AdaptiveStreamSettings } from './room/track/types';
@@ -65,6 +66,10 @@ export interface InternalRoomOptions {
65
66
  * experimental flag, mix all audio tracks in web audio
66
67
  */
67
68
  expWebAudioMix: boolean | WebAudioSettings;
69
+ /**
70
+ * @experimental
71
+ */
72
+ e2ee?: E2EEOptions;
68
73
  }
69
74
  /**
70
75
  * Options for when creating a new room
@@ -75,7 +75,7 @@ export declare enum DisconnectReason {
75
75
  export declare function disconnectReasonFromJSON(object: any): DisconnectReason;
76
76
  export declare function disconnectReasonToJSON(object: DisconnectReason): string;
77
77
  export declare enum ReconnectReason {
78
- RR_UNKOWN = 0,
78
+ RR_UNKNOWN = 0,
79
79
  RR_SIGNAL_DISCONNECTED = 1,
80
80
  RR_PUBLISHER_FAILED = 2,
81
81
  RR_SUBSCRIBER_FAILED = 3,
@@ -85,7 +85,7 @@ export declare enum ReconnectReason {
85
85
  export declare function reconnectReasonFromJSON(object: any): ReconnectReason;
86
86
  export declare function reconnectReasonToJSON(object: ReconnectReason): string;
87
87
  export declare enum SubscriptionError {
88
- SE_UNKOWN = 0,
88
+ SE_UNKNOWN = 0,
89
89
  SE_CODEC_UNSUPPORTED = 1,
90
90
  SE_TRACK_NOTFOUND = 2,
91
91
  UNRECOGNIZED = -1
@@ -9,10 +9,12 @@ interface TrackBitrateInfo {
9
9
  export declare const PCEvents: {
10
10
  readonly NegotiationStarted: "negotiationStarted";
11
11
  readonly NegotiationComplete: "negotiationComplete";
12
+ readonly RTPVideoPayloadTypes: "rtpVideoPayloadTypes";
12
13
  };
13
14
  /** @internal */
14
15
  export default class PCTransport extends EventEmitter {
15
- pc: RTCPeerConnection;
16
+ private _pc;
17
+ get pc(): RTCPeerConnection;
16
18
  pendingCandidates: RTCIceCandidateInit[];
17
19
  restartingIce: boolean;
18
20
  renegotiate: boolean;