livekit-client 2.0.6 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/livekit-client.e2ee.worker.js +1 -1
  2. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  3. package/dist/livekit-client.e2ee.worker.mjs +27 -3
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +74 -35
  6. package/dist/livekit-client.esm.mjs.map +1 -1
  7. package/dist/livekit-client.umd.js +1 -1
  8. package/dist/livekit-client.umd.js.map +1 -1
  9. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  10. package/dist/src/index.d.ts +7 -6
  11. package/dist/src/index.d.ts.map +1 -1
  12. package/dist/src/room/PCTransport.d.ts.map +1 -1
  13. package/dist/src/room/Room.d.ts.map +1 -1
  14. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  15. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  16. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  17. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  18. package/dist/src/room/track/options.d.ts +6 -0
  19. package/dist/src/room/track/options.d.ts.map +1 -1
  20. package/dist/src/room/track/utils.d.ts.map +1 -1
  21. package/dist/ts4.2/src/index.d.ts +7 -6
  22. package/dist/ts4.2/src/room/track/options.d.ts +6 -0
  23. package/package.json +1 -1
  24. package/src/e2ee/worker/FrameCryptor.ts +12 -0
  25. package/src/e2ee/worker/e2ee.worker.ts +24 -3
  26. package/src/index.ts +32 -29
  27. package/src/room/PCTransport.ts +6 -18
  28. package/src/room/Room.ts +1 -0
  29. package/src/room/participant/LocalParticipant.ts +31 -3
  30. package/src/room/participant/publishUtils.ts +38 -11
  31. package/src/room/track/LocalTrack.ts +11 -9
  32. package/src/room/track/RemoteAudioTrack.ts +1 -1
  33. package/src/room/track/options.ts +7 -0
  34. package/src/room/track/utils.ts +1 -0
@@ -1002,6 +1002,12 @@ class FrameCryptor extends BaseFrameCryptor {
1002
1002
  * @param keys
1003
1003
  */
1004
1004
  setParticipant(id, keys) {
1005
+ workerLogger.debug('setting new participant on cryptor', Object.assign(Object.assign({}, this.logContext), {
1006
+ participant: id
1007
+ }));
1008
+ if (this.participantIdentity) {
1009
+ workerLogger.error('cryptor has already a participant set, participant should have been unset before', Object.assign({}, this.logContext));
1010
+ }
1005
1011
  this.participantIdentity = id;
1006
1012
  this.keys = keys;
1007
1013
  this.sifGuard.reset();
@@ -1649,7 +1655,7 @@ onmessage = ev => {
1649
1655
  break;
1650
1656
  case 'enable':
1651
1657
  setEncryptionEnabled(data.enabled, data.participantIdentity);
1652
- workerLogger.info('updated e2ee enabled status');
1658
+ workerLogger.info("updated e2ee enabled status for ".concat(data.participantIdentity, " to ").concat(data.enabled));
1653
1659
  // acknowledge enable call successful
1654
1660
  postMessage(ev.data);
1655
1661
  break;
@@ -1709,7 +1715,18 @@ function handleRatchetRequest(data) {
1709
1715
  });
1710
1716
  }
1711
1717
  function getTrackCryptor(participantIdentity, trackId) {
1712
- let cryptor = participantCryptors.find(c => c.getTrackId() === trackId);
1718
+ let cryptors = participantCryptors.filter(c => c.getTrackId() === trackId);
1719
+ if (cryptors.length > 1) {
1720
+ const debugInfo = cryptors.map(c => {
1721
+ return {
1722
+ participant: c.getParticipantIdentity()
1723
+ };
1724
+ }).join(',');
1725
+ workerLogger.error("Found multiple cryptors for the same trackID ".concat(trackId, ". target participant: ").concat(participantIdentity, " "), {
1726
+ participants: debugInfo
1727
+ });
1728
+ }
1729
+ let cryptor = cryptors[0];
1713
1730
  if (!cryptor) {
1714
1731
  workerLogger.info('creating new cryptor for', {
1715
1732
  participantIdentity
@@ -1751,7 +1768,14 @@ function getSharedKeyHandler() {
1751
1768
  return sharedKeyHandler;
1752
1769
  }
1753
1770
  function unsetCryptorParticipant(trackId, participantIdentity) {
1754
- const cryptor = participantCryptors.find(c => c.getParticipantIdentity() === participantIdentity && c.getTrackId() === trackId);
1771
+ const cryptors = participantCryptors.filter(c => c.getParticipantIdentity() === participantIdentity && c.getTrackId() === trackId);
1772
+ if (cryptors.length > 1) {
1773
+ workerLogger.error('Found multiple cryptors for the same participant and trackID combination', {
1774
+ trackId,
1775
+ participantIdentity
1776
+ });
1777
+ }
1778
+ const cryptor = cryptors[0];
1755
1779
  if (!cryptor) {
1756
1780
  workerLogger.warn('Could not unset participant on cryptor', {
1757
1781
  trackId,