livekit-client 2.3.1 → 2.4.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/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +14 -7
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +325 -175
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/api/SignalClient.d.ts +5 -2
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
- package/dist/src/e2ee/errors.d.ts +2 -1
- package/dist/src/e2ee/errors.d.ts.map +1 -1
- package/dist/src/e2ee/index.d.ts +1 -0
- package/dist/src/e2ee/index.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/logger.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +1 -2
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +2 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +1 -0
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +5 -0
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +15 -2
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +14 -6
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +8 -0
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/timers.d.ts +4 -4
- package/dist/src/room/timers.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +1 -0
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +5 -2
- package/dist/ts4.2/src/e2ee/errors.d.ts +2 -1
- package/dist/ts4.2/src/e2ee/index.d.ts +1 -0
- package/dist/ts4.2/src/room/PCTransport.d.ts +1 -2
- package/dist/ts4.2/src/room/RTCEngine.d.ts +2 -1
- package/dist/ts4.2/src/room/Room.d.ts +1 -0
- package/dist/ts4.2/src/room/errors.d.ts +5 -0
- package/dist/ts4.2/src/room/events.d.ts +15 -2
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +14 -6
- package/dist/ts4.2/src/room/participant/Participant.d.ts +8 -0
- package/dist/ts4.2/src/room/timers.d.ts +4 -4
- package/dist/ts4.2/src/room/track/utils.d.ts +1 -0
- package/package.json +12 -12
- package/src/api/SignalClient.ts +24 -2
- package/src/e2ee/errors.ts +8 -1
- package/src/e2ee/index.ts +1 -0
- package/src/e2ee/worker/FrameCryptor.ts +18 -4
- package/src/e2ee/worker/e2ee.worker.ts +5 -1
- package/src/logger.ts +4 -3
- package/src/room/DeviceManager.ts +1 -1
- package/src/room/RTCEngine.ts +3 -0
- package/src/room/Room.ts +11 -3
- package/src/room/errors.ts +11 -0
- package/src/room/events.ts +15 -0
- package/src/room/participant/LocalParticipant.ts +102 -10
- package/src/room/participant/Participant.ts +23 -0
- package/src/room/track/Track.ts +1 -1
- package/src/room/track/utils.test.ts +35 -1
- package/src/room/track/utils.ts +22 -0
@@ -454,8 +454,10 @@ var CryptorErrorReason;
|
|
454
454
|
class CryptorError extends LivekitError {
|
455
455
|
constructor(message) {
|
456
456
|
let reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CryptorErrorReason.InternalError;
|
457
|
+
let participantIdentity = arguments.length > 2 ? arguments[2] : undefined;
|
457
458
|
super(40, message);
|
458
459
|
this.reason = reason;
|
460
|
+
this.participantIdentity = participantIdentity;
|
459
461
|
}
|
460
462
|
}
|
461
463
|
|
@@ -1111,7 +1113,7 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1111
1113
|
});
|
1112
1114
|
readable.pipeThrough(transformStream).pipeTo(writable).catch(e => {
|
1113
1115
|
workerLogger.warn(e);
|
1114
|
-
this.emit(CryptorEvent.Error, e instanceof CryptorError ? e : new CryptorError(e.message));
|
1116
|
+
this.emit(CryptorEvent.Error, e instanceof CryptorError ? e : new CryptorError(e.message, undefined, this.participantIdentity));
|
1115
1117
|
});
|
1116
1118
|
this.trackId = trackId;
|
1117
1119
|
}
|
@@ -1198,8 +1200,8 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1198
1200
|
workerLogger.error(e);
|
1199
1201
|
}
|
1200
1202
|
} else {
|
1201
|
-
workerLogger.debug('failed to
|
1202
|
-
this.emit(CryptorEvent.Error, new CryptorError("encryption key missing for encoding", CryptorErrorReason.MissingKey));
|
1203
|
+
workerLogger.debug('failed to encrypt, emitting error', this.logContext);
|
1204
|
+
this.emit(CryptorEvent.Error, new CryptorError("encryption key missing for encoding", CryptorErrorReason.MissingKey, this.participantIdentity));
|
1203
1205
|
}
|
1204
1206
|
});
|
1205
1207
|
}
|
@@ -1255,7 +1257,7 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1255
1257
|
} else if (!this.keys.getKeySet(keyIndex) && this.keys.hasValidKey) {
|
1256
1258
|
// emit an error in case the key index is out of bounds but the key handler thinks we still have a valid key
|
1257
1259
|
workerLogger.warn("skipping decryption due to missing key at index ".concat(keyIndex));
|
1258
|
-
this.emit(CryptorEvent.Error, new CryptorError("missing key at index ".concat(keyIndex, " for participant ").concat(this.participantIdentity), CryptorErrorReason.MissingKey));
|
1260
|
+
this.emit(CryptorEvent.Error, new CryptorError("missing key at index ".concat(keyIndex, " for participant ").concat(this.participantIdentity), CryptorErrorReason.MissingKey, this.participantIdentity));
|
1259
1261
|
}
|
1260
1262
|
});
|
1261
1263
|
}
|
@@ -1342,10 +1344,10 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1342
1344
|
* as the key has not been updated on the keyHandler instance
|
1343
1345
|
*/
|
1344
1346
|
workerLogger.warn('maximum ratchet attempts exceeded');
|
1345
|
-
throw new CryptorError("valid key missing for participant ".concat(_this.participantIdentity), CryptorErrorReason.InvalidKey);
|
1347
|
+
throw new CryptorError("valid key missing for participant ".concat(_this.participantIdentity), CryptorErrorReason.InvalidKey, _this.participantIdentity);
|
1346
1348
|
}
|
1347
1349
|
} else {
|
1348
|
-
throw new CryptorError("Decryption failed: ".concat(error.message), CryptorErrorReason.InvalidKey);
|
1350
|
+
throw new CryptorError("Decryption failed: ".concat(error.message), CryptorErrorReason.InvalidKey, _this.participantIdentity);
|
1349
1351
|
}
|
1350
1352
|
}
|
1351
1353
|
}();
|
@@ -1401,11 +1403,13 @@ class FrameCryptor extends BaseFrameCryptor {
|
|
1401
1403
|
}, this.logContext));
|
1402
1404
|
this.detectedCodec = detectedCodec;
|
1403
1405
|
}
|
1404
|
-
if (detectedCodec === 'av1'
|
1406
|
+
if (detectedCodec === 'av1') {
|
1405
1407
|
throw new Error("".concat(detectedCodec, " is not yet supported for end to end encryption"));
|
1406
1408
|
}
|
1407
1409
|
if (detectedCodec === 'vp8') {
|
1408
1410
|
frameInfo.unencryptedBytes = UNENCRYPTED_BYTES[frame.type];
|
1411
|
+
} else if (detectedCodec === 'vp9') {
|
1412
|
+
frameInfo.unencryptedBytes = 0;
|
1409
1413
|
return frameInfo;
|
1410
1414
|
}
|
1411
1415
|
const data = new Uint8Array(frame.data);
|
@@ -1693,6 +1697,7 @@ let isEncryptionEnabled = false;
|
|
1693
1697
|
let useSharedKey = false;
|
1694
1698
|
let sifTrailer;
|
1695
1699
|
let keyProviderOptions = KEY_PROVIDER_DEFAULTS;
|
1700
|
+
let rtpMap = new Map();
|
1696
1701
|
workerLogger.setDefaultLevel('info');
|
1697
1702
|
onmessage = ev => {
|
1698
1703
|
const {
|
@@ -1746,6 +1751,7 @@ onmessage = ev => {
|
|
1746
1751
|
break;
|
1747
1752
|
case 'setRTPMap':
|
1748
1753
|
// this is only used for the local participant
|
1754
|
+
rtpMap = data.map;
|
1749
1755
|
participantCryptors.forEach(cr => {
|
1750
1756
|
if (cr.getParticipantIdentity() === data.participantIdentity) {
|
1751
1757
|
cr.setRtpMap(data.map);
|
@@ -1801,6 +1807,7 @@ function getTrackCryptor(participantIdentity, trackId) {
|
|
1801
1807
|
keyProviderOptions,
|
1802
1808
|
sifTrailer
|
1803
1809
|
});
|
1810
|
+
cryptor.setRtpMap(rtpMap);
|
1804
1811
|
setupCryptorErrorEvents(cryptor);
|
1805
1812
|
participantCryptors.push(cryptor);
|
1806
1813
|
} else if (participantIdentity !== cryptor.getParticipantIdentity()) {
|