livekit-client 1.11.4 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -1
- package/dist/livekit-client.e2ee.worker.js +2 -0
- package/dist/livekit-client.e2ee.worker.js.map +1 -0
- package/dist/livekit-client.e2ee.worker.mjs +1545 -0
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -0
- package/dist/livekit-client.esm.mjs +4786 -4065
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +4 -1
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/turn.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/websocket.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts +45 -0
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -0
- package/dist/src/e2ee/KeyProvider.d.ts +42 -0
- package/dist/src/e2ee/KeyProvider.d.ts.map +1 -0
- package/dist/src/e2ee/constants.d.ts +14 -0
- package/dist/src/e2ee/constants.d.ts.map +1 -0
- package/dist/src/e2ee/errors.d.ts +11 -0
- package/dist/src/e2ee/errors.d.ts.map +1 -0
- package/dist/src/e2ee/index.d.ts +4 -0
- package/dist/src/e2ee/index.d.ts.map +1 -0
- package/dist/src/e2ee/types.d.ts +129 -0
- package/dist/src/e2ee/types.d.ts.map +1 -0
- package/dist/src/e2ee/utils.d.ts +24 -0
- package/dist/src/e2ee/utils.d.ts.map +1 -0
- package/dist/src/e2ee/worker/FrameCryptor.d.ts +174 -0
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -0
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +54 -0
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -0
- package/dist/src/e2ee/worker/e2ee.worker.d.ts +2 -0
- package/dist/src/e2ee/worker/e2ee.worker.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +4 -1
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/options.d.ts +5 -0
- package/dist/src/options.d.ts.map +1 -1
- package/dist/src/proto/livekit_models.d.ts +2 -2
- package/dist/src/proto/livekit_models.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +3 -1
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +17 -3
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +10 -0
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +14 -2
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +7 -2
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -0
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +6 -4
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/TrackPublication.d.ts +3 -0
- package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +2 -2
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +9 -0
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +2 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/MockMediaStreamTrack.d.ts.map +1 -1
- package/dist/src/utils/browserParser.d.ts +2 -0
- package/dist/src/utils/browserParser.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +4 -1
- package/dist/ts4.2/src/e2ee/E2eeManager.d.ts +45 -0
- package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +42 -0
- package/dist/ts4.2/src/e2ee/constants.d.ts +14 -0
- package/dist/ts4.2/src/e2ee/errors.d.ts +11 -0
- package/dist/ts4.2/src/e2ee/index.d.ts +4 -0
- package/dist/ts4.2/src/e2ee/types.d.ts +129 -0
- package/dist/ts4.2/src/e2ee/utils.d.ts +24 -0
- package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +174 -0
- package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +54 -0
- package/dist/ts4.2/src/e2ee/worker/e2ee.worker.d.ts +2 -0
- package/dist/ts4.2/src/index.d.ts +1 -0
- package/dist/ts4.2/src/logger.d.ts +4 -1
- package/dist/ts4.2/src/options.d.ts +5 -0
- package/dist/ts4.2/src/proto/livekit_models.d.ts +2 -2
- package/dist/ts4.2/src/room/PCTransport.d.ts +3 -1
- package/dist/ts4.2/src/room/RTCEngine.d.ts +17 -3
- package/dist/ts4.2/src/room/Room.d.ts +10 -0
- package/dist/ts4.2/src/room/events.d.ts +14 -2
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +7 -2
- package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -0
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +6 -4
- package/dist/ts4.2/src/room/track/TrackPublication.d.ts +3 -0
- package/dist/ts4.2/src/room/track/options.d.ts +6 -6
- package/dist/ts4.2/src/room/track/utils.d.ts +9 -0
- package/dist/ts4.2/src/room/utils.d.ts +2 -0
- package/dist/ts4.2/src/utils/browserParser.d.ts +2 -0
- package/package.json +17 -7
- package/src/api/SignalClient.ts +28 -9
- package/src/connectionHelper/checks/turn.ts +1 -0
- package/src/connectionHelper/checks/websocket.ts +1 -0
- package/src/e2ee/E2eeManager.ts +374 -0
- package/src/e2ee/KeyProvider.ts +77 -0
- package/src/e2ee/constants.ts +40 -0
- package/src/e2ee/errors.ts +16 -0
- package/src/e2ee/index.ts +3 -0
- package/src/e2ee/types.ts +160 -0
- package/src/e2ee/utils.ts +127 -0
- package/src/e2ee/worker/FrameCryptor.test.ts +21 -0
- package/src/e2ee/worker/FrameCryptor.ts +612 -0
- package/src/e2ee/worker/ParticipantKeyHandler.ts +144 -0
- package/src/e2ee/worker/e2ee.worker.ts +223 -0
- package/src/e2ee/worker/tsconfig.json +6 -0
- package/src/index.ts +1 -0
- package/src/logger.ts +10 -2
- package/src/options.ts +6 -0
- package/src/proto/livekit_models.ts +12 -12
- package/src/room/PCTransport.ts +39 -9
- package/src/room/RTCEngine.ts +127 -34
- package/src/room/Room.ts +94 -29
- package/src/room/defaults.ts +1 -1
- package/src/room/events.ts +14 -0
- package/src/room/participant/LocalParticipant.ts +52 -8
- package/src/room/participant/Participant.ts +4 -0
- package/src/room/participant/RemoteParticipant.ts +19 -15
- package/src/room/track/LocalTrack.ts +5 -4
- package/src/room/track/RemoteVideoTrack.ts +2 -2
- package/src/room/track/TrackPublication.ts +9 -1
- package/src/room/track/create.ts +9 -0
- package/src/room/track/options.ts +3 -2
- package/src/room/track/utils.ts +27 -0
- package/src/room/utils.ts +5 -0
- package/src/room/worker.d.ts +4 -0
- package/src/test/MockMediaStreamTrack.ts +1 -0
- package/src/utils/browserParser.ts +5 -0
@@ -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;;OAEG;IACH,mBAAmB,CAAC,EAAE,aAAa,CAAC;IAEpC;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,YAAY,CAAC,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AAC,CAAC;AAE7D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAEtE;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKpF;AAED;;GAEG;AACH,MAAM,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,3 +1,4 @@
|
|
1
|
+
import { Track } from './Track';
|
1
2
|
import type { AudioCaptureOptions, CreateLocalTracksOptions, VideoCaptureOptions } from './options';
|
2
3
|
import type { AudioTrack } from './types';
|
3
4
|
export declare function mergeDefaultOptions(options?: CreateLocalTracksOptions, audioDefaults?: AudioCaptureOptions, videoDefaults?: VideoCaptureOptions): CreateLocalTracksOptions;
|
@@ -11,4 +12,12 @@ export declare function detectSilence(track: AudioTrack, timeOffset?: number): P
|
|
11
12
|
* @internal
|
12
13
|
*/
|
13
14
|
export declare function getNewAudioContext(): AudioContext | void;
|
15
|
+
/**
|
16
|
+
* @internal
|
17
|
+
*/
|
18
|
+
export declare function kindToSource(kind: MediaDeviceKind): Track.Source.Camera | Track.Source.Microphone | Track.Source.Unknown;
|
19
|
+
/**
|
20
|
+
* @internal
|
21
|
+
*/
|
22
|
+
export declare function sourceToKind(source: Track.Source): MediaDeviceKind | undefined;
|
14
23
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"AACA,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,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBzF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,CAOxD"}
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,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,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBzF;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"}
|
package/dist/src/room/utils.d.ts
CHANGED
@@ -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;
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/room/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAk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WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,GAAG,gBAAgB,EACzC,OAAO,CAAC,EAAE,oBAAoB;;;;EA+C/B;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAgB;IAEhC,OAAO,CAAC,MAAM,CAAS;;IAOvB,QAAQ;IAIR,IAAI,kBAGoB,IAAI;CAgB7B;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,IAAI,UAAU,CAEzE;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAqBvE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MockMediaStreamTrack.d.ts","sourceRoot":"","sources":["../../../src/test/MockMediaStreamTrack.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"MockMediaStreamTrack.d.ts","sourceRoot":"","sources":["../../../src/test/MockMediaStreamTrack.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,gBAAgB;IACnE,WAAW,EAAE,MAAM,CAAM;IAEzB,OAAO,EAAE,OAAO,CAAQ;IAExB,EAAE,EAAE,MAAM,CAAQ;IAElB,IAAI,EAAE,MAAM,CAAW;IAEvB,KAAK,EAAE,MAAM,CAAW;IAExB,KAAK,EAAE,OAAO,CAAS;IAEvB,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,CAAQ;IAEpE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,CAAQ;IAEnE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,CA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":["../../../src/utils/browserParser.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"browserParser.d.ts","sourceRoot":"","sources":["../../../src/utils/browserParser.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,YAAY,CAAC;CACnB,CAAC;AAIF;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,UAAO,8BAU1D"}
|
@@ -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
|
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,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,174 @@
|
|
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 participantId;
|
25
|
+
private trackId;
|
26
|
+
private keys;
|
27
|
+
private videoCodec?;
|
28
|
+
private rtpMap;
|
29
|
+
private keyProviderOptions;
|
30
|
+
/**
|
31
|
+
* used for detecting server injected unencrypted frames
|
32
|
+
*/
|
33
|
+
private unencryptedFrameByteTrailer;
|
34
|
+
constructor(opts: {
|
35
|
+
keys: ParticipantKeyHandler;
|
36
|
+
participantId: string;
|
37
|
+
keyProviderOptions: KeyProviderOptions;
|
38
|
+
unencryptedFrameBytes?: Uint8Array;
|
39
|
+
});
|
40
|
+
/**
|
41
|
+
* Assign a different participant to the cryptor.
|
42
|
+
* useful for transceiver re-use
|
43
|
+
* @param id
|
44
|
+
* @param keys
|
45
|
+
*/
|
46
|
+
setParticipant(id: string, keys: ParticipantKeyHandler): void;
|
47
|
+
unsetParticipant(): void;
|
48
|
+
getParticipantId(): string | undefined;
|
49
|
+
getTrackId(): string | undefined;
|
50
|
+
/**
|
51
|
+
* Update the video codec used by the mediaStreamTrack
|
52
|
+
* @param codec
|
53
|
+
*/
|
54
|
+
setVideoCodec(codec: VideoCodec): void;
|
55
|
+
/**
|
56
|
+
* rtp payload type map used for figuring out codec of payload type when encoding
|
57
|
+
* @param map
|
58
|
+
*/
|
59
|
+
setRtpMap(map: Map<number, VideoCodec>): void;
|
60
|
+
setupTransform(operation: 'encode' | 'decode', readable: ReadableStream, writable: WritableStream, trackId: string, codec?: VideoCodec): void;
|
61
|
+
/**
|
62
|
+
* Function that will be injected in a stream and will encrypt the given encoded frames.
|
63
|
+
*
|
64
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
65
|
+
* @param {TransformStreamDefaultController} controller - TransportStreamController.
|
66
|
+
*
|
67
|
+
* The VP8 payload descriptor described in
|
68
|
+
* https://tools.ietf.org/html/rfc7741#section-4.2
|
69
|
+
* is part of the RTP packet and not part of the frame and is not controllable by us.
|
70
|
+
* This is fine as the SFU keeps having access to it for routing.
|
71
|
+
*
|
72
|
+
* The encrypted frame is formed as follows:
|
73
|
+
* 1) Find unencrypted byte length, depending on the codec, frame type and kind.
|
74
|
+
* 2) Form the GCM IV for the frame as described above.
|
75
|
+
* 3) Encrypt the rest of the frame using AES-GCM.
|
76
|
+
* 4) Allocate space for the encrypted frame.
|
77
|
+
* 5) Copy the unencrypted bytes to the start of the encrypted frame.
|
78
|
+
* 6) Append the ciphertext to the encrypted frame.
|
79
|
+
* 7) Append the IV.
|
80
|
+
* 8) Append a single byte for the key identifier.
|
81
|
+
* 9) Enqueue the encrypted frame for sending.
|
82
|
+
*/
|
83
|
+
encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
|
84
|
+
/**
|
85
|
+
* Function that will be injected in a stream and will decrypt the given encoded frames.
|
86
|
+
*
|
87
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
88
|
+
* @param {TransformStreamDefaultController} controller - TransportStreamController.
|
89
|
+
*/
|
90
|
+
decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
|
91
|
+
/**
|
92
|
+
* Function that will decrypt the given encoded frame. If the decryption fails, it will
|
93
|
+
* ratchet the key for up to RATCHET_WINDOW_SIZE times.
|
94
|
+
*/
|
95
|
+
decryptFrame(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, keyIndex: number, initialMaterial?: KeySet | undefined, ratchetOpts?: DecodeRatchetOptions): Promise<RTCEncodedVideoFrame | RTCEncodedAudioFrame | undefined>;
|
96
|
+
/**
|
97
|
+
* Construct the IV used for AES-GCM and sent (in plain) with the packet similar to
|
98
|
+
* https://tools.ietf.org/html/rfc7714#section-8.1
|
99
|
+
* It concatenates
|
100
|
+
* - the 32 bit synchronization source (SSRC) given on the encoded frame,
|
101
|
+
* - the 32 bit rtp timestamp given on the encoded frame,
|
102
|
+
* - a send counter that is specific to the SSRC. Starts at a random number.
|
103
|
+
* The send counter is essentially the pictureId but we currently have to implement this ourselves.
|
104
|
+
* There is no XOR with a salt. Note that this IV leaks the SSRC to the receiver but since this is
|
105
|
+
* randomly generated and SFUs may not rewrite this is considered acceptable.
|
106
|
+
* The SSRC is used to allow demultiplexing multiple streams with the same key, as described in
|
107
|
+
* https://tools.ietf.org/html/rfc3711#section-4.1.1
|
108
|
+
* The RTP timestamp is 32 bits and advances by the codec clock rate (90khz for video, 48khz for
|
109
|
+
* opus audio) every second. For video it rolls over roughly every 13 hours.
|
110
|
+
* The send counter will advance at the frame rate (30fps for video, 50fps for 20ms opus audio)
|
111
|
+
* every second. It will take a long time to roll over.
|
112
|
+
*
|
113
|
+
* See also https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams
|
114
|
+
*/
|
115
|
+
private makeIV;
|
116
|
+
getUnencryptedBytes(frame: RTCEncodedVideoFrame | RTCEncodedAudioFrame): number;
|
117
|
+
/**
|
118
|
+
* inspects frame payloadtype if available and maps it to the codec specified in rtpMap
|
119
|
+
*/
|
120
|
+
getVideoCodec(frame: RTCEncodedVideoFrame): VideoCodec | undefined;
|
121
|
+
}
|
122
|
+
/**
|
123
|
+
* Slice the NALUs present in the supplied buffer, assuming it is already byte-aligned
|
124
|
+
* code adapted from https://github.com/medooze/h264-frame-parser/blob/main/lib/NalUnits.ts to return indices only
|
125
|
+
*/
|
126
|
+
export declare function findNALUIndices(stream: Uint8Array): number[];
|
127
|
+
export declare function parseNALUType(startByte: number): NALUType;
|
128
|
+
export declare enum NALUType {
|
129
|
+
/** Coded slice of a non-IDR picture */
|
130
|
+
SLICE_NON_IDR = 1,
|
131
|
+
/** Coded slice data partition A */
|
132
|
+
SLICE_PARTITION_A = 2,
|
133
|
+
/** Coded slice data partition B */
|
134
|
+
SLICE_PARTITION_B = 3,
|
135
|
+
/** Coded slice data partition C */
|
136
|
+
SLICE_PARTITION_C = 4,
|
137
|
+
/** Coded slice of an IDR picture */
|
138
|
+
SLICE_IDR = 5,
|
139
|
+
/** Supplemental enhancement information */
|
140
|
+
SEI = 6,
|
141
|
+
/** Sequence parameter set */
|
142
|
+
SPS = 7,
|
143
|
+
/** Picture parameter set */
|
144
|
+
PPS = 8,
|
145
|
+
/** Access unit delimiter */
|
146
|
+
AUD = 9,
|
147
|
+
/** End of sequence */
|
148
|
+
END_SEQ = 10,
|
149
|
+
/** End of stream */
|
150
|
+
END_STREAM = 11,
|
151
|
+
/** Filler data */
|
152
|
+
FILLER_DATA = 12,
|
153
|
+
/** Sequence parameter set extension */
|
154
|
+
SPS_EXT = 13,
|
155
|
+
/** Prefix NAL unit */
|
156
|
+
PREFIX_NALU = 14,
|
157
|
+
/** Subset sequence parameter set */
|
158
|
+
SUBSET_SPS = 15,
|
159
|
+
/** Depth parameter set */
|
160
|
+
DPS = 16,
|
161
|
+
/** Coded slice of an auxiliary coded picture without partitioning */
|
162
|
+
SLICE_AUX = 19,
|
163
|
+
/** Coded slice extension */
|
164
|
+
SLICE_EXT = 20,
|
165
|
+
/** Coded slice extension for a depth view component or a 3D-AVC texture view component */
|
166
|
+
SLICE_LAYER_EXT = 21
|
167
|
+
}
|
168
|
+
/**
|
169
|
+
* we use a magic frame trailer to detect whether a frame is injected
|
170
|
+
* by the livekit server and thus to be treated as unencrypted
|
171
|
+
* @internal
|
172
|
+
*/
|
173
|
+
export declare function isFrameServerInjected(frameData: ArrayBuffer, trailerBytes: Uint8Array): boolean;
|
174
|
+
//# sourceMappingURL=FrameCryptor.d.ts.map
|
@@ -0,0 +1,54 @@
|
|
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
|
+
hasValidKey: boolean;
|
19
|
+
constructor(participantId: string | undefined, isEnabled: boolean, keyProviderOptions: KeyProviderOptions);
|
20
|
+
setEnabled(enabled: boolean): void;
|
21
|
+
/**
|
22
|
+
* Ratchets the current key (or the one at keyIndex if provided) and
|
23
|
+
* returns the ratcheted material
|
24
|
+
* if `setKey` is true (default), it will also set the ratcheted key directly on the crypto key ring
|
25
|
+
* @param keyIndex
|
26
|
+
* @param setKey
|
27
|
+
*/
|
28
|
+
ratchetKey(keyIndex?: number, setKey?: boolean): Promise<CryptoKey>;
|
29
|
+
/**
|
30
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
31
|
+
* and derives encryption keys from the material and sets it on the key ring buffer
|
32
|
+
* together with the material
|
33
|
+
* also resets the valid key property and updates the currentKeyIndex
|
34
|
+
*/
|
35
|
+
setKey(material: CryptoKey, keyIndex?: number): Promise<void>;
|
36
|
+
/**
|
37
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
38
|
+
* and derives encryption keys from the material and sets it on the key ring buffer
|
39
|
+
* together with the material
|
40
|
+
* also updates the currentKeyIndex
|
41
|
+
*/
|
42
|
+
setKeyFromMaterial(material: CryptoKey, keyIndex?: number, emitRatchetEvent?: boolean): Promise<void>;
|
43
|
+
setKeySet(keySet: KeySet, keyIndex: number, emitRatchetEvent?: boolean): Promise<void>;
|
44
|
+
setCurrentKeyIndex(index: number): Promise<void>;
|
45
|
+
isEnabled(): boolean;
|
46
|
+
getCurrentKeyIndex(): number;
|
47
|
+
/**
|
48
|
+
* returns currently used KeySet or the one at `keyIndex` if provided
|
49
|
+
* @param keyIndex
|
50
|
+
* @returns
|
51
|
+
*/
|
52
|
+
getKeySet(keyIndex?: number): KeySet;
|
53
|
+
}
|
54
|
+
//# sourceMappingURL=ParticipantKeyHandler.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, };
|