livekit-client 1.14.1 → 1.14.3
Sign up to get free protection for your applications and to get access to all the features.
- 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 +25 -44
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +555 -306
- 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/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/utils.d.ts +0 -1
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/proto/livekit_models_pb.d.ts +87 -11
- package/dist/src/proto/livekit_models_pb.d.ts.map +1 -1
- package/dist/src/proto/livekit_rtc_pb.d.ts +0 -4
- package/dist/src/proto/livekit_rtc_pb.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +20 -1
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +1 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/defaults.d.ts +1 -0
- package/dist/src/room/defaults.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +3 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -0
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/timers.d.ts +1 -1
- package/dist/src/room/timers.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +3 -3
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +2 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +0 -1
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +2 -1
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/utils/cloneDeep.d.ts +2 -0
- package/dist/src/utils/cloneDeep.d.ts.map +1 -0
- package/dist/ts4.2/src/e2ee/utils.d.ts +0 -1
- package/dist/ts4.2/src/proto/livekit_models_pb.d.ts +87 -11
- package/dist/ts4.2/src/proto/livekit_rtc_pb.d.ts +0 -4
- package/dist/ts4.2/src/room/PCTransport.d.ts +20 -1
- package/dist/ts4.2/src/room/RTCEngine.d.ts +1 -1
- package/dist/ts4.2/src/room/Room.d.ts +1 -1
- package/dist/ts4.2/src/room/defaults.d.ts +1 -0
- package/dist/ts4.2/src/room/events.d.ts +3 -1
- package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -0
- package/dist/ts4.2/src/room/timers.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalAudioTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +3 -3
- package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +2 -1
- package/dist/ts4.2/src/room/track/options.d.ts +0 -1
- package/dist/ts4.2/src/room/track/utils.d.ts +1 -0
- package/dist/ts4.2/src/utils/cloneDeep.d.ts +2 -0
- package/package.json +15 -15
- package/src/connectionHelper/checks/webrtc.ts +1 -1
- package/src/e2ee/E2eeManager.ts +2 -1
- package/src/e2ee/utils.ts +0 -10
- package/src/e2ee/worker/FrameCryptor.ts +13 -14
- package/src/e2ee/worker/ParticipantKeyHandler.ts +4 -5
- package/src/e2ee/worker/e2ee.worker.ts +3 -1
- package/src/proto/livekit_models_pb.ts +140 -15
- package/src/proto/livekit_rtc_pb.ts +1 -7
- package/src/room/PCTransport.ts +122 -5
- package/src/room/RTCEngine.ts +56 -92
- package/src/room/Room.ts +14 -11
- package/src/room/defaults.ts +4 -2
- package/src/room/events.ts +5 -1
- package/src/room/participant/LocalParticipant.ts +47 -68
- package/src/room/participant/Participant.ts +1 -0
- package/src/room/track/LocalAudioTrack.ts +1 -1
- package/src/room/track/LocalTrack.ts +8 -5
- package/src/room/track/LocalVideoTrack.ts +2 -1
- package/src/room/track/Track.ts +6 -1
- package/src/room/track/options.ts +0 -7
- package/src/room/track/utils.ts +17 -8
- package/src/utils/cloneDeep.test.ts +54 -0
- package/src/utils/cloneDeep.ts +11 -0
@@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
14
14
|
***************************************************************************** */
|
15
|
-
/* global Reflect, Promise */
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
16
16
|
|
17
17
|
|
18
18
|
function __awaiter(thisArg, _arguments, P, generator) {
|
@@ -23,7 +23,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
23
23
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
24
24
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
25
25
|
});
|
26
|
-
}
|
26
|
+
}
|
27
|
+
|
28
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
29
|
+
var e = new Error(message);
|
30
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
31
|
+
};
|
27
32
|
|
28
33
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
29
34
|
|
@@ -793,28 +798,6 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
793
798
|
}
|
794
799
|
var eventsExports = events.exports;
|
795
800
|
|
796
|
-
var AudioPresets;
|
797
|
-
(function (AudioPresets) {
|
798
|
-
AudioPresets.telephone = {
|
799
|
-
maxBitrate: 12000
|
800
|
-
};
|
801
|
-
AudioPresets.speech = {
|
802
|
-
maxBitrate: 20000
|
803
|
-
};
|
804
|
-
AudioPresets.music = {
|
805
|
-
maxBitrate: 32000
|
806
|
-
};
|
807
|
-
AudioPresets.musicStereo = {
|
808
|
-
maxBitrate: 48000
|
809
|
-
};
|
810
|
-
AudioPresets.musicHighQuality = {
|
811
|
-
maxBitrate: 64000
|
812
|
-
};
|
813
|
-
AudioPresets.musicHighQualityStereo = {
|
814
|
-
maxBitrate: 96000
|
815
|
-
};
|
816
|
-
})(AudioPresets || (AudioPresets = {}));
|
817
|
-
|
818
801
|
function isVideoFrame(frame) {
|
819
802
|
return 'type' in frame;
|
820
803
|
}
|
@@ -1183,8 +1166,8 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1183
1166
|
}
|
1184
1167
|
} else if (!this.keys.getKeySet(keyIndex) && this.keys.hasValidKey) {
|
1185
1168
|
// emit an error in case the key index is out of bounds but the key handler thinks we still have a valid key
|
1186
|
-
workerLogger.warn(
|
1187
|
-
this.emit(CryptorEvent.Error, new CryptorError("missing key at index for participant ".concat(this.participantIdentity), CryptorErrorReason.MissingKey));
|
1169
|
+
workerLogger.warn("skipping decryption due to missing key at index ".concat(keyIndex));
|
1170
|
+
this.emit(CryptorEvent.Error, new CryptorError("missing key at index ".concat(keyIndex, " for participant ").concat(this.participantIdentity), CryptorErrorReason.MissingKey));
|
1188
1171
|
}
|
1189
1172
|
});
|
1190
1173
|
}
|
@@ -1242,7 +1225,7 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1242
1225
|
if (ratchetOpts.ratchetCount < this.keyProviderOptions.ratchetWindowSize) {
|
1243
1226
|
workerLogger.debug("ratcheting key attempt ".concat(ratchetOpts.ratchetCount, " of ").concat(this.keyProviderOptions.ratchetWindowSize, ", for kind ").concat(encodedFrame instanceof RTCEncodedAudioFrame ? 'audio' : 'video'));
|
1244
1227
|
let ratchetedKeySet;
|
1245
|
-
if (keySet === this.keys.getKeySet(keyIndex)) {
|
1228
|
+
if ((initialMaterial !== null && initialMaterial !== void 0 ? initialMaterial : keySet) === this.keys.getKeySet(keyIndex)) {
|
1246
1229
|
// only ratchet if the currently set key is still the same as the one used to decrypt this frame
|
1247
1230
|
// if not, it might be that a different frame has already ratcheted and we try with that one first
|
1248
1231
|
const newMaterial = yield this.keys.ratchetKey(keyIndex, false);
|
@@ -1253,22 +1236,21 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1253
1236
|
encryptionKey: ratchetedKeySet === null || ratchetedKeySet === void 0 ? void 0 : ratchetedKeySet.encryptionKey
|
1254
1237
|
});
|
1255
1238
|
if (frame && ratchetedKeySet) {
|
1256
|
-
|
1257
|
-
//
|
1258
|
-
this.keys.
|
1239
|
+
// before updating the keys, make sure that the keySet used for this frame is still the same as the currently set key
|
1240
|
+
// if it's not, a new key might have been set already, which we don't want to override
|
1241
|
+
if ((initialMaterial !== null && initialMaterial !== void 0 ? initialMaterial : keySet) === this.keys.getKeySet(keyIndex)) {
|
1242
|
+
this.keys.setKeySet(ratchetedKeySet, keyIndex, true);
|
1243
|
+
// decryption was successful, set the new key index to reflect the ratcheted key set
|
1244
|
+
this.keys.setCurrentKeyIndex(keyIndex);
|
1245
|
+
}
|
1259
1246
|
}
|
1260
1247
|
return frame;
|
1261
1248
|
} else {
|
1262
1249
|
/**
|
1263
|
-
*
|
1264
|
-
*
|
1265
|
-
*
|
1266
|
-
* we come back to the initial key.
|
1250
|
+
* Because we only set a new key once decryption has been successful,
|
1251
|
+
* we can be sure that we don't need to reset the key to the initial material at this point
|
1252
|
+
* as the key has not been updated on the keyHandler instance
|
1267
1253
|
*/
|
1268
|
-
if (initialMaterial) {
|
1269
|
-
workerLogger.debug('resetting to initial material');
|
1270
|
-
this.keys.setKeyFromMaterial(initialMaterial.material, keyIndex);
|
1271
|
-
}
|
1272
1254
|
workerLogger.warn('maximum ratchet attempts exceeded');
|
1273
1255
|
throw new CryptorError("valid key missing for participant ".concat(this.participantIdentity), CryptorErrorReason.InvalidKey);
|
1274
1256
|
}
|
@@ -1562,12 +1544,11 @@ class ParticipantKeyHandler extends eventsExports.EventEmitter {
|
|
1562
1544
|
let keyIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
1563
1545
|
let emitRatchetEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
1564
1546
|
return __awaiter(this, void 0, void 0, function* () {
|
1565
|
-
|
1566
|
-
|
1567
|
-
this.currentKeyIndex = keyIndex % this.cryptoKeyRing.length;
|
1568
|
-
}
|
1547
|
+
const newIndex = keyIndex >= 0 ? keyIndex % this.cryptoKeyRing.length : -1;
|
1548
|
+
workerLogger.debug("setting new key with index ".concat(newIndex));
|
1569
1549
|
const keySet = yield deriveKeys(material, this.keyProviderOptions.ratchetSalt);
|
1570
|
-
this.setKeySet(keySet, this.currentKeyIndex, emitRatchetEvent);
|
1550
|
+
this.setKeySet(keySet, newIndex >= 0 ? newIndex : this.currentKeyIndex, emitRatchetEvent);
|
1551
|
+
if (newIndex >= 0) this.currentKeyIndex = newIndex;
|
1571
1552
|
});
|
1572
1553
|
}
|
1573
1554
|
setKeySet(keySet, keyIndex) {
|
@@ -1643,7 +1624,7 @@ onmessage = ev => {
|
|
1643
1624
|
workerLogger.warn('set shared key');
|
1644
1625
|
setSharedKey(data.key, data.keyIndex);
|
1645
1626
|
} else if (data.participantIdentity) {
|
1646
|
-
workerLogger.warn("set participant sender key ".concat(data.participantIdentity));
|
1627
|
+
workerLogger.warn("set participant sender key ".concat(data.participantIdentity, " index ").concat(data.keyIndex));
|
1647
1628
|
getParticipantKeyHandler(data.participantIdentity).setKey(data.key, data.keyIndex);
|
1648
1629
|
} else {
|
1649
1630
|
workerLogger.error('no participant Id was provided and shared key usage is disabled');
|