livekit-client 2.22.3 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +71 -8
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +1746 -547
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.fm.worker.js +1 -1
- package/dist/livekit-client.fm.worker.js.map +1 -1
- package/dist/livekit-client.fm.worker.mjs +2 -1
- package/dist/livekit-client.fm.worker.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 -2
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/api/WebSocketStream.d.ts +1 -0
- package/dist/src/api/WebSocketStream.d.ts.map +1 -1
- package/dist/src/api/utils.d.ts +1 -1
- package/dist/src/api/utils.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts +12 -1
- package/dist/src/e2ee/worker/naluUtils.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/options.d.ts +14 -0
- package/dist/src/options.d.ts.map +1 -1
- package/dist/src/room/DefaultReconnectPolicy.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +100 -7
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +16 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +54 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-channel/DataChannelManager.d.ts +9 -8
- package/dist/src/room/data-channel/DataChannelManager.d.ts.map +1 -1
- package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts +25 -12
- package/dist/src/room/data-channel/FlowControlledDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-channel/LossyDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-channel/ReliableDataChannel.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/defaults.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +18 -0
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +3 -2
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +4 -0
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -1
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
- package/dist/src/room/rpc/utils.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts +24 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +18 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +9 -0
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts +6 -0
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/processor/types.d.ts +11 -0
- package/dist/src/room/track/processor/types.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +13 -0
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +60 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/test/compressionStreamStubs.d.ts +12 -0
- package/dist/src/test/compressionStreamStubs.d.ts.map +1 -0
- package/dist/ts4.2/api/SignalClient.d.ts +187 -185
- package/dist/ts4.2/api/SignalClientStateMachine.d.ts +85 -85
- package/dist/ts4.2/api/WebSocketStream.d.ts +34 -33
- package/dist/ts4.2/api/utils.d.ts +9 -9
- package/dist/ts4.2/connectionHelper/ConnectionCheck.d.ts +30 -30
- package/dist/ts4.2/connectionHelper/checks/Checker.d.ts +62 -62
- package/dist/ts4.2/connectionHelper/checks/cloudRegion.d.ts +18 -18
- package/dist/ts4.2/connectionHelper/checks/connectionProtocol.d.ts +20 -20
- package/dist/ts4.2/connectionHelper/checks/publishAudio.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/publishVideo.d.ts +7 -7
- package/dist/ts4.2/connectionHelper/checks/reconnect.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/turn.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/webrtc.d.ts +6 -6
- package/dist/ts4.2/connectionHelper/checks/websocket.d.ts +6 -6
- package/dist/ts4.2/e2ee/E2eeManager.d.ts +111 -111
- package/dist/ts4.2/e2ee/KeyProvider.d.ts +54 -54
- package/dist/ts4.2/e2ee/constants.d.ts +21 -21
- package/dist/ts4.2/e2ee/errors.d.ts +12 -12
- package/dist/ts4.2/e2ee/events.d.ts +39 -39
- package/dist/ts4.2/e2ee/index.d.ts +6 -6
- package/dist/ts4.2/e2ee/types.d.ts +231 -231
- package/dist/ts4.2/e2ee/utils.d.ts +32 -32
- package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +16 -16
- package/dist/ts4.2/e2ee/worker/ErrorRateLimiter.d.ts +21 -21
- package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +209 -209
- package/dist/ts4.2/e2ee/worker/ParticipantKeyHandler.d.ts +81 -84
- package/dist/ts4.2/e2ee/worker/e2ee.worker.d.ts +2 -2
- package/dist/ts4.2/e2ee/worker/naluUtils.d.ts +39 -28
- package/dist/ts4.2/e2ee/worker/sifPayload.d.ts +23 -23
- package/dist/ts4.2/frameMetadata/FrameMetadataManager.d.ts +53 -53
- package/dist/ts4.2/frameMetadata/frameMetadata.d.ts +33 -33
- package/dist/ts4.2/frameMetadata/types.d.ts +62 -62
- package/dist/ts4.2/frameMetadata/utils.d.ts +9 -9
- package/dist/ts4.2/frameMetadata/worker/frameMetadata.worker.d.ts +2 -2
- package/dist/ts4.2/index.d.ts +76 -76
- package/dist/ts4.2/logger.d.ts +66 -66
- package/dist/ts4.2/options.d.ts +163 -149
- package/dist/ts4.2/room/BackOffStrategy.d.ts +27 -27
- package/dist/ts4.2/room/DefaultReconnectPolicy.d.ts +8 -8
- package/dist/ts4.2/room/DeviceManager.d.ts +12 -12
- package/dist/ts4.2/room/PCTransport.d.ts +268 -175
- package/dist/ts4.2/room/PCTransportManager.d.ts +77 -77
- package/dist/ts4.2/room/RTCEngine.d.ts +277 -262
- package/dist/ts4.2/room/ReconnectPolicy.d.ts +24 -24
- package/dist/ts4.2/room/RegionUrlProvider.d.ts +36 -36
- package/dist/ts4.2/room/Room.d.ts +407 -365
- package/dist/ts4.2/room/attribute-typings.d.ts +35 -35
- package/dist/ts4.2/room/data-channel/DataChannelManager.d.ts +63 -62
- package/dist/ts4.2/room/data-channel/FlowControlledDataChannel.d.ts +107 -95
- package/dist/ts4.2/room/data-channel/LossyDataChannel.d.ts +41 -41
- package/dist/ts4.2/room/data-channel/ReliableDataChannel.d.ts +57 -57
- package/dist/ts4.2/room/data-channel/types.d.ts +12 -12
- package/dist/ts4.2/room/data-stream/compression.d.ts +49 -49
- package/dist/ts4.2/room/data-stream/constants.d.ts +18 -18
- package/dist/ts4.2/room/data-stream/incoming/IncomingDataStreamManager.d.ts +29 -29
- package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +80 -80
- package/dist/ts4.2/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +73 -73
- package/dist/ts4.2/room/data-stream/outgoing/StreamWriter.d.ts +16 -16
- package/dist/ts4.2/room/data-stream/outgoing/header-utils.d.ts +18 -18
- package/dist/ts4.2/room/data-track/LocalDataTrack.d.ts +79 -80
- package/dist/ts4.2/room/data-track/RemoteDataTrack.d.ts +50 -50
- package/dist/ts4.2/room/data-track/depacketizer.d.ts +59 -59
- package/dist/ts4.2/room/data-track/frame.d.ts +22 -22
- package/dist/ts4.2/room/data-track/handle.d.ts +27 -27
- package/dist/ts4.2/room/data-track/incoming/IncomingDataTrackManager.d.ts +124 -124
- package/dist/ts4.2/room/data-track/incoming/errors.d.ts +24 -24
- package/dist/ts4.2/room/data-track/incoming/pipeline.d.ts +41 -41
- package/dist/ts4.2/room/data-track/incoming/types.d.ts +20 -20
- package/dist/ts4.2/room/data-track/outgoing/OutgoingDataTrackManager.d.ts +126 -126
- package/dist/ts4.2/room/data-track/outgoing/errors.d.ts +74 -74
- package/dist/ts4.2/room/data-track/outgoing/pipeline.d.ts +23 -23
- package/dist/ts4.2/room/data-track/outgoing/types.d.ts +48 -48
- package/dist/ts4.2/room/data-track/packet/constants.d.ts +20 -20
- package/dist/ts4.2/room/data-track/packet/errors.d.ts +40 -40
- package/dist/ts4.2/room/data-track/packet/extensions.d.ts +69 -69
- package/dist/ts4.2/room/data-track/packet/index.d.ts +98 -98
- package/dist/ts4.2/room/data-track/packet/serializable.d.ts +13 -13
- package/dist/ts4.2/room/data-track/packetizer.d.ts +43 -43
- package/dist/ts4.2/room/data-track/track-interfaces.d.ts +23 -23
- package/dist/ts4.2/room/data-track/types.d.ts +22 -22
- package/dist/ts4.2/room/data-track/utils.d.ts +60 -60
- package/dist/ts4.2/room/debounce.d.ts +11 -11
- package/dist/ts4.2/room/defaults.d.ts +9 -9
- package/dist/ts4.2/room/errors.d.ts +180 -162
- package/dist/ts4.2/room/events.d.ts +638 -637
- package/dist/ts4.2/room/participant/LocalParticipant.d.ts +291 -287
- package/dist/ts4.2/room/participant/Participant.d.ts +142 -144
- package/dist/ts4.2/room/participant/ParticipantTrackPermission.d.ts +26 -26
- package/dist/ts4.2/room/participant/RemoteParticipant.d.ts +85 -86
- package/dist/ts4.2/room/participant/publishUtils.d.ts +53 -53
- package/dist/ts4.2/room/rpc/client/RpcClientManager.d.ts +43 -43
- package/dist/ts4.2/room/rpc/client/events.d.ts +8 -8
- package/dist/ts4.2/room/rpc/index.d.ts +7 -7
- package/dist/ts4.2/room/rpc/server/RpcServerManager.d.ts +44 -44
- package/dist/ts4.2/room/rpc/server/events.d.ts +8 -8
- package/dist/ts4.2/room/rpc/utils.d.ts +131 -131
- package/dist/ts4.2/room/stats.d.ts +71 -71
- package/dist/ts4.2/room/statsSummary.d.ts +13 -13
- package/dist/ts4.2/room/timers.d.ts +12 -12
- package/dist/ts4.2/room/token-source/TokenSource.d.ts +82 -82
- package/dist/ts4.2/room/token-source/types.d.ts +70 -70
- package/dist/ts4.2/room/token-source/utils.d.ts +8 -8
- package/dist/ts4.2/room/track/FrameMetadataExtractor.d.ts +19 -19
- package/dist/ts4.2/room/track/LocalAudioTrack.d.ts +62 -42
- package/dist/ts4.2/room/track/LocalTrack.d.ts +143 -125
- package/dist/ts4.2/room/track/LocalTrackPublication.d.ts +42 -42
- package/dist/ts4.2/room/track/LocalVideoTrack.d.ts +109 -100
- package/dist/ts4.2/room/track/RemoteAudioTrack.d.ts +61 -55
- package/dist/ts4.2/room/track/RemoteTrack.d.ts +38 -38
- package/dist/ts4.2/room/track/RemoteTrackPublication.d.ts +72 -75
- package/dist/ts4.2/room/track/RemoteVideoTrack.d.ts +73 -76
- package/dist/ts4.2/room/track/Track.d.ts +156 -166
- package/dist/ts4.2/room/track/TrackPublication.d.ts +75 -81
- package/dist/ts4.2/room/track/create.d.ts +25 -25
- package/dist/ts4.2/room/track/facingMode.d.ts +41 -41
- package/dist/ts4.2/room/track/options.d.ts +403 -403
- package/dist/ts4.2/room/track/processor/types.d.ts +42 -31
- package/dist/ts4.2/room/track/record.d.ts +13 -13
- package/dist/ts4.2/room/track/types.d.ts +28 -28
- package/dist/ts4.2/room/track/utils.d.ts +60 -47
- package/dist/ts4.2/room/types.d.ts +127 -127
- package/dist/ts4.2/room/utils.d.ts +273 -214
- package/dist/ts4.2/test/MockMediaStreamTrack.d.ts +26 -26
- package/dist/ts4.2/test/compressionStreamStubs.d.ts +12 -0
- package/dist/ts4.2/test/mocks.d.ts +12 -12
- package/dist/ts4.2/test/promiseState.d.ts +12 -12
- package/dist/ts4.2/test/signalToken.d.ts +26 -26
- package/dist/ts4.2/type-polyfills/non-shared-typed-arrays.d.ts +2 -2
- package/dist/ts4.2/utils/AsyncQueue.d.ts +23 -23
- package/dist/ts4.2/utils/TypedPromise.d.ts +17 -17
- package/dist/ts4.2/utils/abort-signal-polyfill.d.ts +13 -13
- package/dist/ts4.2/utils/browserParser.d.ts +13 -13
- package/dist/ts4.2/utils/camelToSnakeCase.d.ts +8 -8
- package/dist/ts4.2/utils/cloneDeep.d.ts +2 -2
- package/dist/ts4.2/utils/dataPacketBuffer.d.ts +34 -34
- package/dist/ts4.2/utils/deferrable-map.d.ts +32 -32
- package/dist/ts4.2/utils/machineInspector.d.ts +54 -54
- package/dist/ts4.2/utils/serializer.d.ts +48 -48
- package/dist/ts4.2/utils/subscribeToEvents.d.ts +15 -15
- package/dist/ts4.2/utils/ttlmap.d.ts +20 -20
- package/dist/ts4.2/version.d.ts +15 -15
- package/package.json +5 -4
- package/src/api/SignalClient.e2e.test.ts +1 -3
- package/src/api/SignalClient.test.ts +394 -10
- package/src/api/SignalClient.ts +132 -76
- package/src/api/WebSocketStream.test.ts +11 -0
- package/src/api/WebSocketStream.ts +22 -1
- package/src/api/utils.ts +1 -1
- package/src/e2ee/E2eeManager.test.ts +43 -0
- package/src/e2ee/E2eeManager.ts +6 -2
- package/src/e2ee/worker/FrameCryptor.test.ts +212 -90
- package/src/e2ee/worker/FrameCryptor.ts +21 -4
- package/src/e2ee/worker/naluUtils.test.ts +123 -0
- package/src/e2ee/worker/naluUtils.ts +57 -2
- package/src/index.ts +2 -0
- package/src/options.ts +16 -0
- package/src/room/DefaultReconnectPolicy.test.ts +58 -0
- package/src/room/DefaultReconnectPolicy.ts +14 -2
- package/src/room/PCTransport.test.ts +327 -9
- package/src/room/PCTransport.ts +339 -36
- package/src/room/PCTransportManager.ts +3 -1
- package/src/room/RTCEngine.test.ts +318 -2
- package/src/room/RTCEngine.ts +126 -12
- package/src/room/Room.test.ts +148 -6
- package/src/room/Room.ts +312 -80
- package/src/room/data-channel/DataChannelManager.test.ts +24 -7
- package/src/room/data-channel/DataChannelManager.ts +43 -38
- package/src/room/data-channel/FlowControlledDataChannel.test.ts +60 -18
- package/src/room/data-channel/FlowControlledDataChannel.ts +40 -22
- package/src/room/data-channel/LossyDataChannel.test.ts +38 -0
- package/src/room/data-channel/LossyDataChannel.ts +10 -1
- package/src/room/data-channel/ReliableDataChannel.test.ts +72 -0
- package/src/room/data-channel/ReliableDataChannel.ts +16 -5
- package/src/room/data-stream/incoming/IncomingDataStreamManager.test.ts +47 -20
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +16 -5
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.test.ts +60 -39
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +4 -4
- package/src/room/defaults.ts +1 -0
- package/src/room/errors.test.ts +36 -0
- package/src/room/errors.ts +27 -0
- package/src/room/events.ts +2 -1
- package/src/room/participant/LocalParticipant.test.ts +136 -1
- package/src/room/participant/LocalParticipant.ts +66 -17
- package/src/room/participant/Participant.ts +6 -3
- package/src/room/participant/publishUtils.ts +0 -19
- package/src/room/participant/restartOnDefaultAudioDevice.test.ts +177 -0
- package/src/room/rpc/client/RpcClientManager.test.ts +51 -0
- package/src/room/rpc/client/RpcClientManager.ts +32 -15
- package/src/room/rpc/utils.test.ts +32 -0
- package/src/room/rpc/utils.ts +7 -0
- package/src/room/track/LocalAudioTrack.ts +101 -10
- package/src/room/track/LocalTrack.ts +87 -19
- package/src/room/track/LocalVideoTrack.ts +17 -3
- package/src/room/track/RemoteAudioTrack.ts +59 -14
- package/src/room/track/RemoteVideoTrack.test.ts +210 -0
- package/src/room/track/RemoteVideoTrack.ts +29 -3
- package/src/room/track/processor/types.ts +11 -0
- package/src/room/track/utils.test.ts +206 -2
- package/src/room/track/utils.ts +117 -5
- package/src/room/utils.test.ts +250 -0
- package/src/room/utils.ts +152 -19
- package/src/test/compressionStreamStubs.ts +53 -0
|
@@ -1,209 +1,209 @@
|
|
|
1
|
-
import type TypedEventEmitter from 'typed-emitter';
|
|
2
|
-
import type { FrameMetadataPublishOptions } from '../../frameMetadata/types';
|
|
3
|
-
import type { VideoCodec } from '../../room/track/options';
|
|
4
|
-
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
5
|
-
import type { CryptorCallbacks } from '../events';
|
|
6
|
-
import type { KeyProviderOptions } from '../types';
|
|
7
|
-
import type { ParticipantKeyHandler } from './ParticipantKeyHandler';
|
|
8
|
-
export declare const encryptionEnabledMap: Map<string, boolean>;
|
|
9
|
-
export interface FrameCryptorConstructor {
|
|
10
|
-
new (opts?: unknown): BaseFrameCryptor;
|
|
11
|
-
}
|
|
12
|
-
export interface TransformerInfo {
|
|
13
|
-
readable: ReadableStream;
|
|
14
|
-
writable: WritableStream;
|
|
15
|
-
transformer: TransformStream;
|
|
16
|
-
trackId: string;
|
|
17
|
-
symbol: symbol;
|
|
18
|
-
}
|
|
19
|
-
declare const BaseFrameCryptor_base: new () => TypedEventEmitter<CryptorCallbacks>;
|
|
20
|
-
export declare class BaseFrameCryptor extends BaseFrameCryptor_base {
|
|
21
|
-
protected encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<any>;
|
|
22
|
-
protected decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<any>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Cryptor is responsible for en-/decrypting media frames.
|
|
26
|
-
* Each Cryptor instance is responsible for en-/decrypting a single mediaStreamTrack.
|
|
27
|
-
*/
|
|
28
|
-
export declare class FrameCryptor extends BaseFrameCryptor {
|
|
29
|
-
private sendCounts;
|
|
30
|
-
private participantIdentity;
|
|
31
|
-
private trackId;
|
|
32
|
-
private keys;
|
|
33
|
-
private videoCodec?;
|
|
34
|
-
private rtpMap;
|
|
35
|
-
private keyProviderOptions;
|
|
36
|
-
/**
|
|
37
|
-
* used for detecting server injected unencrypted frames
|
|
38
|
-
*/
|
|
39
|
-
private sifTrailer;
|
|
40
|
-
private detectedCodec?;
|
|
41
|
-
private currentTransform?;
|
|
42
|
-
/**
|
|
43
|
-
* The encoded streams this cryptor was last set up with, retained beyond the
|
|
44
|
-
* lifetime of {@link currentTransform}.
|
|
45
|
-
*
|
|
46
|
-
* The main thread transfers a receiver's encoded streams to the worker once and
|
|
47
|
-
* cannot transfer them again (a transferred stream is locked), and
|
|
48
|
-
* `createEncodedStreams()` may only be called once per receiver. So when a
|
|
49
|
-
* transceiver is reused, or when a pipe dies underneath us, re-establishing the
|
|
50
|
-
* transform is only possible from here. See {@link ensureTransform}.
|
|
51
|
-
*/
|
|
52
|
-
private retainedStreams?;
|
|
53
|
-
/**
|
|
54
|
-
* Whether the subscribed track advertises packet trailer features.
|
|
55
|
-
* When false, we skip the per-frame trailer extraction path entirely
|
|
56
|
-
* on decode to avoid unnecessary work on tracks that don't use it.
|
|
57
|
-
*/
|
|
58
|
-
private hasFrameMetadata;
|
|
59
|
-
private frameMetadataOpts?;
|
|
60
|
-
private frameMetadataFrameId;
|
|
61
|
-
private errorLimiter;
|
|
62
|
-
private undecryptedTrackTimeout?;
|
|
63
|
-
/** grace period for a teardown or a resubscribe to land before we report a stalled track */
|
|
64
|
-
private readonly UNDECRYPTED_TRACK_GRACE_MS;
|
|
65
|
-
/**
|
|
66
|
-
* Tracks (participant, trackId, payloadType) tuples for which we've already logged a NALU
|
|
67
|
-
* fallback, so a persistent bad state doesn't flood the console (Firefox doesn't filter debug).
|
|
68
|
-
*/
|
|
69
|
-
private loggedNALUFallbacks;
|
|
70
|
-
constructor(opts: {
|
|
71
|
-
keys: ParticipantKeyHandler;
|
|
72
|
-
participantIdentity: string;
|
|
73
|
-
keyProviderOptions: KeyProviderOptions;
|
|
74
|
-
sifTrailer?: NonSharedUint8Array;
|
|
75
|
-
});
|
|
76
|
-
private get logContext();
|
|
77
|
-
/**
|
|
78
|
-
* Assign a different participant to the cryptor.
|
|
79
|
-
* useful for transceiver re-use
|
|
80
|
-
* @param id
|
|
81
|
-
* @param keys
|
|
82
|
-
*/
|
|
83
|
-
setParticipant(id: string, keys: ParticipantKeyHandler): void;
|
|
84
|
-
unsetParticipant(): void;
|
|
85
|
-
isEnabled(): boolean | undefined;
|
|
86
|
-
getParticipantIdentity(): string | undefined;
|
|
87
|
-
getTrackId(): string | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* Re-point this cryptor at a new trackId, keeping its (already transferred)
|
|
90
|
-
* encoded streams. Used when a transceiver is reused for a new track.
|
|
91
|
-
*/
|
|
92
|
-
setTrackId(trackId: string): void;
|
|
93
|
-
hasActiveTransform(): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* A track that is subscribed and known to be encrypted, but has no transform to
|
|
96
|
-
* decrypt it, will never produce a decodable frame again. That state used to be
|
|
97
|
-
* completely silent (a black tile and endless PLIs), so report it.
|
|
98
|
-
*
|
|
99
|
-
* Deferred, because on teardown the encoded streams routinely close before the
|
|
100
|
-
* 'removeTransform' message arrives -- checking immediately would cry wolf on
|
|
101
|
-
* every unsubscribe.
|
|
102
|
-
*
|
|
103
|
-
* Only meaningful while decoding: a sender's pipe closing on unpublish is
|
|
104
|
-
* routine and has no 'removeTransform' equivalent to quiet it down.
|
|
105
|
-
*/
|
|
106
|
-
private scheduleUndecryptedTrackWatchdog;
|
|
107
|
-
/**
|
|
108
|
-
* Re-establish the transform if it is gone while we still own the encoded
|
|
109
|
-
* streams, e.g. after a pipe died on its own (the swallowed
|
|
110
|
-
* 'Destination stream closed') or when a reused transceiver never got a new
|
|
111
|
-
* pipeline. Without this the frames pile up in a readable nobody reads and the
|
|
112
|
-
* decoder starves, which shows up as a permanently black tile.
|
|
113
|
-
*/
|
|
114
|
-
ensureTransform(): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Update the video codec used by the mediaStreamTrack
|
|
117
|
-
* @param codec
|
|
118
|
-
*/
|
|
119
|
-
setVideoCodec(codec: VideoCodec): void;
|
|
120
|
-
/**
|
|
121
|
-
* rtp payload type map used for figuring out codec of payload type when encoding
|
|
122
|
-
* @param map
|
|
123
|
-
*/
|
|
124
|
-
setRtpMap(map: Map<number, VideoCodec>): void;
|
|
125
|
-
/**
|
|
126
|
-
* Sets whether the track associated with this cryptor carries packet
|
|
127
|
-
* trailer data. When false, {@link decodeFunction} skips the per-frame
|
|
128
|
-
* trailer extraction branch entirely.
|
|
129
|
-
*/
|
|
130
|
-
setHasFrameMetadata(hasFrameMetadata: boolean): void;
|
|
131
|
-
setFrameMetadataOpts(frameMetadata?: FrameMetadataPublishOptions): void;
|
|
132
|
-
setupTransform(operation: 'encode' | 'decode', readable: ReadableStream<RTCEncodedVideoFrame | RTCEncodedAudioFrame>, writable: WritableStream<RTCEncodedVideoFrame | RTCEncodedAudioFrame>, trackId: string, codec?: VideoCodec, frameMetadata?: FrameMetadataPublishOptions): boolean;
|
|
133
|
-
setSifTrailer(trailer: NonSharedUint8Array): void;
|
|
134
|
-
private emitThrottledError;
|
|
135
|
-
/**
|
|
136
|
-
* Function that will be injected in a stream and will encrypt the given encoded frames.
|
|
137
|
-
*
|
|
138
|
-
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
139
|
-
* @param {TransformStreamDefaultController} controller - TransportStreamController.
|
|
140
|
-
*
|
|
141
|
-
* The VP8 payload descriptor described in
|
|
142
|
-
* https://tools.ietf.org/html/rfc7741#section-4.2
|
|
143
|
-
* is part of the RTP packet and not part of the frame and is not controllable by us.
|
|
144
|
-
* This is fine as the SFU keeps having access to it for routing.
|
|
145
|
-
*
|
|
146
|
-
* The encrypted frame is formed as follows:
|
|
147
|
-
* 1) Find unencrypted byte length, depending on the codec, frame type and kind.
|
|
148
|
-
* 2) Form the GCM IV for the frame as described above.
|
|
149
|
-
* 3) Encrypt the rest of the frame using AES-GCM.
|
|
150
|
-
* 4) Allocate space for the encrypted frame.
|
|
151
|
-
* 5) Copy the unencrypted bytes to the start of the encrypted frame.
|
|
152
|
-
* 6) Append the ciphertext to the encrypted frame.
|
|
153
|
-
* 7) Append the IV.
|
|
154
|
-
* 8) Append a single byte for the key identifier.
|
|
155
|
-
* 9) Enqueue the encrypted frame for sending.
|
|
156
|
-
*/
|
|
157
|
-
protected encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
|
|
158
|
-
private appendFrameMetadata;
|
|
159
|
-
/**
|
|
160
|
-
* Function that will be injected in a stream and will decrypt the given encoded frames.
|
|
161
|
-
*
|
|
162
|
-
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
163
|
-
* @param {TransformStreamDefaultController} controller - TransportStreamController.
|
|
164
|
-
*/
|
|
165
|
-
protected decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
|
|
166
|
-
/**
|
|
167
|
-
* Function that will decrypt the given encoded frame. If the decryption fails, it will
|
|
168
|
-
* ratchet the key for up to RATCHET_WINDOW_SIZE times.
|
|
169
|
-
*/
|
|
170
|
-
private decryptFrame;
|
|
171
|
-
/**
|
|
172
|
-
* Construct the IV used for AES-GCM and sent (in plain) with the packet similar to
|
|
173
|
-
* https://tools.ietf.org/html/rfc7714#section-8.1
|
|
174
|
-
* It concatenates
|
|
175
|
-
* - the 32 bit synchronization source (SSRC) given on the encoded frame,
|
|
176
|
-
* - the 32 bit rtp timestamp given on the encoded frame,
|
|
177
|
-
* - a send counter that is specific to the SSRC. Starts at a random number.
|
|
178
|
-
* The send counter is essentially the pictureId but we currently have to implement this ourselves.
|
|
179
|
-
* There is no XOR with a salt. Note that this IV leaks the SSRC to the receiver but since this is
|
|
180
|
-
* randomly generated and SFUs may not rewrite this is considered acceptable.
|
|
181
|
-
* The SSRC is used to allow demultiplexing multiple streams with the same key, as described in
|
|
182
|
-
* https://tools.ietf.org/html/rfc3711#section-4.1.1
|
|
183
|
-
* The RTP timestamp is 32 bits and advances by the codec clock rate (90khz for video, 48khz for
|
|
184
|
-
* opus audio) every second. For video it rolls over roughly every 13 hours.
|
|
185
|
-
* The send counter will advance at the frame rate (30fps for video, 50fps for 20ms opus audio)
|
|
186
|
-
* every second. It will take a long time to roll over.
|
|
187
|
-
*
|
|
188
|
-
* See also https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams
|
|
189
|
-
*/
|
|
190
|
-
private makeIV;
|
|
191
|
-
private getUnencryptedBytes;
|
|
192
|
-
/**
|
|
193
|
-
* Logs a NALU processing fallback at most once per (participant, trackId, payloadType) tuple,
|
|
194
|
-
* so a persistent bad state doesn't flood the console (Firefox doesn't filter debug).
|
|
195
|
-
*/
|
|
196
|
-
private logNALUFallbackOnce;
|
|
197
|
-
/**
|
|
198
|
-
* inspects frame mimetype if available. falls back to payloadtype and maps it to the codec specified in rtpMap
|
|
199
|
-
*/
|
|
200
|
-
private getVideoCodec;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* we use a magic frame trailer to detect whether a frame is injected
|
|
204
|
-
* by the livekit server and thus to be treated as unencrypted
|
|
205
|
-
* @internal
|
|
206
|
-
*/
|
|
207
|
-
export declare function isFrameServerInjected(frameData: ArrayBuffer, trailerBytes: NonSharedUint8Array): boolean;
|
|
208
|
-
export {};
|
|
209
|
-
//# sourceMappingURL=FrameCryptor.d.ts.map
|
|
1
|
+
import type TypedEventEmitter from 'typed-emitter';
|
|
2
|
+
import type { FrameMetadataPublishOptions } from '../../frameMetadata/types';
|
|
3
|
+
import type { VideoCodec } from '../../room/track/options';
|
|
4
|
+
import type { NonSharedUint8Array } from '../../type-polyfills/non-shared-typed-arrays';
|
|
5
|
+
import type { CryptorCallbacks } from '../events';
|
|
6
|
+
import type { KeyProviderOptions } from '../types';
|
|
7
|
+
import type { ParticipantKeyHandler } from './ParticipantKeyHandler';
|
|
8
|
+
export declare const encryptionEnabledMap: Map<string, boolean>;
|
|
9
|
+
export interface FrameCryptorConstructor {
|
|
10
|
+
new (opts?: unknown): BaseFrameCryptor;
|
|
11
|
+
}
|
|
12
|
+
export interface TransformerInfo {
|
|
13
|
+
readable: ReadableStream;
|
|
14
|
+
writable: WritableStream;
|
|
15
|
+
transformer: TransformStream;
|
|
16
|
+
trackId: string;
|
|
17
|
+
symbol: symbol;
|
|
18
|
+
}
|
|
19
|
+
declare const BaseFrameCryptor_base: new () => TypedEventEmitter<CryptorCallbacks>;
|
|
20
|
+
export declare class BaseFrameCryptor extends BaseFrameCryptor_base {
|
|
21
|
+
protected encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<any>;
|
|
22
|
+
protected decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<any>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Cryptor is responsible for en-/decrypting media frames.
|
|
26
|
+
* Each Cryptor instance is responsible for en-/decrypting a single mediaStreamTrack.
|
|
27
|
+
*/
|
|
28
|
+
export declare class FrameCryptor extends BaseFrameCryptor {
|
|
29
|
+
private sendCounts;
|
|
30
|
+
private participantIdentity;
|
|
31
|
+
private trackId;
|
|
32
|
+
private keys;
|
|
33
|
+
private videoCodec?;
|
|
34
|
+
private rtpMap;
|
|
35
|
+
private keyProviderOptions;
|
|
36
|
+
/**
|
|
37
|
+
* used for detecting server injected unencrypted frames
|
|
38
|
+
*/
|
|
39
|
+
private sifTrailer;
|
|
40
|
+
private detectedCodec?;
|
|
41
|
+
private currentTransform?;
|
|
42
|
+
/**
|
|
43
|
+
* The encoded streams this cryptor was last set up with, retained beyond the
|
|
44
|
+
* lifetime of {@link currentTransform}.
|
|
45
|
+
*
|
|
46
|
+
* The main thread transfers a receiver's encoded streams to the worker once and
|
|
47
|
+
* cannot transfer them again (a transferred stream is locked), and
|
|
48
|
+
* `createEncodedStreams()` may only be called once per receiver. So when a
|
|
49
|
+
* transceiver is reused, or when a pipe dies underneath us, re-establishing the
|
|
50
|
+
* transform is only possible from here. See {@link ensureTransform}.
|
|
51
|
+
*/
|
|
52
|
+
private retainedStreams?;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the subscribed track advertises packet trailer features.
|
|
55
|
+
* When false, we skip the per-frame trailer extraction path entirely
|
|
56
|
+
* on decode to avoid unnecessary work on tracks that don't use it.
|
|
57
|
+
*/
|
|
58
|
+
private hasFrameMetadata;
|
|
59
|
+
private frameMetadataOpts?;
|
|
60
|
+
private frameMetadataFrameId;
|
|
61
|
+
private errorLimiter;
|
|
62
|
+
private undecryptedTrackTimeout?;
|
|
63
|
+
/** grace period for a teardown or a resubscribe to land before we report a stalled track */
|
|
64
|
+
private readonly UNDECRYPTED_TRACK_GRACE_MS;
|
|
65
|
+
/**
|
|
66
|
+
* Tracks (participant, trackId, payloadType) tuples for which we've already logged a NALU
|
|
67
|
+
* fallback, so a persistent bad state doesn't flood the console (Firefox doesn't filter debug).
|
|
68
|
+
*/
|
|
69
|
+
private loggedNALUFallbacks;
|
|
70
|
+
constructor(opts: {
|
|
71
|
+
keys: ParticipantKeyHandler;
|
|
72
|
+
participantIdentity: string;
|
|
73
|
+
keyProviderOptions: KeyProviderOptions;
|
|
74
|
+
sifTrailer?: NonSharedUint8Array;
|
|
75
|
+
});
|
|
76
|
+
private get logContext();
|
|
77
|
+
/**
|
|
78
|
+
* Assign a different participant to the cryptor.
|
|
79
|
+
* useful for transceiver re-use
|
|
80
|
+
* @param id
|
|
81
|
+
* @param keys
|
|
82
|
+
*/
|
|
83
|
+
setParticipant(id: string, keys: ParticipantKeyHandler): void;
|
|
84
|
+
unsetParticipant(): void;
|
|
85
|
+
isEnabled(): boolean | undefined;
|
|
86
|
+
getParticipantIdentity(): string | undefined;
|
|
87
|
+
getTrackId(): string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Re-point this cryptor at a new trackId, keeping its (already transferred)
|
|
90
|
+
* encoded streams. Used when a transceiver is reused for a new track.
|
|
91
|
+
*/
|
|
92
|
+
setTrackId(trackId: string): void;
|
|
93
|
+
hasActiveTransform(): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* A track that is subscribed and known to be encrypted, but has no transform to
|
|
96
|
+
* decrypt it, will never produce a decodable frame again. That state used to be
|
|
97
|
+
* completely silent (a black tile and endless PLIs), so report it.
|
|
98
|
+
*
|
|
99
|
+
* Deferred, because on teardown the encoded streams routinely close before the
|
|
100
|
+
* 'removeTransform' message arrives -- checking immediately would cry wolf on
|
|
101
|
+
* every unsubscribe.
|
|
102
|
+
*
|
|
103
|
+
* Only meaningful while decoding: a sender's pipe closing on unpublish is
|
|
104
|
+
* routine and has no 'removeTransform' equivalent to quiet it down.
|
|
105
|
+
*/
|
|
106
|
+
private scheduleUndecryptedTrackWatchdog;
|
|
107
|
+
/**
|
|
108
|
+
* Re-establish the transform if it is gone while we still own the encoded
|
|
109
|
+
* streams, e.g. after a pipe died on its own (the swallowed
|
|
110
|
+
* 'Destination stream closed') or when a reused transceiver never got a new
|
|
111
|
+
* pipeline. Without this the frames pile up in a readable nobody reads and the
|
|
112
|
+
* decoder starves, which shows up as a permanently black tile.
|
|
113
|
+
*/
|
|
114
|
+
ensureTransform(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Update the video codec used by the mediaStreamTrack
|
|
117
|
+
* @param codec
|
|
118
|
+
*/
|
|
119
|
+
setVideoCodec(codec: VideoCodec): void;
|
|
120
|
+
/**
|
|
121
|
+
* rtp payload type map used for figuring out codec of payload type when encoding
|
|
122
|
+
* @param map
|
|
123
|
+
*/
|
|
124
|
+
setRtpMap(map: Map<number, VideoCodec>): void;
|
|
125
|
+
/**
|
|
126
|
+
* Sets whether the track associated with this cryptor carries packet
|
|
127
|
+
* trailer data. When false, {@link decodeFunction} skips the per-frame
|
|
128
|
+
* trailer extraction branch entirely.
|
|
129
|
+
*/
|
|
130
|
+
setHasFrameMetadata(hasFrameMetadata: boolean): void;
|
|
131
|
+
setFrameMetadataOpts(frameMetadata?: FrameMetadataPublishOptions): void;
|
|
132
|
+
setupTransform(operation: 'encode' | 'decode', readable: ReadableStream<RTCEncodedVideoFrame | RTCEncodedAudioFrame>, writable: WritableStream<RTCEncodedVideoFrame | RTCEncodedAudioFrame>, trackId: string, codec?: VideoCodec, frameMetadata?: FrameMetadataPublishOptions): boolean;
|
|
133
|
+
setSifTrailer(trailer: NonSharedUint8Array): void;
|
|
134
|
+
private emitThrottledError;
|
|
135
|
+
/**
|
|
136
|
+
* Function that will be injected in a stream and will encrypt the given encoded frames.
|
|
137
|
+
*
|
|
138
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
139
|
+
* @param {TransformStreamDefaultController} controller - TransportStreamController.
|
|
140
|
+
*
|
|
141
|
+
* The VP8 payload descriptor described in
|
|
142
|
+
* https://tools.ietf.org/html/rfc7741#section-4.2
|
|
143
|
+
* is part of the RTP packet and not part of the frame and is not controllable by us.
|
|
144
|
+
* This is fine as the SFU keeps having access to it for routing.
|
|
145
|
+
*
|
|
146
|
+
* The encrypted frame is formed as follows:
|
|
147
|
+
* 1) Find unencrypted byte length, depending on the codec, frame type and kind.
|
|
148
|
+
* 2) Form the GCM IV for the frame as described above.
|
|
149
|
+
* 3) Encrypt the rest of the frame using AES-GCM.
|
|
150
|
+
* 4) Allocate space for the encrypted frame.
|
|
151
|
+
* 5) Copy the unencrypted bytes to the start of the encrypted frame.
|
|
152
|
+
* 6) Append the ciphertext to the encrypted frame.
|
|
153
|
+
* 7) Append the IV.
|
|
154
|
+
* 8) Append a single byte for the key identifier.
|
|
155
|
+
* 9) Enqueue the encrypted frame for sending.
|
|
156
|
+
*/
|
|
157
|
+
protected encodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
|
|
158
|
+
private appendFrameMetadata;
|
|
159
|
+
/**
|
|
160
|
+
* Function that will be injected in a stream and will decrypt the given encoded frames.
|
|
161
|
+
*
|
|
162
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
163
|
+
* @param {TransformStreamDefaultController} controller - TransportStreamController.
|
|
164
|
+
*/
|
|
165
|
+
protected decodeFunction(encodedFrame: RTCEncodedVideoFrame | RTCEncodedAudioFrame, controller: TransformStreamDefaultController): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Function that will decrypt the given encoded frame. If the decryption fails, it will
|
|
168
|
+
* ratchet the key for up to RATCHET_WINDOW_SIZE times.
|
|
169
|
+
*/
|
|
170
|
+
private decryptFrame;
|
|
171
|
+
/**
|
|
172
|
+
* Construct the IV used for AES-GCM and sent (in plain) with the packet similar to
|
|
173
|
+
* https://tools.ietf.org/html/rfc7714#section-8.1
|
|
174
|
+
* It concatenates
|
|
175
|
+
* - the 32 bit synchronization source (SSRC) given on the encoded frame,
|
|
176
|
+
* - the 32 bit rtp timestamp given on the encoded frame,
|
|
177
|
+
* - a send counter that is specific to the SSRC. Starts at a random number.
|
|
178
|
+
* The send counter is essentially the pictureId but we currently have to implement this ourselves.
|
|
179
|
+
* There is no XOR with a salt. Note that this IV leaks the SSRC to the receiver but since this is
|
|
180
|
+
* randomly generated and SFUs may not rewrite this is considered acceptable.
|
|
181
|
+
* The SSRC is used to allow demultiplexing multiple streams with the same key, as described in
|
|
182
|
+
* https://tools.ietf.org/html/rfc3711#section-4.1.1
|
|
183
|
+
* The RTP timestamp is 32 bits and advances by the codec clock rate (90khz for video, 48khz for
|
|
184
|
+
* opus audio) every second. For video it rolls over roughly every 13 hours.
|
|
185
|
+
* The send counter will advance at the frame rate (30fps for video, 50fps for 20ms opus audio)
|
|
186
|
+
* every second. It will take a long time to roll over.
|
|
187
|
+
*
|
|
188
|
+
* See also https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams
|
|
189
|
+
*/
|
|
190
|
+
private makeIV;
|
|
191
|
+
private getUnencryptedBytes;
|
|
192
|
+
/**
|
|
193
|
+
* Logs a NALU processing fallback at most once per (participant, trackId, payloadType) tuple,
|
|
194
|
+
* so a persistent bad state doesn't flood the console (Firefox doesn't filter debug).
|
|
195
|
+
*/
|
|
196
|
+
private logNALUFallbackOnce;
|
|
197
|
+
/**
|
|
198
|
+
* inspects frame mimetype if available. falls back to payloadtype and maps it to the codec specified in rtpMap
|
|
199
|
+
*/
|
|
200
|
+
private getVideoCodec;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* we use a magic frame trailer to detect whether a frame is injected
|
|
204
|
+
* by the livekit server and thus to be treated as unencrypted
|
|
205
|
+
* @internal
|
|
206
|
+
*/
|
|
207
|
+
export declare function isFrameServerInjected(frameData: ArrayBuffer, trailerBytes: NonSharedUint8Array): boolean;
|
|
208
|
+
export {};
|
|
209
|
+
//# sourceMappingURL=FrameCryptor.d.ts.map
|
|
@@ -1,84 +1,81 @@
|
|
|
1
|
-
import type TypedEventEmitter from 'typed-emitter';
|
|
2
|
-
import type { ParticipantKeyHandlerCallbacks } from '../events';
|
|
3
|
-
import type { KeyProviderOptions, KeySet, RatchetResult } from '../types';
|
|
4
|
-
declare const ParticipantKeyHandler_base: new () => TypedEventEmitter<ParticipantKeyHandlerCallbacks>;
|
|
5
|
-
/**
|
|
6
|
-
* ParticipantKeyHandler is responsible for providing a cryptor instance with the
|
|
7
|
-
* en-/decryption key of a participant. It assumes that all tracks of a specific participant
|
|
8
|
-
* are encrypted with the same key.
|
|
9
|
-
* Additionally it exposes a method to ratchet a key which can be used by the cryptor either automatically
|
|
10
|
-
* if decryption fails or can be triggered manually on both sender and receiver side.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export declare class ParticipantKeyHandler extends ParticipantKeyHandler_base {
|
|
14
|
-
private currentKeyIndex;
|
|
15
|
-
private cryptoKeyRing;
|
|
16
|
-
private decryptionFailureCounts;
|
|
17
|
-
private ratchetPromiseMap;
|
|
18
|
-
readonly participantIdentity: string;
|
|
19
|
-
/** @internal */
|
|
20
|
-
readonly keyProviderOptions: KeyProviderOptions;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
export {};
|
|
84
|
-
//# sourceMappingURL=ParticipantKeyHandler.d.ts.map
|
|
1
|
+
import type TypedEventEmitter from 'typed-emitter';
|
|
2
|
+
import type { ParticipantKeyHandlerCallbacks } from '../events';
|
|
3
|
+
import type { KeyProviderOptions, KeySet, RatchetResult } from '../types';
|
|
4
|
+
declare const ParticipantKeyHandler_base: new () => TypedEventEmitter<ParticipantKeyHandlerCallbacks>;
|
|
5
|
+
/**
|
|
6
|
+
* ParticipantKeyHandler is responsible for providing a cryptor instance with the
|
|
7
|
+
* en-/decryption key of a participant. It assumes that all tracks of a specific participant
|
|
8
|
+
* are encrypted with the same key.
|
|
9
|
+
* Additionally it exposes a method to ratchet a key which can be used by the cryptor either automatically
|
|
10
|
+
* if decryption fails or can be triggered manually on both sender and receiver side.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare class ParticipantKeyHandler extends ParticipantKeyHandler_base {
|
|
14
|
+
private currentKeyIndex;
|
|
15
|
+
private cryptoKeyRing;
|
|
16
|
+
private decryptionFailureCounts;
|
|
17
|
+
private ratchetPromiseMap;
|
|
18
|
+
readonly participantIdentity: string;
|
|
19
|
+
/** @internal */
|
|
20
|
+
readonly keyProviderOptions: KeyProviderOptions;
|
|
21
|
+
get hasValidKey(): boolean;
|
|
22
|
+
constructor(participantIdentity: string, keyProviderOptions: KeyProviderOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Returns true if the key at the given index is marked as invalid.
|
|
25
|
+
*
|
|
26
|
+
* @param keyIndex the index of the key
|
|
27
|
+
*/
|
|
28
|
+
hasInvalidKeyAtIndex(keyIndex: number): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Informs the key handler that a decryption failure occurred for an encryption key.
|
|
31
|
+
* @internal
|
|
32
|
+
* @param keyIndex the key index for which the failure occurred. Defaults to the current key index.
|
|
33
|
+
*/
|
|
34
|
+
decryptionFailure(keyIndex?: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Informs the key handler that a frame was successfully decrypted using an encryption key.
|
|
37
|
+
* @internal
|
|
38
|
+
* @param keyIndex the key index for which the success occurred. Defaults to the current key index.
|
|
39
|
+
*/
|
|
40
|
+
decryptionSuccess(keyIndex?: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* Call this after user initiated ratchet or a new key has been set in order to make sure to mark potentially
|
|
43
|
+
* invalid keys as valid again
|
|
44
|
+
*
|
|
45
|
+
* @param keyIndex the index of the key. Defaults to the current key index.
|
|
46
|
+
*/
|
|
47
|
+
resetKeyStatus(keyIndex?: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Ratchets the current key (or the one at keyIndex if provided) and
|
|
50
|
+
* returns the ratcheted material
|
|
51
|
+
* if `setKey` is true (default), it will also set the ratcheted key directly on the crypto key ring
|
|
52
|
+
* @param keyIndex
|
|
53
|
+
* @param setKey
|
|
54
|
+
*/
|
|
55
|
+
ratchetKey(keyIndex?: number, setKey?: boolean): Promise<RatchetResult>;
|
|
56
|
+
/**
|
|
57
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
|
58
|
+
* and derives encryption keys from the material and sets it on the key ring buffer
|
|
59
|
+
* together with the material
|
|
60
|
+
* also resets the valid key property and updates the currentKeyIndex
|
|
61
|
+
*/
|
|
62
|
+
setKey(material: CryptoKey, keyIndex?: number, updateCurrentKeyIndex?: boolean): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
|
65
|
+
* and derives encryption keys from the material and sets it on the key ring buffers
|
|
66
|
+
* together with the material
|
|
67
|
+
* also updates the currentKeyIndex
|
|
68
|
+
*/
|
|
69
|
+
setKeyFromMaterial(material: CryptoKey, keyIndex: number, ratchetedResult?: RatchetResult | null, updateCurrentKeyIndex?: boolean): Promise<void>;
|
|
70
|
+
setKeySet(keySet: KeySet, keyIndex: number, ratchetedResult?: RatchetResult | null): void;
|
|
71
|
+
setCurrentKeyIndex(index: number): Promise<void>;
|
|
72
|
+
getCurrentKeyIndex(): number;
|
|
73
|
+
/**
|
|
74
|
+
* returns currently used KeySet or the one at `keyIndex` if provided
|
|
75
|
+
* @param keyIndex
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
getKeySet(keyIndex?: number): KeySet | undefined;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=ParticipantKeyHandler.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=e2ee.worker.d.ts.map
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=e2ee.worker.d.ts.map
|