livekit-client 2.15.7 → 2.15.8
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/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 +253 -118
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +1882 -138
- 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/connectionHelper/checks/publishVideo.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts +16 -2
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +35 -1
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/utils.d.ts +2 -0
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/DataCryptor.d.ts +15 -0
- package/dist/src/e2ee/worker/DataCryptor.d.ts.map +1 -0
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +3 -2
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/e2ee/worker/sifPayload.d.ts +6 -6
- package/dist/src/e2ee/worker/sifPayload.d.ts.map +1 -1
- package/dist/src/index.d.ts +5 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logger.d.ts +1 -0
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/options.d.ts +4 -2
- package/dist/src/options.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +5 -2
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +3 -2
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts +2 -2
- package/dist/src/room/data-stream/incoming/IncomingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +2 -1
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +2 -2
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/token-source/TokenSource.d.ts +70 -0
- package/dist/src/room/token-source/TokenSource.d.ts.map +1 -0
- package/dist/src/room/token-source/types.d.ts +68 -0
- package/dist/src/room/token-source/types.d.ts.map +1 -0
- package/dist/src/room/token-source/utils.d.ts +5 -0
- package/dist/src/room/token-source/utils.d.ts.map +1 -0
- package/dist/src/room/track/LocalTrack.d.ts +1 -1
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +7 -3
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/types.d.ts +1 -0
- package/dist/src/room/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +2 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/src/utils/camelToSnakeCase.d.ts +8 -0
- package/dist/src/utils/camelToSnakeCase.d.ts.map +1 -0
- package/dist/ts4.2/{src/e2ee → e2ee}/E2eeManager.d.ts +16 -2
- package/dist/ts4.2/{src/e2ee → e2ee}/types.d.ts +35 -1
- package/dist/ts4.2/{src/e2ee → e2ee}/utils.d.ts +3 -0
- package/dist/ts4.2/e2ee/worker/DataCryptor.d.ts +15 -0
- package/dist/ts4.2/{src/e2ee → e2ee}/worker/ParticipantKeyHandler.d.ts +3 -2
- package/dist/ts4.2/{src/e2ee → e2ee}/worker/sifPayload.d.ts +6 -6
- package/dist/ts4.2/{src/index.d.ts → index.d.ts} +5 -3
- package/dist/ts4.2/{src/logger.d.ts → logger.d.ts} +1 -0
- package/dist/ts4.2/{src/options.d.ts → options.d.ts} +4 -2
- package/dist/ts4.2/{src/room → room}/RTCEngine.d.ts +5 -2
- package/dist/ts4.2/{src/room → room}/Room.d.ts +3 -2
- package/dist/ts4.2/{src/room → room}/data-stream/incoming/IncomingDataStreamManager.d.ts +2 -1
- package/dist/ts4.2/{src/room → room}/errors.d.ts +2 -1
- package/dist/ts4.2/{src/room → room}/participant/Participant.d.ts +2 -2
- package/dist/ts4.2/room/token-source/TokenSource.d.ts +71 -0
- package/dist/ts4.2/room/token-source/types.d.ts +68 -0
- package/dist/ts4.2/room/token-source/utils.d.ts +5 -0
- package/dist/ts4.2/{src/room → room}/track/LocalTrack.d.ts +1 -1
- package/dist/ts4.2/{src/room → room}/track/options.d.ts +10 -3
- package/dist/ts4.2/{src/room → room}/types.d.ts +1 -0
- package/dist/ts4.2/{src/room → room}/utils.d.ts +2 -1
- package/dist/ts4.2/utils/camelToSnakeCase.d.ts +8 -0
- package/package.json +11 -10
- package/src/connectionHelper/checks/publishVideo.ts +5 -0
- package/src/e2ee/E2eeManager.ts +94 -2
- package/src/e2ee/types.ts +44 -1
- package/src/e2ee/utils.ts +16 -0
- package/src/e2ee/worker/DataCryptor.test.ts +271 -0
- package/src/e2ee/worker/DataCryptor.ts +147 -0
- package/src/e2ee/worker/ParticipantKeyHandler.ts +4 -3
- package/src/e2ee/worker/e2ee.worker.ts +47 -0
- package/src/e2ee/worker/sifPayload.ts +10 -6
- package/src/index.ts +14 -1
- package/src/logger.ts +1 -0
- package/src/options.ts +8 -2
- package/src/room/RTCEngine.ts +55 -6
- package/src/room/Room.ts +38 -16
- package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +64 -17
- package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +7 -0
- package/src/room/errors.ts +3 -0
- package/src/room/participant/LocalParticipant.ts +8 -6
- package/src/room/participant/Participant.ts +6 -1
- package/src/room/token-source/TokenSource.ts +285 -0
- package/src/room/token-source/types.ts +84 -0
- package/src/room/token-source/utils.ts +35 -0
- package/src/room/track/LocalAudioTrack.ts +1 -1
- package/src/room/track/LocalTrack.ts +1 -1
- package/src/room/track/options.ts +12 -4
- package/src/room/track/utils.ts +10 -2
- package/src/room/types.ts +1 -0
- package/src/room/utils.ts +8 -4
- package/src/utils/camelToSnakeCase.ts +16 -0
- /package/dist/ts4.2/{src/api → api}/SignalClient.d.ts +0 -0
- /package/dist/ts4.2/{src/api → api}/utils.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/ConnectionCheck.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/Checker.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/cloudRegion.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/connectionProtocol.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/publishAudio.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/publishVideo.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/reconnect.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/turn.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/webrtc.d.ts +0 -0
- /package/dist/ts4.2/{src/connectionHelper → connectionHelper}/checks/websocket.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/KeyProvider.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/constants.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/errors.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/events.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/index.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/worker/FrameCryptor.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/worker/e2ee.worker.d.ts +0 -0
- /package/dist/ts4.2/{src/e2ee → e2ee}/worker/naluUtils.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/DefaultReconnectPolicy.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/DeviceManager.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/PCTransport.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/PCTransportManager.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/ReconnectPolicy.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/RegionUrlProvider.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/attribute-typings.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/data-stream/incoming/StreamReader.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/data-stream/outgoing/OutgoingDataStreamManager.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/data-stream/outgoing/StreamWriter.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/defaults.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/events.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/participant/LocalParticipant.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/participant/ParticipantTrackPermission.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/participant/RemoteParticipant.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/participant/publishUtils.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/rpc.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/stats.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/timers.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/LocalAudioTrack.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/LocalTrackPublication.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/LocalVideoTrack.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/RemoteAudioTrack.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/RemoteTrack.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/RemoteTrackPublication.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/RemoteVideoTrack.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/Track.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/TrackPublication.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/create.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/facingMode.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/processor/types.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/record.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/types.d.ts +0 -0
- /package/dist/ts4.2/{src/room → room}/track/utils.d.ts +0 -0
- /package/dist/ts4.2/{src/test → test}/MockMediaStreamTrack.d.ts +0 -0
- /package/dist/ts4.2/{src/test → test}/mocks.d.ts +0 -0
- /package/dist/ts4.2/{src/utils → utils}/AsyncQueue.d.ts +0 -0
- /package/dist/ts4.2/{src/utils → utils}/browserParser.d.ts +0 -0
- /package/dist/ts4.2/{src/utils → utils}/cloneDeep.d.ts +0 -0
- /package/dist/ts4.2/{src/utils → utils}/dataPacketBuffer.d.ts +0 -0
- /package/dist/ts4.2/{src/utils → utils}/ttlmap.d.ts +0 -0
- /package/dist/ts4.2/{src/version.d.ts → version.d.ts} +0 -0
@@ -52,7 +52,8 @@ export declare enum DataStreamErrorReason {
|
|
52
52
|
DecodeFailed = 2,
|
53
53
|
LengthExceeded = 3,
|
54
54
|
Incomplete = 4,
|
55
|
-
HandlerAlreadyRegistered = 7
|
55
|
+
HandlerAlreadyRegistered = 7,
|
56
|
+
EncryptionTypeMismatch = 8
|
56
57
|
}
|
57
58
|
export declare class DataStreamError extends LivekitError {
|
58
59
|
reason: DataStreamErrorReason;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { SipDTMF } from '@livekit/protocol';
|
2
|
-
import { DataPacket_Kind, ParticipantInfo, ParticipantInfo_Kind as ParticipantKind, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '@livekit/protocol';
|
2
|
+
import { DataPacket_Kind, Encryption_Type, ParticipantInfo, ParticipantInfo_Kind as ParticipantKind, ParticipantPermission, ConnectionQuality as ProtoQuality, SubscriptionError } from '@livekit/protocol';
|
3
3
|
import type TypedEmitter from 'typed-emitter';
|
4
4
|
import type { StructuredLogger } from '../../logger';
|
5
5
|
import type LocalTrackPublication from '../track/LocalTrackPublication';
|
@@ -124,7 +124,7 @@ export type ParticipantEventCallbacks = {
|
|
124
124
|
localSenderCreated: (sender: RTCRtpSender, track: Track) => void;
|
125
125
|
participantMetadataChanged: (prevMetadata: string | undefined, participant?: any) => void;
|
126
126
|
participantNameChanged: (name: string) => void;
|
127
|
-
dataReceived: (payload: Uint8Array, kind: DataPacket_Kind) => void;
|
127
|
+
dataReceived: (payload: Uint8Array, kind: DataPacket_Kind, encryptionType?: Encryption_Type) => void;
|
128
128
|
sipDTMFReceived: (dtmf: SipDTMF) => void;
|
129
129
|
transcriptionReceived: (transcription: TranscriptionSegment[], publication?: TrackPublication) => void;
|
130
130
|
isSpeakingChanged: (speaking: boolean) => void;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import { TokenSourceResponse } from '@livekit/protocol';
|
2
|
+
import type { TokenSourceFetchOptions, TokenSourceResponseObject } from './types';
|
3
|
+
import { TokenSourceConfigurable, TokenSourceFixed } from './types';
|
4
|
+
/** A TokenSourceCached is a TokenSource which caches the last {@link TokenSourceResponseObject} value and returns it
|
5
|
+
* until a) it expires or b) the {@link TokenSourceFetchOptions} provided to .fetch(...) change. */
|
6
|
+
declare abstract class TokenSourceCached extends TokenSourceConfigurable {
|
7
|
+
private cachedFetchOptions;
|
8
|
+
private cachedResponse;
|
9
|
+
private fetchMutex;
|
10
|
+
private isSameAsCachedFetchOptions;
|
11
|
+
private shouldReturnCachedValueFromFetch;
|
12
|
+
getCachedResponseJwtPayload(): import("./types").TokenPayload | null;
|
13
|
+
fetch(options: TokenSourceFetchOptions): Promise<TokenSourceResponseObject>;
|
14
|
+
protected abstract update(options: TokenSourceFetchOptions): Promise<TokenSourceResponse>;
|
15
|
+
}
|
16
|
+
type LiteralOrFn = TokenSourceResponseObject | (() => TokenSourceResponseObject | Promise<TokenSourceResponseObject>);
|
17
|
+
export declare class TokenSourceLiteral extends TokenSourceFixed {
|
18
|
+
private literalOrFn;
|
19
|
+
constructor(literalOrFn: LiteralOrFn);
|
20
|
+
fetch(): Promise<TokenSourceResponseObject>;
|
21
|
+
}
|
22
|
+
type CustomFn = (options: TokenSourceFetchOptions) => TokenSourceResponseObject | Promise<TokenSourceResponseObject>;
|
23
|
+
export declare class TokenSourceCustom extends TokenSourceCached {
|
24
|
+
private customFn;
|
25
|
+
constructor(customFn: CustomFn);
|
26
|
+
protected update(options: TokenSourceFetchOptions): Promise<TokenSourceResponse>;
|
27
|
+
}
|
28
|
+
export type EndpointOptions = Omit<RequestInit, 'body'>;
|
29
|
+
export declare class TokenSourceEndpoint extends TokenSourceCached {
|
30
|
+
private url;
|
31
|
+
private endpointOptions;
|
32
|
+
constructor(url: string, options?: EndpointOptions);
|
33
|
+
private createRequestFromOptions;
|
34
|
+
protected update(options: TokenSourceFetchOptions): Promise<TokenSourceResponse>;
|
35
|
+
}
|
36
|
+
export type SandboxTokenServerOptions = {
|
37
|
+
baseUrl?: string;
|
38
|
+
};
|
39
|
+
export declare class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
|
40
|
+
constructor(sandboxId: string, options: SandboxTokenServerOptions);
|
41
|
+
}
|
42
|
+
export declare const TokenSource: {
|
43
|
+
/** TokenSource.literal contains a single, literal set of {@link TokenSourceResponseObject}
|
44
|
+
* credentials, either provided directly or returned from a provided function. */
|
45
|
+
literal(literalOrFn: LiteralOrFn): TokenSourceLiteral;
|
46
|
+
/**
|
47
|
+
* TokenSource.custom allows a user to define a manual function which generates new
|
48
|
+
* {@link TokenSourceResponseObject} values on demand.
|
49
|
+
*
|
50
|
+
* Use this to get credentials from custom backends / etc.
|
51
|
+
*/
|
52
|
+
custom(customFn: CustomFn): TokenSourceCustom;
|
53
|
+
/**
|
54
|
+
* TokenSource.endpoint creates a token source that fetches credentials from a given URL using
|
55
|
+
* the standard endpoint format:
|
56
|
+
* FIXME: add docs link here in the future!
|
57
|
+
*/
|
58
|
+
endpoint(url: string, options?: EndpointOptions): TokenSourceEndpoint;
|
59
|
+
/**
|
60
|
+
* TokenSource.sandboxTokenServer queries a sandbox token server for credentials,
|
61
|
+
* which supports quick prototyping / getting started types of use cases.
|
62
|
+
*
|
63
|
+
* This token provider is INSECURE and should NOT be used in production.
|
64
|
+
*
|
65
|
+
* For more info:
|
66
|
+
* @see https://cloud.livekit.io/projects/p_/sandbox/templates/token-server
|
67
|
+
*/
|
68
|
+
sandboxTokenServer(sandboxId: string, options?: SandboxTokenServerOptions): TokenSourceSandboxTokenServer;
|
69
|
+
};
|
70
|
+
export {};
|
71
|
+
//# sourceMappingURL=TokenSource.d.ts.map
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { RoomConfiguration, TokenSourceRequest, TokenSourceResponse } from '@livekit/protocol';
|
2
|
+
import type { JWTPayload } from 'jose';
|
3
|
+
import type { ValueToSnakeCase } from '../../utils/camelToSnakeCase';
|
4
|
+
export type TokenSourceRequestObject = Required<NonNullable<ConstructorParameters<typeof TokenSourceRequest>[0]>>;
|
5
|
+
export type TokenSourceResponseObject = Required<NonNullable<ConstructorParameters<typeof TokenSourceResponse>[0]>>;
|
6
|
+
/** The `TokenSource` request object sent to the server as part of fetching a configurable
|
7
|
+
* `TokenSource` like {@link TokenSourceEndpoint}.
|
8
|
+
*
|
9
|
+
* Use this as a type for your request body if implementing a server endpoint in node.js.
|
10
|
+
*/
|
11
|
+
export type TokenSourceRequestPayload = ValueToSnakeCase<TokenSourceRequestObject>;
|
12
|
+
/** The `TokenSource` response object sent from the server as part of fetching a configurable
|
13
|
+
* `TokenSource` like {@link TokenSourceEndpoint}.
|
14
|
+
*
|
15
|
+
* Use this as a type for your response body if implementing a server endpoint in node.js.
|
16
|
+
*/
|
17
|
+
export type TokenSourceResponsePayload = ValueToSnakeCase<TokenSourceResponseObject>;
|
18
|
+
/** The payload of a LiveKit JWT token. */
|
19
|
+
export type TokenPayload = JWTPayload & {
|
20
|
+
name?: string;
|
21
|
+
metadata?: string;
|
22
|
+
attributes?: Record<string, string>;
|
23
|
+
video?: {
|
24
|
+
room?: string;
|
25
|
+
roomJoin?: boolean;
|
26
|
+
canPublish?: boolean;
|
27
|
+
canPublishData?: boolean;
|
28
|
+
canSubscribe?: boolean;
|
29
|
+
};
|
30
|
+
roomConfig?: RoomConfigurationObject;
|
31
|
+
};
|
32
|
+
export type RoomConfigurationObject = NonNullable<ConstructorParameters<typeof RoomConfiguration>[0]>;
|
33
|
+
/** A Fixed TokenSource is a token source that takes no parameters and returns a completely
|
34
|
+
* independently derived value on each fetch() call.
|
35
|
+
*
|
36
|
+
* The most common downstream implementer is {@link TokenSourceLiteral}.
|
37
|
+
*/
|
38
|
+
export declare abstract class TokenSourceFixed {
|
39
|
+
abstract fetch(): Promise<TokenSourceResponseObject>;
|
40
|
+
}
|
41
|
+
export type TokenSourceFetchOptions = {
|
42
|
+
roomName?: string;
|
43
|
+
participantName?: string;
|
44
|
+
participantIdentity?: string;
|
45
|
+
participantMetadata?: string;
|
46
|
+
participantAttributes?: {
|
47
|
+
[key: string]: string;
|
48
|
+
};
|
49
|
+
agentName?: string;
|
50
|
+
agentMetadata?: string;
|
51
|
+
};
|
52
|
+
/** A Configurable TokenSource is a token source that takes a
|
53
|
+
* {@link TokenSourceFetchOptions} object as input and returns a deterministic
|
54
|
+
* {@link TokenSourceResponseObject} output based on the options specified.
|
55
|
+
*
|
56
|
+
* For example, if options.participantName is set, it should be expected that
|
57
|
+
* all tokens that are generated will have participant name field set to the
|
58
|
+
* provided value.
|
59
|
+
*
|
60
|
+
* A few common downstream implementers are {@link TokenSourceEndpoint}
|
61
|
+
* and {@link TokenSourceCustom}.
|
62
|
+
*/
|
63
|
+
export declare abstract class TokenSourceConfigurable {
|
64
|
+
abstract fetch(options: TokenSourceFetchOptions): Promise<TokenSourceResponseObject>;
|
65
|
+
}
|
66
|
+
/** A TokenSource is a mechanism for fetching credentials required to connect to a LiveKit Room. */
|
67
|
+
export type TokenSourceBase = TokenSourceFixed | TokenSourceConfigurable;
|
68
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { TokenSourceResponse } from '@livekit/protocol';
|
2
|
+
import type { TokenPayload } from './types';
|
3
|
+
export declare function isResponseExpired(response: TokenSourceResponse): boolean;
|
4
|
+
export declare function decodeTokenPayload(token: string): TokenPayload;
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
@@ -114,7 +114,7 @@ export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Ki
|
|
114
114
|
/** @internal */
|
115
115
|
stopPreConnectBuffer(): void;
|
116
116
|
/** @internal */
|
117
|
-
getPreConnectBuffer(): ReadableStream<Uint8Array
|
117
|
+
getPreConnectBuffer(): ReadableStream<Uint8Array> | undefined;
|
118
118
|
getPreConnectBufferMimeType(): string | undefined;
|
119
119
|
protected abstract monitorSender(): void;
|
120
120
|
}
|
@@ -291,7 +291,12 @@ export interface AudioPreset {
|
|
291
291
|
maxBitrate: number;
|
292
292
|
priority?: RTCPriorityType;
|
293
293
|
}
|
294
|
-
declare const
|
294
|
+
export declare const audioCodecs: readonly [
|
295
|
+
"opus",
|
296
|
+
"red"
|
297
|
+
];
|
298
|
+
export type AudioCodec = (typeof audioCodecs)[number];
|
299
|
+
declare const backupVideoCodecs: readonly [
|
295
300
|
"vp8",
|
296
301
|
"h264"
|
297
302
|
];
|
@@ -303,8 +308,10 @@ export declare const videoCodecs: readonly [
|
|
303
308
|
"h265"
|
304
309
|
];
|
305
310
|
export type VideoCodec = (typeof videoCodecs)[number];
|
306
|
-
export type BackupVideoCodec = (typeof
|
307
|
-
export declare function
|
311
|
+
export type BackupVideoCodec = (typeof backupVideoCodecs)[number];
|
312
|
+
export declare function isBackupVideoCodec(codec: string): codec is BackupVideoCodec;
|
313
|
+
/** @deprecated Use {@link isBackupVideoCodec} instead */
|
314
|
+
export declare const isBackupCodec: typeof isBackupVideoCodec;
|
308
315
|
export declare enum BackupCodecPolicy {
|
309
316
|
PREFER_REGRESSION = 0,
|
310
317
|
SIMULCAST = 1,
|
@@ -101,6 +101,7 @@ export interface BaseStreamInfo {
|
|
101
101
|
/** total size in bytes for finite streams and undefined for streams of unknown size */
|
102
102
|
size?: number;
|
103
103
|
attributes?: Record<string, string>;
|
104
|
+
encryptionType: Encryption_Type;
|
104
105
|
}
|
105
106
|
export interface ByteStreamInfo extends BaseStreamInfo {
|
106
107
|
name: string;
|
@@ -14,7 +14,7 @@ import type RemoteTrackPublication from './track/RemoteTrackPublication';
|
|
14
14
|
import type RemoteVideoTrack from './track/RemoteVideoTrack';
|
15
15
|
import { Track } from './track/Track';
|
16
16
|
import type { TrackPublication } from './track/TrackPublication';
|
17
|
-
import type { VideoCodec } from './track/options';
|
17
|
+
import type { AudioCodec, VideoCodec } from './track/options';
|
18
18
|
import type { ChatMessage, TranscriptionSegment } from './types';
|
19
19
|
export declare const ddExtensionURI = "https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";
|
20
20
|
export declare function unpackStreamId(packed: string): string[];
|
@@ -106,6 +106,7 @@ export declare function createAudioAnalyser(track: LocalAudioTrack | RemoteAudio
|
|
106
106
|
analyser: AnalyserNode;
|
107
107
|
cleanup: () => Promise<void>;
|
108
108
|
};
|
109
|
+
export declare function isAudioCodec(maybeCodec: string): maybeCodec is AudioCodec;
|
109
110
|
export declare function isVideoCodec(maybeCodec: string): maybeCodec is VideoCodec;
|
110
111
|
export declare function unwrapConstraint(constraint: ConstrainDOMString): string;
|
111
112
|
export declare function unwrapConstraint(constraint: ConstrainULong): number;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export type CamelToSnakeCase<Str extends string> = Str extends `${infer First}${infer Rest}` ? `${First extends Capitalize<First> ? '_' : ''}${Lowercase<First>}${CamelToSnakeCase<Rest>}` : Str;
|
2
|
+
type ArrayValuesToSnakeCase<Item> = Array<ValueToSnakeCase<Item>>;
|
3
|
+
type ObjectKeysToSnakeCase<Obj> = {
|
4
|
+
[Key in keyof Obj as CamelToSnakeCase<string & Key>]: NonNullable<ValueToSnakeCase<Obj[Key]>>;
|
5
|
+
};
|
6
|
+
export type ValueToSnakeCase<Value> = Value extends Array<infer Item> ? ArrayValuesToSnakeCase<Item> : Value extends object ? ObjectKeysToSnakeCase<Value> : Value;
|
7
|
+
export {};
|
8
|
+
//# sourceMappingURL=camelToSnakeCase.d.ts.map
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "livekit-client",
|
3
|
-
"version": "2.15.
|
3
|
+
"version": "2.15.8",
|
4
4
|
"description": "JavaScript/TypeScript client SDK for LiveKit",
|
5
5
|
"main": "./dist/livekit-client.umd.js",
|
6
6
|
"unpkg": "./dist/livekit-client.umd.js",
|
@@ -25,10 +25,10 @@
|
|
25
25
|
"typesVersions": {
|
26
26
|
"<4.8": {
|
27
27
|
"./dist/src/index.d.ts": [
|
28
|
-
"./dist/ts4.2/
|
28
|
+
"./dist/ts4.2/index.d.ts"
|
29
29
|
],
|
30
30
|
"./dist/src/e2ee/worker/e2ee.worker.d.ts": [
|
31
|
-
"./dist/ts4.2/
|
31
|
+
"./dist/ts4.2/e2ee/worker/e2ee.worker.d.ts"
|
32
32
|
]
|
33
33
|
}
|
34
34
|
},
|
@@ -37,8 +37,9 @@
|
|
37
37
|
"license": "Apache-2.0",
|
38
38
|
"dependencies": {
|
39
39
|
"@livekit/mutex": "1.1.1",
|
40
|
-
"@livekit/protocol": "1.
|
40
|
+
"@livekit/protocol": "1.42.0",
|
41
41
|
"events": "^3.3.0",
|
42
|
+
"jose": "^6.1.0",
|
42
43
|
"loglevel": "^1.9.2",
|
43
44
|
"sdp-transform": "^2.15.0",
|
44
45
|
"ts-debounce": "^4.0.0",
|
@@ -50,10 +51,10 @@
|
|
50
51
|
"@types/dom-mediacapture-record": "^1"
|
51
52
|
},
|
52
53
|
"devDependencies": {
|
53
|
-
"@babel/core": "7.28.
|
54
|
+
"@babel/core": "7.28.4",
|
54
55
|
"@babel/preset-env": "7.28.3",
|
55
56
|
"@bufbuild/protoc-gen-es": "^1.10.0",
|
56
|
-
"@changesets/cli": "2.29.
|
57
|
+
"@changesets/cli": "2.29.7",
|
57
58
|
"@livekit/changesets-changelog-github": "^0.0.4",
|
58
59
|
"@rollup/plugin-babel": "6.0.4",
|
59
60
|
"@rollup/plugin-commonjs": "28.0.6",
|
@@ -78,14 +79,14 @@
|
|
78
79
|
"happy-dom": "^17.2.0",
|
79
80
|
"jsdom": "^26.1.0",
|
80
81
|
"prettier": "^3.4.2",
|
81
|
-
"rollup": "4.
|
82
|
+
"rollup": "4.52.3",
|
82
83
|
"rollup-plugin-delete": "^2.1.0",
|
83
84
|
"rollup-plugin-typescript2": "0.36.0",
|
84
85
|
"size-limit": "^11.2.0",
|
85
|
-
"typedoc": "0.28.
|
86
|
+
"typedoc": "0.28.13",
|
86
87
|
"typedoc-plugin-no-inherit": "1.6.1",
|
87
88
|
"typescript": "5.8.3",
|
88
|
-
"vite": "7.1.
|
89
|
+
"vite": "7.1.8",
|
89
90
|
"vitest": "^3.0.0"
|
90
91
|
},
|
91
92
|
"scripts": {
|
@@ -103,7 +104,7 @@
|
|
103
104
|
"format": "prettier --write src examples/**/*.ts",
|
104
105
|
"format:check": "prettier --check src examples/**/*.ts",
|
105
106
|
"ci:publish": "pnpm build:clean && pnpm compat && changeset publish",
|
106
|
-
"downlevel-dts": "downlevel-dts ./dist/ ./dist/ts4.2 --to=4.2",
|
107
|
+
"downlevel-dts": "downlevel-dts ./dist/src ./dist/ts4.2 --to=4.2",
|
107
108
|
"compat": "eslint --no-eslintrc --config ./.eslintrc.dist.cjs ./dist/livekit-client.umd.js",
|
108
109
|
"size-limit": "size-limit"
|
109
110
|
}
|
@@ -46,6 +46,11 @@ export class PublishVideoCheck extends Checker {
|
|
46
46
|
const video = document.createElement('video');
|
47
47
|
video.srcObject = stream;
|
48
48
|
video.muted = true;
|
49
|
+
video.autoplay = true;
|
50
|
+
video.playsInline = true;
|
51
|
+
// For iOS Safari
|
52
|
+
video.setAttribute('playsinline', 'true');
|
53
|
+
document.body.appendChild(video);
|
49
54
|
|
50
55
|
await new Promise<void>((resolve) => {
|
51
56
|
video.onplay = () => {
|
package/src/e2ee/E2eeManager.ts
CHANGED
@@ -11,15 +11,19 @@ import type RemoteTrack from '../room/track/RemoteTrack';
|
|
11
11
|
import type { Track } from '../room/track/Track';
|
12
12
|
import type { VideoCodec } from '../room/track/options';
|
13
13
|
import { mimeTypeToVideoCodecString } from '../room/track/utils';
|
14
|
-
import { isLocalTrack, isSafariBased, isVideoTrack } from '../room/utils';
|
14
|
+
import { Future, isLocalTrack, isSafariBased, isVideoTrack } from '../room/utils';
|
15
15
|
import type { BaseKeyProvider } from './KeyProvider';
|
16
16
|
import { E2EE_FLAG } from './constants';
|
17
17
|
import { type E2EEManagerCallbacks, EncryptionEvent, KeyProviderEvent } from './events';
|
18
18
|
import type {
|
19
|
+
DecryptDataRequestMessage,
|
20
|
+
DecryptDataResponseMessage,
|
19
21
|
E2EEManagerOptions,
|
20
22
|
E2EEWorkerMessage,
|
21
23
|
EnableMessage,
|
22
24
|
EncodeMessage,
|
25
|
+
EncryptDataRequestMessage,
|
26
|
+
EncryptDataResponseMessage,
|
23
27
|
InitMessage,
|
24
28
|
KeyInfo,
|
25
29
|
RTPVideoMapMessage,
|
@@ -35,8 +39,17 @@ import { isE2EESupported, isScriptTransformSupported } from './utils';
|
|
35
39
|
export interface BaseE2EEManager {
|
36
40
|
setup(room: Room): void;
|
37
41
|
setupEngine(engine: RTCEngine): void;
|
42
|
+
isEnabled: boolean;
|
43
|
+
isDataChannelEncryptionEnabled: boolean;
|
38
44
|
setParticipantCryptorEnabled(enabled: boolean, participantIdentity: string): void;
|
39
45
|
setSifTrailer(trailer: Uint8Array): void;
|
46
|
+
encryptData(data: Uint8Array): Promise<EncryptDataResponseMessage['data']>;
|
47
|
+
handleEncryptedData(
|
48
|
+
payload: Uint8Array,
|
49
|
+
iv: Uint8Array,
|
50
|
+
participantIdentity: string,
|
51
|
+
keyIndex: number,
|
52
|
+
): Promise<DecryptDataResponseMessage['data']>;
|
40
53
|
on<E extends keyof E2EEManagerCallbacks>(event: E, listener: E2EEManagerCallbacks[E]): this;
|
41
54
|
}
|
42
55
|
|
@@ -55,11 +68,26 @@ export class E2EEManager
|
|
55
68
|
|
56
69
|
private keyProvider: BaseKeyProvider;
|
57
70
|
|
58
|
-
|
71
|
+
private decryptDataRequests: Map<string, Future<DecryptDataResponseMessage['data']>> = new Map();
|
72
|
+
|
73
|
+
private encryptDataRequests: Map<string, Future<EncryptDataResponseMessage['data']>> = new Map();
|
74
|
+
|
75
|
+
private dataChannelEncryptionEnabled: boolean;
|
76
|
+
|
77
|
+
constructor(options: E2EEManagerOptions, dcEncryptionEnabled: boolean) {
|
59
78
|
super();
|
60
79
|
this.keyProvider = options.keyProvider;
|
61
80
|
this.worker = options.worker;
|
62
81
|
this.encryptionEnabled = false;
|
82
|
+
this.dataChannelEncryptionEnabled = dcEncryptionEnabled;
|
83
|
+
}
|
84
|
+
|
85
|
+
get isEnabled(): boolean {
|
86
|
+
return this.encryptionEnabled;
|
87
|
+
}
|
88
|
+
|
89
|
+
get isDataChannelEncryptionEnabled(): boolean {
|
90
|
+
return this.isEnabled && this.dataChannelEncryptionEnabled;
|
63
91
|
}
|
64
92
|
|
65
93
|
/**
|
@@ -160,6 +188,19 @@ export class E2EEManager
|
|
160
188
|
data.keyIndex,
|
161
189
|
);
|
162
190
|
break;
|
191
|
+
|
192
|
+
case 'decryptDataResponse':
|
193
|
+
const decryptFuture = this.decryptDataRequests.get(data.uuid);
|
194
|
+
if (decryptFuture?.resolve) {
|
195
|
+
decryptFuture.resolve(data);
|
196
|
+
}
|
197
|
+
break;
|
198
|
+
case 'encryptDataResponse':
|
199
|
+
const encryptFuture = this.encryptDataRequests.get(data.uuid);
|
200
|
+
if (encryptFuture?.resolve) {
|
201
|
+
encryptFuture.resolve(data as EncryptDataResponseMessage['data']);
|
202
|
+
}
|
203
|
+
break;
|
163
204
|
default:
|
164
205
|
break;
|
165
206
|
}
|
@@ -250,6 +291,57 @@ export class E2EEManager
|
|
250
291
|
);
|
251
292
|
}
|
252
293
|
|
294
|
+
async encryptData(data: Uint8Array): Promise<EncryptDataResponseMessage['data']> {
|
295
|
+
if (!this.worker) {
|
296
|
+
throw Error('could not encrypt data, worker is missing');
|
297
|
+
}
|
298
|
+
const uuid = crypto.randomUUID();
|
299
|
+
const msg: EncryptDataRequestMessage = {
|
300
|
+
kind: 'encryptDataRequest',
|
301
|
+
data: {
|
302
|
+
uuid,
|
303
|
+
payload: data,
|
304
|
+
participantIdentity: this.room!.localParticipant.identity,
|
305
|
+
},
|
306
|
+
};
|
307
|
+
const future = new Future<EncryptDataResponseMessage['data']>();
|
308
|
+
future.onFinally = () => {
|
309
|
+
this.encryptDataRequests.delete(uuid);
|
310
|
+
};
|
311
|
+
this.encryptDataRequests.set(uuid, future);
|
312
|
+
this.worker.postMessage(msg);
|
313
|
+
return future!.promise!;
|
314
|
+
}
|
315
|
+
|
316
|
+
handleEncryptedData(
|
317
|
+
payload: Uint8Array,
|
318
|
+
iv: Uint8Array,
|
319
|
+
participantIdentity: string,
|
320
|
+
keyIndex: number,
|
321
|
+
) {
|
322
|
+
if (!this.worker) {
|
323
|
+
throw Error('could not handle encrypted data, worker is missing');
|
324
|
+
}
|
325
|
+
const uuid = crypto.randomUUID();
|
326
|
+
const msg: DecryptDataRequestMessage = {
|
327
|
+
kind: 'decryptDataRequest',
|
328
|
+
data: {
|
329
|
+
uuid,
|
330
|
+
payload,
|
331
|
+
iv,
|
332
|
+
participantIdentity,
|
333
|
+
keyIndex,
|
334
|
+
},
|
335
|
+
};
|
336
|
+
const future = new Future<DecryptDataResponseMessage['data']>();
|
337
|
+
future.onFinally = () => {
|
338
|
+
this.decryptDataRequests.delete(uuid);
|
339
|
+
};
|
340
|
+
this.decryptDataRequests.set(uuid, future);
|
341
|
+
this.worker.postMessage(msg);
|
342
|
+
return future.promise;
|
343
|
+
}
|
344
|
+
|
253
345
|
private postRatchetRequest(participantIdentity?: string, keyIndex?: number) {
|
254
346
|
if (!this.worker) {
|
255
347
|
throw Error('could not ratchet key, worker is missing');
|
package/src/e2ee/types.ts
CHANGED
@@ -109,6 +109,44 @@ export interface InitAck extends BaseMessage {
|
|
109
109
|
};
|
110
110
|
}
|
111
111
|
|
112
|
+
export interface DecryptDataRequestMessage extends BaseMessage {
|
113
|
+
kind: 'decryptDataRequest';
|
114
|
+
data: {
|
115
|
+
uuid: string;
|
116
|
+
payload: Uint8Array;
|
117
|
+
iv: Uint8Array;
|
118
|
+
participantIdentity: string;
|
119
|
+
keyIndex: number;
|
120
|
+
};
|
121
|
+
}
|
122
|
+
|
123
|
+
export interface DecryptDataResponseMessage extends BaseMessage {
|
124
|
+
kind: 'decryptDataResponse';
|
125
|
+
data: {
|
126
|
+
uuid: string;
|
127
|
+
payload: Uint8Array;
|
128
|
+
};
|
129
|
+
}
|
130
|
+
|
131
|
+
export interface EncryptDataRequestMessage extends BaseMessage {
|
132
|
+
kind: 'encryptDataRequest';
|
133
|
+
data: {
|
134
|
+
uuid: string;
|
135
|
+
payload: Uint8Array;
|
136
|
+
participantIdentity: string;
|
137
|
+
};
|
138
|
+
}
|
139
|
+
|
140
|
+
export interface EncryptDataResponseMessage extends BaseMessage {
|
141
|
+
kind: 'encryptDataResponse';
|
142
|
+
data: {
|
143
|
+
uuid: string;
|
144
|
+
payload: Uint8Array;
|
145
|
+
iv: Uint8Array;
|
146
|
+
keyIndex: number;
|
147
|
+
};
|
148
|
+
}
|
149
|
+
|
112
150
|
export type E2EEWorkerMessage =
|
113
151
|
| InitMessage
|
114
152
|
| SetKeyMessage
|
@@ -121,7 +159,11 @@ export type E2EEWorkerMessage =
|
|
121
159
|
| RatchetRequestMessage
|
122
160
|
| RatchetMessage
|
123
161
|
| SifTrailerMessage
|
124
|
-
| InitAck
|
162
|
+
| InitAck
|
163
|
+
| DecryptDataRequestMessage
|
164
|
+
| DecryptDataResponseMessage
|
165
|
+
| EncryptDataRequestMessage
|
166
|
+
| EncryptDataResponseMessage;
|
125
167
|
|
126
168
|
export type KeySet = { material: CryptoKey; encryptionKey: CryptoKey };
|
127
169
|
|
@@ -150,6 +192,7 @@ export type E2EEManagerOptions = {
|
|
150
192
|
keyProvider: BaseKeyProvider;
|
151
193
|
worker: Worker;
|
152
194
|
};
|
195
|
+
|
153
196
|
export type E2EEOptions =
|
154
197
|
| E2EEManagerOptions
|
155
198
|
| {
|
package/src/e2ee/utils.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type DataPacket, EncryptedPacketPayload } from '@livekit/protocol';
|
1
2
|
import { ENCRYPTION_ALGORITHM } from './constants';
|
2
3
|
|
3
4
|
export function isE2EESupported() {
|
@@ -176,3 +177,18 @@ export function writeRbsp(data_in: Uint8Array): Uint8Array {
|
|
176
177
|
}
|
177
178
|
return new Uint8Array(dataOut);
|
178
179
|
}
|
180
|
+
|
181
|
+
export function asEncryptablePacket(packet: DataPacket): EncryptedPacketPayload | undefined {
|
182
|
+
if (
|
183
|
+
packet.value?.case !== 'sipDtmf' &&
|
184
|
+
packet.value?.case !== 'metrics' &&
|
185
|
+
packet.value?.case !== 'speaker' &&
|
186
|
+
packet.value?.case !== 'transcription' &&
|
187
|
+
packet.value?.case !== 'encryptedPacket'
|
188
|
+
) {
|
189
|
+
return new EncryptedPacketPayload({
|
190
|
+
value: packet.value,
|
191
|
+
});
|
192
|
+
}
|
193
|
+
return undefined;
|
194
|
+
}
|