@livekit/rtc-node 0.11.0 → 0.12.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/dist/audio_frame.cjs +94 -0
- package/dist/audio_frame.cjs.map +1 -0
- package/dist/audio_frame.js +64 -67
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_resampler.cjs +153 -0
- package/dist/audio_resampler.cjs.map +1 -0
- package/dist/audio_resampler.js +129 -134
- package/dist/audio_resampler.js.map +1 -1
- package/dist/audio_source.cjs +116 -0
- package/dist/audio_source.cjs.map +1 -0
- package/dist/audio_source.js +92 -85
- package/dist/audio_source.js.map +1 -1
- package/dist/audio_stream.cjs +104 -0
- package/dist/audio_stream.cjs.map +1 -0
- package/dist/audio_stream.js +77 -78
- package/dist/audio_stream.js.map +1 -1
- package/dist/e2ee.cjs +268 -0
- package/dist/e2ee.cjs.map +1 -0
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/e2ee.js +244 -221
- package/dist/e2ee.js.map +1 -1
- package/dist/ffi_client.cjs +101 -0
- package/dist/ffi_client.cjs.map +1 -0
- package/dist/ffi_client.js +73 -48
- package/dist/ffi_client.js.map +1 -1
- package/dist/index.cjs +188 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +130 -48
- package/dist/index.js.map +1 -1
- package/dist/napi/native.d.cjs +17 -0
- package/dist/napi/native.d.cjs.map +1 -0
- package/dist/napi/native.d.js +1 -0
- package/dist/napi/native.d.js.map +1 -0
- package/dist/napi/native.d.ts +5 -5
- package/dist/native.cjs +301 -0
- package/dist/native.d.ts +19 -0
- package/dist/native.js +15 -0
- package/dist/participant.cjs +388 -0
- package/dist/participant.cjs.map +1 -0
- package/dist/participant.js +363 -339
- package/dist/participant.js.map +1 -1
- package/dist/proto/audio_frame_pb.cjs +193 -0
- package/dist/proto/audio_frame_pb.cjs.map +1 -0
- package/dist/proto/audio_frame_pb.d.ts +8 -8
- package/dist/proto/audio_frame_pb.d.ts.map +1 -1
- package/dist/proto/audio_frame_pb.js +122 -322
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/e2ee_pb.cjs +131 -0
- package/dist/proto/e2ee_pb.cjs.map +1 -0
- package/dist/proto/e2ee_pb.js +76 -202
- package/dist/proto/e2ee_pb.js.map +1 -1
- package/dist/proto/ffi_pb.cjs +76 -0
- package/dist/proto/ffi_pb.cjs.map +1 -0
- package/dist/proto/ffi_pb.d.ts +6 -6
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +39 -98
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/handle_pb.cjs +33 -0
- package/dist/proto/handle_pb.cjs.map +1 -0
- package/dist/proto/handle_pb.js +6 -22
- package/dist/proto/handle_pb.js.map +1 -1
- package/dist/proto/participant_pb.cjs +50 -0
- package/dist/proto/participant_pb.cjs.map +1 -0
- package/dist/proto/participant_pb.d.ts +1 -1
- package/dist/proto/participant_pb.d.ts.map +1 -1
- package/dist/proto/participant_pb.js +20 -58
- package/dist/proto/participant_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +370 -0
- package/dist/proto/room_pb.cjs.map +1 -0
- package/dist/proto/room_pb.d.ts +16 -16
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +245 -638
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/rpc_pb.cjs +63 -0
- package/dist/proto/rpc_pb.cjs.map +1 -0
- package/dist/proto/rpc_pb.js +26 -72
- package/dist/proto/rpc_pb.js.map +1 -1
- package/dist/proto/stats_pb.cjs +256 -0
- package/dist/proto/stats_pb.cjs.map +1 -0
- package/dist/proto/stats_pb.js +175 -456
- package/dist/proto/stats_pb.js.map +1 -1
- package/dist/proto/track_pb.cjs +116 -0
- package/dist/proto/track_pb.cjs.map +1 -0
- package/dist/proto/track_pb.d.ts +3 -3
- package/dist/proto/track_pb.d.ts.map +1 -1
- package/dist/proto/track_pb.js +68 -174
- package/dist/proto/track_pb.js.map +1 -1
- package/dist/proto/video_frame_pb.cjs +161 -0
- package/dist/proto/video_frame_pb.cjs.map +1 -0
- package/dist/proto/video_frame_pb.d.ts +5 -5
- package/dist/proto/video_frame_pb.d.ts.map +1 -1
- package/dist/proto/video_frame_pb.js +103 -271
- package/dist/proto/video_frame_pb.js.map +1 -1
- package/dist/room.cjs +440 -0
- package/dist/room.cjs.map +1 -0
- package/dist/room.js +384 -373
- package/dist/room.js.map +1 -1
- package/dist/rpc.cjs +89 -0
- package/dist/rpc.cjs.map +1 -0
- package/dist/rpc.js +59 -63
- package/dist/rpc.js.map +1 -1
- package/dist/track.cjs +100 -0
- package/dist/track.cjs.map +1 -0
- package/dist/track.js +66 -62
- package/dist/track.js.map +1 -1
- package/dist/track_publication.cjs +106 -0
- package/dist/track_publication.cjs.map +1 -0
- package/dist/track_publication.js +76 -74
- package/dist/track_publication.js.map +1 -1
- package/dist/transcription.cjs +17 -0
- package/dist/transcription.cjs.map +1 -0
- package/dist/transcription.js +0 -1
- package/dist/transcription.js.map +1 -1
- package/dist/types.cjs +17 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.js +0 -1
- package/dist/types.js.map +1 -1
- package/dist/version.cjs +29 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +4 -1
- package/dist/version.js.map +1 -1
- package/dist/video_frame.cjs +242 -0
- package/dist/video_frame.cjs.map +1 -0
- package/dist/video_frame.js +212 -201
- package/dist/video_frame.js.map +1 -1
- package/dist/video_source.cjs +63 -0
- package/dist/video_source.cjs.map +1 -0
- package/dist/video_source.d.ts.map +1 -1
- package/dist/video_source.js +42 -37
- package/dist/video_source.js.map +1 -1
- package/dist/video_stream.cjs +103 -0
- package/dist/video_stream.cjs.map +1 -0
- package/dist/video_stream.js +76 -77
- package/dist/video_stream.js.map +1 -1
- package/package.json +18 -9
- package/src/audio_frame.ts +2 -2
- package/src/audio_source.ts +2 -2
- package/src/e2ee.ts +2 -2
- package/src/napi/native.d.ts +5 -5
- package/src/proto/audio_frame_pb.ts +12 -12
- package/src/proto/e2ee_pb.ts +1 -1
- package/src/proto/ffi_pb.ts +13 -13
- package/src/proto/handle_pb.ts +1 -1
- package/src/proto/participant_pb.ts +3 -3
- package/src/proto/room_pb.ts +24 -24
- package/src/proto/rpc_pb.ts +1 -1
- package/src/proto/stats_pb.ts +1 -1
- package/src/proto/track_pb.ts +7 -7
- package/src/proto/video_frame_pb.ts +9 -9
- package/src/version.ts +1 -1
- package/src/video_frame.ts +1 -1
- package/src/video_source.ts +5 -1
package/dist/audio_source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/audio_source.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport type { AudioFrame } from './audio_frame.js';\nimport { FfiClient } from './ffi_client.js';\nimport { FfiHandle } from './napi/native.js';\nimport type {\n AudioSourceInfo,\n CaptureAudioFrameCallback,\n CaptureAudioFrameResponse,\n ClearAudioBufferResponse,\n NewAudioSourceResponse,\n} from './proto/audio_frame_pb.js';\nimport {\n AudioSourceType,\n CaptureAudioFrameRequestSchema,\n ClearAudioBufferRequestSchema,\n NewAudioSourceRequestSchema,\n} from './proto/audio_frame_pb.js';\n\nexport class AudioSource {\n /** @internal */\n info: AudioSourceInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n /** @internal */\n lastCapture: number;\n /** @internal */\n currentQueueSize: number;\n /** @internal */\n release = () => {};\n promise = this.newPromise();\n /** @internal */\n timeout?: ReturnType<typeof setTimeout> = undefined;\n\n sampleRate: number;\n numChannels: number;\n queueSize: number;\n\n constructor(sampleRate: number, numChannels: number, queueSize = 1000) {\n this.sampleRate = sampleRate;\n this.numChannels = numChannels;\n this.queueSize = queueSize;\n\n this.lastCapture = 0;\n this.currentQueueSize = 0;\n\n const req = create(NewAudioSourceRequestSchema, {\n type: AudioSourceType.AUDIO_SOURCE_NATIVE,\n sampleRate: sampleRate,\n numChannels: numChannels,\n queueSizeMs: queueSize,\n });\n\n const res = FfiClient.instance.request<NewAudioSourceResponse>({\n message: {\n case: 'newAudioSource',\n value: req,\n },\n });\n\n this.info = res.source!.info!;\n this.ffiHandle = new FfiHandle(res.source!.handle!.id);\n }\n\n get queuedDuration(): number {\n return Math.max(\n this.currentQueueSize - Number(process.hrtime.bigint() / BigInt(1000000)) + this.lastCapture,\n 0,\n );\n }\n\n clearQueue() {\n const req = create(ClearAudioBufferRequestSchema, {\n sourceHandle: this.ffiHandle.handle,\n });\n\n FfiClient.instance.request<ClearAudioBufferResponse>({\n message: {\n case: 'clearAudioBuffer',\n value: req,\n },\n });\n\n this.release();\n }\n\n /** @internal */\n async newPromise() {\n return new Promise<void>((resolve) => {\n this.release = resolve;\n });\n }\n\n async waitForPlayout() {\n return this.promise.then(() => {\n this.lastCapture = 0;\n this.currentQueueSize = 0;\n this.promise = this.newPromise();\n });\n }\n\n async captureFrame(frame: AudioFrame) {\n const now = Number(process.hrtime.bigint() / BigInt(1000000));\n const elapsed = this.lastCapture === 0 ? 0 : now - this.lastCapture;\n const frameDurationMs = (frame.samplesPerChannel / frame.sampleRate) * 1000;\n this.currentQueueSize += frameDurationMs - elapsed;\n\n this.lastCapture = now;\n\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n\n // remove 50ms to account for processing time\n // (e.g. using wait_for_playout for very small chunks)\n this.timeout = setTimeout(this.release, this.currentQueueSize - 50);\n\n const req = create(CaptureAudioFrameRequestSchema, {\n sourceHandle: this.ffiHandle.handle,\n buffer: frame.protoInfo(),\n });\n\n const res = FfiClient.instance.request<CaptureAudioFrameResponse>({\n message: { case: 'captureAudioFrame', value: req },\n });\n\n const cb = await FfiClient.instance.waitFor<CaptureAudioFrameCallback>((ev) => {\n return ev.message.case == 'captureAudioFrame' && ev.message.value.asyncId == res.asyncId;\n });\n\n if (cb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ACjB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,iBAAiB;AACrB,WAAO,KAAK,QAAQ,KAAK,MAAM;AAC7B,WAAK,cAAc;AACnB,WAAK,mBAAmB;AACxB,WAAK,UAAU,KAAK,WAAW;AAAA,IACjC,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,aAAa,OAAmB;AACpC,UAAM,MAAM,OAAO,QAAQ,OAAO,OAAO,IAAI,OAAO,GAAO,CAAC;AAC5D,UAAM,UAAU,KAAK,gBAAgB,IAAI,IAAI,MAAM,KAAK;AACxD,UAAM,kBAAmB,MAAM,oBAAoB,MAAM,aAAc;AACvE,SAAK,oBAAoB,kBAAkB;AAE3C,SAAK,cAAc;AAEnB,QAAI,KAAK,SAAS;AAChB,mBAAa,KAAK,OAAO;AAAA,IAC3B;AAIA,SAAK,UAAU,WAAW,KAAK,SAAS,KAAK,mBAAmB,EAAE;AAElE,UAAM,MAAM,OAAO,gCAAgC;AAAA,MACjD,cAAc,KAAK,UAAU;AAAA,MAC7B,QAAQ,MAAM,UAAU;AAAA,IAC1B,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAmC;AAAA,MAChE,SAAS,EAAE,MAAM,qBAAqB,OAAO,IAAI;AAAA,IACnD,CAAC;AAED,UAAM,KAAK,MAAM,UAAU,SAAS,QAAmC,CAAC,OAAO;AAC7E,aAAO,GAAG,QAAQ,QAAQ,uBAAuB,GAAG,QAAQ,MAAM,WAAW,IAAI;AAAA,IACnF,CAAC;AAED,QAAI,GAAG,OAAO;AACZ,YAAM,IAAI,MAAM,GAAG,KAAK;AAAA,IAC1B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var audio_stream_exports = {};
|
|
20
|
+
__export(audio_stream_exports, {
|
|
21
|
+
AudioStream: () => AudioStream
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(audio_stream_exports);
|
|
24
|
+
var import_protobuf = require("@bufbuild/protobuf");
|
|
25
|
+
var import_mutex = require("@livekit/mutex");
|
|
26
|
+
var import_audio_frame = require("./audio_frame.cjs");
|
|
27
|
+
var import_ffi_client = require("./ffi_client.cjs");
|
|
28
|
+
var import_audio_frame_pb = require("./proto/audio_frame_pb.cjs");
|
|
29
|
+
class AudioStream {
|
|
30
|
+
constructor(track, sampleRate = 48e3, numChannels = 1) {
|
|
31
|
+
/** @internal */
|
|
32
|
+
this.eventQueue = [];
|
|
33
|
+
/** @internal */
|
|
34
|
+
this.queueResolve = null;
|
|
35
|
+
/** @internal */
|
|
36
|
+
this.mutex = new import_mutex.Mutex();
|
|
37
|
+
this.onEvent = (ev) => {
|
|
38
|
+
if (ev.message.case != "audioStreamEvent" || ev.message.value.streamHandle != this.ffiHandle.handle) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const streamEvent = ev.message.value.message;
|
|
42
|
+
switch (streamEvent.case) {
|
|
43
|
+
case "frameReceived":
|
|
44
|
+
const frame = import_audio_frame.AudioFrame.fromOwnedInfo(streamEvent.value.frame);
|
|
45
|
+
if (this.queueResolve) {
|
|
46
|
+
this.queueResolve({ done: false, value: frame });
|
|
47
|
+
} else {
|
|
48
|
+
this.eventQueue.push(frame);
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case "eos":
|
|
52
|
+
import_ffi_client.FfiClient.instance.off(import_ffi_client.FfiClientEvent.FfiEvent, this.onEvent);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this.track = track;
|
|
57
|
+
this.sampleRate = sampleRate;
|
|
58
|
+
this.numChannels = numChannels;
|
|
59
|
+
const req = (0, import_protobuf.create)(import_audio_frame_pb.NewAudioStreamRequestSchema, {
|
|
60
|
+
type: import_audio_frame_pb.AudioStreamType.AUDIO_STREAM_NATIVE,
|
|
61
|
+
trackHandle: track.ffi_handle.handle,
|
|
62
|
+
sampleRate,
|
|
63
|
+
numChannels
|
|
64
|
+
});
|
|
65
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
66
|
+
message: {
|
|
67
|
+
case: "newAudioStream",
|
|
68
|
+
value: req
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
this.info = res.stream.info;
|
|
72
|
+
this.ffiHandle = new import_ffi_client.FfiHandle(res.stream.handle.id);
|
|
73
|
+
import_ffi_client.FfiClient.instance.on(import_ffi_client.FfiClientEvent.FfiEvent, this.onEvent);
|
|
74
|
+
}
|
|
75
|
+
async next() {
|
|
76
|
+
const unlock = await this.mutex.lock();
|
|
77
|
+
if (this.eventQueue.length > 0) {
|
|
78
|
+
unlock();
|
|
79
|
+
const value = this.eventQueue.shift();
|
|
80
|
+
if (value) {
|
|
81
|
+
return { done: false, value };
|
|
82
|
+
} else {
|
|
83
|
+
return { done: true, value: void 0 };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const promise = new Promise(
|
|
87
|
+
(resolve) => this.queueResolve = resolve
|
|
88
|
+
);
|
|
89
|
+
unlock();
|
|
90
|
+
return promise;
|
|
91
|
+
}
|
|
92
|
+
close() {
|
|
93
|
+
this.eventQueue.push(null);
|
|
94
|
+
this.ffiHandle.dispose();
|
|
95
|
+
}
|
|
96
|
+
[Symbol.asyncIterator]() {
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {
|
|
102
|
+
AudioStream
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=audio_stream.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audio_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport { Mutex } from '@livekit/mutex';\nimport { AudioFrame } from './audio_frame.js';\nimport type { FfiEvent } from './ffi_client.js';\nimport { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';\nimport type { AudioStreamInfo, NewAudioStreamResponse } from './proto/audio_frame_pb.js';\nimport { AudioStreamType, NewAudioStreamRequestSchema } from './proto/audio_frame_pb.js';\nimport type { Track } from './track.js';\n\nexport class AudioStream implements AsyncIterableIterator<AudioFrame> {\n /** @internal */\n info: AudioStreamInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n /** @internal */\n eventQueue: (AudioFrame | null)[] = [];\n /** @internal */\n queueResolve: ((value: IteratorResult<AudioFrame>) => void) | null = null;\n /** @internal */\n mutex = new Mutex();\n\n track: Track;\n sampleRate: number;\n numChannels: number;\n\n constructor(track: Track, sampleRate: number = 48000, numChannels: number = 1) {\n this.track = track;\n this.sampleRate = sampleRate;\n this.numChannels = numChannels;\n\n const req = create(NewAudioStreamRequestSchema, {\n type: AudioStreamType.AUDIO_STREAM_NATIVE,\n trackHandle: track.ffi_handle.handle,\n sampleRate: sampleRate,\n numChannels: numChannels,\n });\n\n const res = FfiClient.instance.request<NewAudioStreamResponse>({\n message: {\n case: 'newAudioStream',\n value: req,\n },\n });\n\n this.info = res.stream!.info!;\n this.ffiHandle = new FfiHandle(res.stream!.handle!.id);\n\n FfiClient.instance.on(FfiClientEvent.FfiEvent, this.onEvent);\n }\n\n private onEvent = (ev: FfiEvent) => {\n if (\n ev.message.case != 'audioStreamEvent' ||\n ev.message.value.streamHandle != this.ffiHandle.handle\n ) {\n return;\n }\n\n const streamEvent = ev.message.value.message;\n switch (streamEvent.case) {\n case 'frameReceived':\n const frame = AudioFrame.fromOwnedInfo(streamEvent.value.frame!);\n if (this.queueResolve) {\n this.queueResolve({ done: false, value: frame });\n } else {\n this.eventQueue.push(frame);\n }\n break;\n case 'eos':\n FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);\n break;\n }\n };\n\n async next(): Promise<IteratorResult<AudioFrame>> {\n const unlock = await this.mutex.lock();\n if (this.eventQueue.length > 0) {\n unlock();\n const value = this.eventQueue.shift();\n if (value) {\n return { done: false, value };\n } else {\n return { done: true, value: undefined };\n }\n }\n const promise = new Promise<IteratorResult<AudioFrame>>(\n (resolve) => (this.queueResolve = resolve),\n );\n unlock();\n return promise;\n }\n\n close() {\n this.eventQueue.push(null);\n this.ffiHandle.dispose();\n }\n\n [Symbol.asyncIterator](): AudioStream {\n return this;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAuB;AACvB,mBAAsB;AACtB,yBAA2B;AAE3B,wBAAqD;AAErD,4BAA6D;AAGtD,MAAM,YAAyD;AAAA,EAgBpE,YAAY,OAAc,aAAqB,MAAO,cAAsB,GAAG;AAV/E;AAAA,sBAAoC,CAAC;AAErC;AAAA,wBAAqE;AAErE;AAAA,iBAAQ,IAAI,mBAAM;AA+BlB,SAAQ,UAAU,CAAC,OAAiB;AAClC,UACE,GAAG,QAAQ,QAAQ,sBACnB,GAAG,QAAQ,MAAM,gBAAgB,KAAK,UAAU,QAChD;AACA;AAA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;AAAA,EAEA,QAAQ;AACN,SAAK,WAAW,KAAK,IAAI;AACzB,SAAK,UAAU,QAAQ;AAAA,EACzB;AAAA,EAEA,CAAC,OAAO,aAAa,IAAiB;AACpC,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/audio_stream.js
CHANGED
|
@@ -1,81 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
if (value) {
|
|
63
|
-
return { done: false, value };
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
return { done: true, value: undefined };
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const promise = new Promise((resolve) => (this.queueResolve = resolve));
|
|
70
|
-
unlock();
|
|
71
|
-
return promise;
|
|
72
|
-
}
|
|
73
|
-
close() {
|
|
74
|
-
this.eventQueue.push(null);
|
|
75
|
-
this.ffiHandle.dispose();
|
|
76
|
-
}
|
|
77
|
-
[Symbol.asyncIterator]() {
|
|
78
|
-
return this;
|
|
1
|
+
import { create } from "@bufbuild/protobuf";
|
|
2
|
+
import { Mutex } from "@livekit/mutex";
|
|
3
|
+
import { AudioFrame } from "./audio_frame.js";
|
|
4
|
+
import { FfiClient, FfiClientEvent, FfiHandle } from "./ffi_client.js";
|
|
5
|
+
import { AudioStreamType, NewAudioStreamRequestSchema } from "./proto/audio_frame_pb.js";
|
|
6
|
+
class AudioStream {
|
|
7
|
+
constructor(track, sampleRate = 48e3, numChannels = 1) {
|
|
8
|
+
/** @internal */
|
|
9
|
+
this.eventQueue = [];
|
|
10
|
+
/** @internal */
|
|
11
|
+
this.queueResolve = null;
|
|
12
|
+
/** @internal */
|
|
13
|
+
this.mutex = new Mutex();
|
|
14
|
+
this.onEvent = (ev) => {
|
|
15
|
+
if (ev.message.case != "audioStreamEvent" || ev.message.value.streamHandle != this.ffiHandle.handle) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const streamEvent = ev.message.value.message;
|
|
19
|
+
switch (streamEvent.case) {
|
|
20
|
+
case "frameReceived":
|
|
21
|
+
const frame = AudioFrame.fromOwnedInfo(streamEvent.value.frame);
|
|
22
|
+
if (this.queueResolve) {
|
|
23
|
+
this.queueResolve({ done: false, value: frame });
|
|
24
|
+
} else {
|
|
25
|
+
this.eventQueue.push(frame);
|
|
26
|
+
}
|
|
27
|
+
break;
|
|
28
|
+
case "eos":
|
|
29
|
+
FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.track = track;
|
|
34
|
+
this.sampleRate = sampleRate;
|
|
35
|
+
this.numChannels = numChannels;
|
|
36
|
+
const req = create(NewAudioStreamRequestSchema, {
|
|
37
|
+
type: AudioStreamType.AUDIO_STREAM_NATIVE,
|
|
38
|
+
trackHandle: track.ffi_handle.handle,
|
|
39
|
+
sampleRate,
|
|
40
|
+
numChannels
|
|
41
|
+
});
|
|
42
|
+
const res = FfiClient.instance.request({
|
|
43
|
+
message: {
|
|
44
|
+
case: "newAudioStream",
|
|
45
|
+
value: req
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.info = res.stream.info;
|
|
49
|
+
this.ffiHandle = new FfiHandle(res.stream.handle.id);
|
|
50
|
+
FfiClient.instance.on(FfiClientEvent.FfiEvent, this.onEvent);
|
|
51
|
+
}
|
|
52
|
+
async next() {
|
|
53
|
+
const unlock = await this.mutex.lock();
|
|
54
|
+
if (this.eventQueue.length > 0) {
|
|
55
|
+
unlock();
|
|
56
|
+
const value = this.eventQueue.shift();
|
|
57
|
+
if (value) {
|
|
58
|
+
return { done: false, value };
|
|
59
|
+
} else {
|
|
60
|
+
return { done: true, value: void 0 };
|
|
61
|
+
}
|
|
79
62
|
}
|
|
63
|
+
const promise = new Promise(
|
|
64
|
+
(resolve) => this.queueResolve = resolve
|
|
65
|
+
);
|
|
66
|
+
unlock();
|
|
67
|
+
return promise;
|
|
68
|
+
}
|
|
69
|
+
close() {
|
|
70
|
+
this.eventQueue.push(null);
|
|
71
|
+
this.ffiHandle.dispose();
|
|
72
|
+
}
|
|
73
|
+
[Symbol.asyncIterator]() {
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
80
76
|
}
|
|
77
|
+
export {
|
|
78
|
+
AudioStream
|
|
79
|
+
};
|
|
81
80
|
//# sourceMappingURL=audio_stream.js.map
|
package/dist/audio_stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/audio_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport { Mutex } from '@livekit/mutex';\nimport { AudioFrame } from './audio_frame.js';\nimport type { FfiEvent } from './ffi_client.js';\nimport { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';\nimport type { AudioStreamInfo, NewAudioStreamResponse } from './proto/audio_frame_pb.js';\nimport { AudioStreamType, NewAudioStreamRequestSchema } from './proto/audio_frame_pb.js';\nimport type { Track } from './track.js';\n\nexport class AudioStream implements AsyncIterableIterator<AudioFrame> {\n /** @internal */\n info: AudioStreamInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n /** @internal */\n eventQueue: (AudioFrame | null)[] = [];\n /** @internal */\n queueResolve: ((value: IteratorResult<AudioFrame>) => void) | null = null;\n /** @internal */\n mutex = new Mutex();\n\n track: Track;\n sampleRate: number;\n numChannels: number;\n\n constructor(track: Track, sampleRate: number = 48000, numChannels: number = 1) {\n this.track = track;\n this.sampleRate = sampleRate;\n this.numChannels = numChannels;\n\n const req = create(NewAudioStreamRequestSchema, {\n type: AudioStreamType.AUDIO_STREAM_NATIVE,\n trackHandle: track.ffi_handle.handle,\n sampleRate: sampleRate,\n numChannels: numChannels,\n });\n\n const res = FfiClient.instance.request<NewAudioStreamResponse>({\n message: {\n case: 'newAudioStream',\n value: req,\n },\n });\n\n this.info = res.stream!.info!;\n this.ffiHandle = new FfiHandle(res.stream!.handle!.id);\n\n FfiClient.instance.on(FfiClientEvent.FfiEvent, this.onEvent);\n }\n\n private onEvent = (ev: FfiEvent) => {\n if (\n ev.message.case != 'audioStreamEvent' ||\n ev.message.value.streamHandle != this.ffiHandle.handle\n ) {\n return;\n }\n\n const streamEvent = ev.message.value.message;\n switch (streamEvent.case) {\n case 'frameReceived':\n const frame = AudioFrame.fromOwnedInfo(streamEvent.value.frame!);\n if (this.queueResolve) {\n this.queueResolve({ done: false, value: frame });\n } else {\n this.eventQueue.push(frame);\n }\n break;\n case 'eos':\n FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);\n break;\n }\n };\n\n async next(): Promise<IteratorResult<AudioFrame>> {\n const unlock = await this.mutex.lock();\n if (this.eventQueue.length > 0) {\n unlock();\n const value = this.eventQueue.shift();\n if (value) {\n return { done: false, value };\n } else {\n return { done: true, value: undefined };\n }\n }\n const promise = new Promise<IteratorResult<AudioFrame>>(\n (resolve) => (this.queueResolve = resolve),\n );\n unlock();\n return promise;\n }\n\n close() {\n this.eventQueue.push(null);\n this.ffiHandle.dispose();\n }\n\n [Symbol.asyncIterator](): AudioStream {\n return this;\n }\n}\n"],"mappings":"AAGA,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAE3B,SAAS,WAAW,gBAAgB,iBAAiB;AAErD,SAAS,iBAAiB,mCAAmC;AAGtD,MAAM,YAAyD;AAAA,EAgBpE,YAAY,OAAc,aAAqB,MAAO,cAAsB,GAAG;AAV/E;AAAA,sBAAoC,CAAC;AAErC;AAAA,wBAAqE;AAErE;AAAA,iBAAQ,IAAI,MAAM;AA+BlB,SAAQ,UAAU,CAAC,OAAiB;AAClC,UACE,GAAG,QAAQ,QAAQ,sBACnB,GAAG,QAAQ,MAAM,gBAAgB,KAAK,UAAU,QAChD;AACA;AAAA,MACF;AAEA,YAAM,cAAc,GAAG,QAAQ,MAAM;AACrC,cAAQ,YAAY,MAAM;AAAA,QACxB,KAAK;AACH,gBAAM,QAAQ,WAAW,cAAc,YAAY,MAAM,KAAM;AAC/D,cAAI,KAAK,cAAc;AACrB,iBAAK,aAAa,EAAE,MAAM,OAAO,OAAO,MAAM,CAAC;AAAA,UACjD,OAAO;AACL,iBAAK,WAAW,KAAK,KAAK;AAAA,UAC5B;AACA;AAAA,QACF,KAAK;AACH,oBAAU,SAAS,IAAI,eAAe,UAAU,KAAK,OAAO;AAC5D;AAAA,MACJ;AAAA,IACF;AA9CE,SAAK,QAAQ;AACb,SAAK,aAAa;AAClB,SAAK,cAAc;AAEnB,UAAM,MAAM,OAAO,6BAA6B;AAAA,MAC9C,MAAM,gBAAgB;AAAA,MACtB,aAAa,MAAM,WAAW;AAAA,MAC9B;AAAA,MACA;AAAA,IACF,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAgC;AAAA,MAC7D,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,SAAK,OAAO,IAAI,OAAQ;AACxB,SAAK,YAAY,IAAI,UAAU,IAAI,OAAQ,OAAQ,EAAE;AAErD,cAAU,SAAS,GAAG,eAAe,UAAU,KAAK,OAAO;AAAA,EAC7D;AAAA,EA0BA,MAAM,OAA4C;AAChD,UAAM,SAAS,MAAM,KAAK,MAAM,KAAK;AACrC,QAAI,KAAK,WAAW,SAAS,GAAG;AAC9B,aAAO;AACP,YAAM,QAAQ,KAAK,WAAW,MAAM;AACpC,UAAI,OAAO;AACT,eAAO,EAAE,MAAM,OAAO,MAAM;AAAA,MAC9B,OAAO;AACL,eAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,MACxC;AAAA,IACF;AACA,UAAM,UAAU,IAAI;AAAA,MAClB,CAAC,YAAa,KAAK,eAAe;AAAA,IACpC;AACA,WAAO;AACP,WAAO;AAAA,EACT;AAAA,EAEA,QAAQ;AACN,SAAK,WAAW,KAAK,IAAI;AACzB,SAAK,UAAU,QAAQ;AAAA,EACzB;AAAA,EAEA,CAAC,OAAO,aAAa,IAAiB;AACpC,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/e2ee.cjs
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var e2ee_exports = {};
|
|
20
|
+
__export(e2ee_exports, {
|
|
21
|
+
E2EEManager: () => E2EEManager,
|
|
22
|
+
FrameCryptor: () => FrameCryptor,
|
|
23
|
+
KeyProvider: () => KeyProvider,
|
|
24
|
+
defaultE2EEOptions: () => defaultE2EEOptions,
|
|
25
|
+
defaultKeyProviderOptions: () => defaultKeyProviderOptions
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(e2ee_exports);
|
|
28
|
+
var import_protobuf = require("@bufbuild/protobuf");
|
|
29
|
+
var import_ffi_client = require("./ffi_client.cjs");
|
|
30
|
+
var import_e2ee_pb = require("./proto/e2ee_pb.cjs");
|
|
31
|
+
const DEFAULT_RATCHET_SALT = new TextEncoder().encode("LKFrameEncryptionKey");
|
|
32
|
+
const DEFAULT_RATCHET_WINDOW_SIZE = 16;
|
|
33
|
+
const DEFAULT_FAILURE_TOLERANCE = -1;
|
|
34
|
+
const defaultKeyProviderOptions = {
|
|
35
|
+
ratchetSalt: DEFAULT_RATCHET_SALT,
|
|
36
|
+
ratchetWindowSize: DEFAULT_RATCHET_WINDOW_SIZE,
|
|
37
|
+
failureTolerance: DEFAULT_FAILURE_TOLERANCE
|
|
38
|
+
};
|
|
39
|
+
const defaultE2EEOptions = {
|
|
40
|
+
keyProviderOptions: defaultKeyProviderOptions,
|
|
41
|
+
encryptionType: import_e2ee_pb.EncryptionType.GCM
|
|
42
|
+
};
|
|
43
|
+
class KeyProvider {
|
|
44
|
+
/** internal */
|
|
45
|
+
constructor(roomHandle, opts) {
|
|
46
|
+
this.roomHandle = roomHandle;
|
|
47
|
+
this.options = opts;
|
|
48
|
+
}
|
|
49
|
+
setSharedKey(sharedKey, keyIndex) {
|
|
50
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
51
|
+
roomHandle: this.roomHandle,
|
|
52
|
+
message: {
|
|
53
|
+
case: "setSharedKey",
|
|
54
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.SetSharedKeyRequestSchema, {
|
|
55
|
+
keyIndex,
|
|
56
|
+
sharedKey
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
import_ffi_client.FfiClient.instance.request({
|
|
61
|
+
message: {
|
|
62
|
+
case: "e2ee",
|
|
63
|
+
value: req
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exportSharedKey(keyIndex) {
|
|
68
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
69
|
+
roomHandle: this.roomHandle,
|
|
70
|
+
message: {
|
|
71
|
+
case: "getSharedKey",
|
|
72
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.GetSharedKeyRequestSchema, {
|
|
73
|
+
keyIndex
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
78
|
+
message: {
|
|
79
|
+
case: "e2ee",
|
|
80
|
+
value: req
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return res.message.value.key;
|
|
84
|
+
}
|
|
85
|
+
ratchetSharedKey(keyIndex) {
|
|
86
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
87
|
+
roomHandle: this.roomHandle,
|
|
88
|
+
message: {
|
|
89
|
+
case: "ratchetSharedKey",
|
|
90
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.RatchetSharedKeyRequestSchema, {
|
|
91
|
+
keyIndex
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
96
|
+
message: {
|
|
97
|
+
case: "e2ee",
|
|
98
|
+
value: req
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return res.message.value.newKey;
|
|
102
|
+
}
|
|
103
|
+
setKey(participantIdentity, keyIndex) {
|
|
104
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
105
|
+
roomHandle: this.roomHandle,
|
|
106
|
+
message: {
|
|
107
|
+
case: "setKey",
|
|
108
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.SetKeyRequestSchema, {
|
|
109
|
+
keyIndex,
|
|
110
|
+
participantIdentity
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
import_ffi_client.FfiClient.instance.request({
|
|
115
|
+
message: {
|
|
116
|
+
case: "e2ee",
|
|
117
|
+
value: req
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
exportKey(participantIdentity, keyIndex) {
|
|
122
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
123
|
+
roomHandle: this.roomHandle,
|
|
124
|
+
message: {
|
|
125
|
+
case: "getKey",
|
|
126
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.GetKeyRequestSchema, {
|
|
127
|
+
keyIndex,
|
|
128
|
+
participantIdentity
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
133
|
+
message: {
|
|
134
|
+
case: "e2ee",
|
|
135
|
+
value: req
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return res.message.value.key;
|
|
139
|
+
}
|
|
140
|
+
ratchetKey(participantIdentity, keyIndex) {
|
|
141
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
142
|
+
roomHandle: this.roomHandle,
|
|
143
|
+
message: {
|
|
144
|
+
case: "ratchetKey",
|
|
145
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.RatchetKeyRequestSchema, {
|
|
146
|
+
keyIndex,
|
|
147
|
+
participantIdentity
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
152
|
+
message: {
|
|
153
|
+
case: "e2ee",
|
|
154
|
+
value: req
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return res.message.value.newKey;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
class FrameCryptor {
|
|
161
|
+
constructor(roomHandle, participantIdentity, keyIndex, enabled) {
|
|
162
|
+
this.roomHandle = BigInt(0);
|
|
163
|
+
this.roomHandle = roomHandle;
|
|
164
|
+
this.participantIdentity = participantIdentity;
|
|
165
|
+
this.keyIndex = keyIndex;
|
|
166
|
+
this.enabled = enabled;
|
|
167
|
+
}
|
|
168
|
+
setEnabled(enabled) {
|
|
169
|
+
this.enabled = enabled;
|
|
170
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
171
|
+
roomHandle: this.roomHandle,
|
|
172
|
+
message: {
|
|
173
|
+
case: "cryptorSetEnabled",
|
|
174
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.FrameCryptorSetEnabledRequestSchema, {
|
|
175
|
+
participantIdentity: this.participantIdentity,
|
|
176
|
+
enabled: this.enabled
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
import_ffi_client.FfiClient.instance.request({
|
|
181
|
+
message: {
|
|
182
|
+
case: "e2ee",
|
|
183
|
+
value: req
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
setKeyIndex(keyIndex) {
|
|
188
|
+
this.keyIndex = keyIndex;
|
|
189
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
190
|
+
roomHandle: this.roomHandle,
|
|
191
|
+
message: {
|
|
192
|
+
case: "cryptorSetKeyIndex",
|
|
193
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.FrameCryptorSetKeyIndexRequestSchema, {
|
|
194
|
+
participantIdentity: this.participantIdentity,
|
|
195
|
+
keyIndex: this.keyIndex
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
import_ffi_client.FfiClient.instance.request({
|
|
200
|
+
message: {
|
|
201
|
+
case: "e2ee",
|
|
202
|
+
value: req
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
class E2EEManager {
|
|
208
|
+
constructor(roomHandle, opts) {
|
|
209
|
+
this.roomHandle = BigInt(0);
|
|
210
|
+
this.roomHandle = roomHandle;
|
|
211
|
+
this.enabled = opts !== void 0;
|
|
212
|
+
opts ??= defaultE2EEOptions;
|
|
213
|
+
const options = { ...defaultE2EEOptions, ...opts };
|
|
214
|
+
this.options = options;
|
|
215
|
+
this.keyProvider = new KeyProvider(roomHandle, options.keyProviderOptions);
|
|
216
|
+
}
|
|
217
|
+
setEnabled(enabled) {
|
|
218
|
+
this.enabled = enabled;
|
|
219
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
220
|
+
roomHandle: this.roomHandle,
|
|
221
|
+
message: {
|
|
222
|
+
case: "managerSetEnabled",
|
|
223
|
+
value: (0, import_protobuf.create)(import_e2ee_pb.E2eeManagerSetEnabledRequestSchema, {
|
|
224
|
+
enabled: this.enabled
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
import_ffi_client.FfiClient.instance.request({
|
|
229
|
+
message: {
|
|
230
|
+
case: "e2ee",
|
|
231
|
+
value: req
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
frameCryptors() {
|
|
236
|
+
const req = (0, import_protobuf.create)(import_e2ee_pb.E2eeRequestSchema, {
|
|
237
|
+
roomHandle: this.roomHandle,
|
|
238
|
+
message: {
|
|
239
|
+
case: "managerGetFrameCryptors",
|
|
240
|
+
value: {}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
244
|
+
message: {
|
|
245
|
+
case: "e2ee",
|
|
246
|
+
value: req
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
const frameCryptors = res.message.value.frameCryptors.map(
|
|
250
|
+
(cryptor) => new FrameCryptor(
|
|
251
|
+
this.roomHandle,
|
|
252
|
+
cryptor.participantIdentity,
|
|
253
|
+
cryptor.keyIndex,
|
|
254
|
+
cryptor.enabled
|
|
255
|
+
)
|
|
256
|
+
);
|
|
257
|
+
return frameCryptors;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
261
|
+
0 && (module.exports = {
|
|
262
|
+
E2EEManager,
|
|
263
|
+
FrameCryptor,
|
|
264
|
+
KeyProvider,
|
|
265
|
+
defaultE2EEOptions,
|
|
266
|
+
defaultKeyProviderOptions
|
|
267
|
+
});
|
|
268
|
+
//# sourceMappingURL=e2ee.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/e2ee.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport { FfiClient } from './ffi_client.js';\nimport type {\n E2eeManagerGetFrameCryptorsResponse,\n E2eeResponse,\n GetKeyResponse,\n GetSharedKeyResponse,\n RatchetKeyResponse,\n RatchetSharedKeyResponse,\n} from './proto/e2ee_pb.js';\nimport {\n E2eeManagerSetEnabledRequestSchema,\n E2eeRequestSchema,\n EncryptionType,\n FrameCryptorSetEnabledRequestSchema,\n FrameCryptorSetKeyIndexRequestSchema,\n GetKeyRequestSchema,\n GetSharedKeyRequestSchema,\n RatchetKeyRequestSchema,\n RatchetSharedKeyRequestSchema,\n SetKeyRequestSchema,\n SetSharedKeyRequestSchema,\n} from './proto/e2ee_pb.js';\n\nconst DEFAULT_RATCHET_SALT = new TextEncoder().encode('LKFrameEncryptionKey');\nconst DEFAULT_RATCHET_WINDOW_SIZE = 16;\nconst DEFAULT_FAILURE_TOLERANCE = -1;\n\nexport interface KeyProviderOptions {\n sharedKey?: Uint8Array;\n ratchetSalt: Uint8Array;\n ratchetWindowSize: number;\n failureTolerance: number;\n}\n\nexport const defaultKeyProviderOptions: KeyProviderOptions = {\n ratchetSalt: DEFAULT_RATCHET_SALT,\n ratchetWindowSize: DEFAULT_RATCHET_WINDOW_SIZE,\n failureTolerance: DEFAULT_FAILURE_TOLERANCE,\n};\n\nexport interface E2EEOptions {\n keyProviderOptions: KeyProviderOptions;\n encryptionType: EncryptionType;\n}\n\nexport const defaultE2EEOptions: E2EEOptions = {\n keyProviderOptions: defaultKeyProviderOptions,\n encryptionType: EncryptionType.GCM,\n};\n\nexport class KeyProvider {\n private roomHandle: bigint;\n options: KeyProviderOptions;\n\n /** internal */\n constructor(roomHandle: bigint, opts: KeyProviderOptions) {\n this.roomHandle = roomHandle;\n this.options = opts;\n }\n\n setSharedKey(sharedKey: Uint8Array, keyIndex: number) {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'setSharedKey',\n value: create(SetSharedKeyRequestSchema, {\n keyIndex: keyIndex,\n sharedKey: sharedKey,\n }),\n },\n });\n\n FfiClient.instance.request({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n }\n\n exportSharedKey(keyIndex: number): Uint8Array {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'getSharedKey',\n value: create(GetSharedKeyRequestSchema, {\n keyIndex: keyIndex,\n }),\n },\n });\n\n const res = FfiClient.instance.request<E2eeResponse>({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n\n return (res.message.value as GetSharedKeyResponse).key;\n }\n\n ratchetSharedKey(keyIndex: number): Uint8Array {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'ratchetSharedKey',\n value: create(RatchetSharedKeyRequestSchema, {\n keyIndex: keyIndex,\n }),\n },\n });\n\n const res = FfiClient.instance.request<E2eeResponse>({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n\n return (res.message.value as RatchetSharedKeyResponse).newKey;\n }\n\n setKey(participantIdentity: string, keyIndex: number) {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'setKey',\n value: create(SetKeyRequestSchema, {\n keyIndex: keyIndex,\n participantIdentity: participantIdentity,\n }),\n },\n });\n\n FfiClient.instance.request({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n }\n\n exportKey(participantIdentity: string, keyIndex: number): Uint8Array {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'getKey',\n value: create(GetKeyRequestSchema, {\n keyIndex: keyIndex,\n participantIdentity: participantIdentity,\n }),\n },\n });\n\n const res = FfiClient.instance.request<E2eeResponse>({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n\n return (res.message.value as GetKeyResponse).key;\n }\n\n ratchetKey(participantIdentity: string, keyIndex: number): Uint8Array {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'ratchetKey',\n value: create(RatchetKeyRequestSchema, {\n keyIndex: keyIndex,\n participantIdentity: participantIdentity,\n }),\n },\n });\n\n const res = FfiClient.instance.request<E2eeResponse>({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n\n return (res.message.value as RatchetKeyResponse).newKey;\n }\n}\n\nexport class FrameCryptor {\n private roomHandle = BigInt(0);\n participantIdentity: string;\n keyIndex: number;\n enabled: boolean;\n\n constructor(roomHandle: bigint, participantIdentity: string, keyIndex: number, enabled: boolean) {\n this.roomHandle = roomHandle;\n this.participantIdentity = participantIdentity;\n this.keyIndex = keyIndex;\n this.enabled = enabled;\n }\n\n setEnabled(enabled: boolean) {\n this.enabled = enabled;\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'cryptorSetEnabled',\n value: create(FrameCryptorSetEnabledRequestSchema, {\n participantIdentity: this.participantIdentity,\n enabled: this.enabled,\n }),\n },\n });\n\n FfiClient.instance.request({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n }\n\n setKeyIndex(keyIndex: number) {\n this.keyIndex = keyIndex;\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'cryptorSetKeyIndex',\n value: create(FrameCryptorSetKeyIndexRequestSchema, {\n participantIdentity: this.participantIdentity,\n keyIndex: this.keyIndex,\n }),\n },\n });\n\n FfiClient.instance.request({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n }\n}\n\nexport class E2EEManager {\n private roomHandle = BigInt(0);\n private options: E2EEOptions;\n private keyProvider?: KeyProvider;\n\n enabled: boolean;\n\n constructor(roomHandle: bigint, opts?: E2EEOptions) {\n this.roomHandle = roomHandle;\n this.enabled = opts !== undefined;\n\n opts ??= defaultE2EEOptions;\n const options = { ...defaultE2EEOptions, ...opts };\n\n this.options = options;\n this.keyProvider = new KeyProvider(roomHandle, options.keyProviderOptions);\n }\n\n setEnabled(enabled: boolean) {\n this.enabled = enabled;\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'managerSetEnabled',\n value: create(E2eeManagerSetEnabledRequestSchema, {\n enabled: this.enabled,\n }),\n },\n });\n\n FfiClient.instance.request({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n }\n\n frameCryptors(): FrameCryptor[] {\n const req = create(E2eeRequestSchema, {\n roomHandle: this.roomHandle,\n message: {\n case: 'managerGetFrameCryptors',\n value: {},\n },\n });\n\n const res = FfiClient.instance.request<E2eeResponse>({\n message: {\n case: 'e2ee',\n value: req,\n },\n });\n\n const frameCryptors = (\n res.message.value as E2eeManagerGetFrameCryptorsResponse\n ).frameCryptors.map(\n (cryptor) =>\n new FrameCryptor(\n this.roomHandle,\n cryptor.participantIdentity,\n cryptor.keyIndex,\n cryptor.enabled,\n ),\n );\n\n return frameCryptors;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAuB;AACvB,wBAA0B;AAS1B,qBAYO;AAEP,MAAM,uBAAuB,IAAI,YAAY,EAAE,OAAO,sBAAsB;AAC5E,MAAM,8BAA8B;AACpC,MAAM,4BAA4B;AAS3B,MAAM,4BAAgD;AAAA,EAC3D,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,kBAAkB;AACpB;AAOO,MAAM,qBAAkC;AAAA,EAC7C,oBAAoB;AAAA,EACpB,gBAAgB,8BAAe;AACjC;AAEO,MAAM,YAAY;AAAA;AAAA,EAKvB,YAAY,YAAoB,MAA0B;AACxD,SAAK,aAAa;AAClB,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,aAAa,WAAuB,UAAkB;AACpD,UAAM,UAAM,wBAAO,kCAAmB;AAAA,MACpC,YAAY,KAAK;AAAA,MACjB,SAAS;AAAA,QACP,MAAM;AAAA,QACN,WAAO,wBAAO,0CAA2B;AAAA,UACvC;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAED,gCAAU,SAAS,QAAQ;AAAA,MACzB,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,gBAAgB,UAA8B;AAC5C,UAAM,UAAM,wBAAO,kCAAmB;AAAA,MACpC,YAAY,KAAK;AAAA,MACjB,SAAS;AAAA,QACP,MAAM;AAAA,QACN,WAAO,wBAAO,0CAA2B;AAAA,UACvC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAED,UAAM,MAAM,4BAAU,SAAS,QAAsB;AAAA,MACnD,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MAC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