@webex/plugin-meetings 3.13.0-next.16 → 3.13.0-next.18

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.
Files changed (112) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/index.js +1 -1
  4. package/dist/common/events/typed-events-scope.js +135 -0
  5. package/dist/common/events/typed-events-scope.js.map +1 -0
  6. package/dist/common/types.js +7 -0
  7. package/dist/common/types.js.map +1 -0
  8. package/dist/config.js +1 -1
  9. package/dist/constants.js +5 -0
  10. package/dist/constants.js.map +1 -1
  11. package/dist/e2ee/E2eeController.js +609 -0
  12. package/dist/e2ee/E2eeController.js.map +1 -0
  13. package/dist/e2ee/E2eeManager.js +50 -31
  14. package/dist/e2ee/E2eeManager.js.map +1 -1
  15. package/dist/e2ee/E2eeSignaling.js +18 -21
  16. package/dist/e2ee/E2eeSignaling.js.map +1 -1
  17. package/dist/e2ee/MediaEncryptionService.js +2 -5
  18. package/dist/e2ee/MediaEncryptionService.js.map +1 -1
  19. package/dist/e2ee/MemberMLSReconciler.js +194 -0
  20. package/dist/e2ee/MemberMLSReconciler.js.map +1 -0
  21. package/dist/e2ee/constants.js +28 -0
  22. package/dist/e2ee/constants.js.map +1 -0
  23. package/dist/e2ee/mls.js +86 -68
  24. package/dist/e2ee/mls.js.map +1 -1
  25. package/dist/e2ee/types.js +66 -11
  26. package/dist/e2ee/types.js.map +1 -1
  27. package/dist/e2ee/wasm.d.js.map +1 -1
  28. package/dist/hashTree/hashTreeParser.js.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/interpretation/index.js +1 -1
  31. package/dist/interpretation/siLanguage.js +1 -1
  32. package/dist/meeting/index.js +394 -249
  33. package/dist/meeting/index.js.map +1 -1
  34. package/dist/meeting/request.js +69 -58
  35. package/dist/meeting/request.js.map +1 -1
  36. package/dist/meeting/util.js +4 -2
  37. package/dist/meeting/util.js.map +1 -1
  38. package/dist/meetings/index.js +87 -61
  39. package/dist/meetings/index.js.map +1 -1
  40. package/dist/meetings/util.js +10 -0
  41. package/dist/meetings/util.js.map +1 -1
  42. package/dist/member/index.js +159 -0
  43. package/dist/member/index.js.map +1 -1
  44. package/dist/member/types.js.map +1 -1
  45. package/dist/members/collection.js +84 -1
  46. package/dist/members/collection.js.map +1 -1
  47. package/dist/members/index.js +58 -1
  48. package/dist/members/index.js.map +1 -1
  49. package/dist/metrics/constants.js +2 -1
  50. package/dist/metrics/constants.js.map +1 -1
  51. package/dist/types/common/events/typed-events-scope.d.ts +73 -0
  52. package/dist/types/common/types.d.ts +9 -0
  53. package/dist/types/constants.d.ts +5 -0
  54. package/dist/types/e2ee/E2eeController.d.ts +131 -0
  55. package/dist/types/e2ee/E2eeManager.d.ts +26 -6
  56. package/dist/types/e2ee/E2eeSignaling.d.ts +1 -7
  57. package/dist/types/e2ee/MediaEncryptionService.d.ts +1 -3
  58. package/dist/types/e2ee/MemberMLSReconciler.d.ts +76 -0
  59. package/dist/types/e2ee/constants.d.ts +12 -0
  60. package/dist/types/e2ee/mls.d.ts +16 -10
  61. package/dist/types/e2ee/types.d.ts +117 -36
  62. package/dist/types/hashTree/hashTreeParser.d.ts +1 -1
  63. package/dist/types/index.d.ts +1 -0
  64. package/dist/types/meeting/index.d.ts +34 -0
  65. package/dist/types/meeting/util.d.ts +1 -1
  66. package/dist/types/member/index.d.ts +62 -0
  67. package/dist/types/member/types.d.ts +1 -0
  68. package/dist/types/members/collection.d.ts +30 -0
  69. package/dist/types/members/index.d.ts +73 -0
  70. package/dist/types/metrics/constants.d.ts +1 -0
  71. package/dist/webinar/index.js +1 -1
  72. package/package.json +21 -21
  73. package/src/common/events/typed-events-scope.ts +110 -0
  74. package/src/common/types.ts +10 -0
  75. package/src/constants.ts +6 -0
  76. package/src/e2ee/DESIGN.md +363 -0
  77. package/src/e2ee/E2eeController.ts +513 -0
  78. package/src/e2ee/E2eeManager.ts +48 -27
  79. package/src/e2ee/E2eeSignaling.ts +13 -28
  80. package/src/e2ee/MediaEncryptionService.ts +2 -4
  81. package/src/e2ee/MemberMLSReconciler.ts +175 -0
  82. package/src/e2ee/constants.ts +34 -0
  83. package/src/e2ee/mls.ts +63 -33
  84. package/src/e2ee/types.ts +129 -35
  85. package/src/e2ee/wasm.d.ts +18 -14
  86. package/src/hashTree/hashTreeParser.ts +1 -1
  87. package/src/index.ts +1 -0
  88. package/src/meeting/index.ts +155 -0
  89. package/src/meeting/request.ts +16 -0
  90. package/src/meeting/util.ts +2 -1
  91. package/src/meetings/index.ts +30 -5
  92. package/src/meetings/util.ts +8 -0
  93. package/src/member/index.ts +169 -0
  94. package/src/member/types.ts +1 -0
  95. package/src/members/collection.ts +67 -1
  96. package/src/members/index.ts +59 -1
  97. package/src/metrics/constants.ts +1 -0
  98. package/test/unit/spec/common/events/typed-events-scope.ts +88 -0
  99. package/test/unit/spec/e2ee/E2eeController.ts +753 -0
  100. package/test/unit/spec/e2ee/E2eeManager.ts +53 -29
  101. package/test/unit/spec/e2ee/E2eeSignaling.ts +19 -10
  102. package/test/unit/spec/e2ee/MemberMLSReconciler.ts +353 -0
  103. package/test/unit/spec/e2ee/mls.ts +86 -34
  104. package/test/unit/spec/meeting/index.js +662 -0
  105. package/test/unit/spec/meeting/request.js +35 -0
  106. package/test/unit/spec/meeting/utils.js +4 -0
  107. package/test/unit/spec/meetings/index.js +36 -1
  108. package/test/unit/spec/meetings/utils.js +15 -0
  109. package/test/unit/spec/member/index.js +292 -0
  110. package/test/unit/spec/members/collection.js +50 -0
  111. package/test/unit/spec/members/index.js +71 -0
  112. package/test/utils/webex-config.js +1 -0
@@ -53,6 +53,7 @@ import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
53
53
  import EventsScope from '@webex/plugin-meetings/src/common/events/events-scope';
54
54
  import Meetings, {CONSTANTS} from '@webex/plugin-meetings';
55
55
  import Meeting from '@webex/plugin-meetings/src/meeting';
56
+ import {E2eeState} from '@webex/plugin-meetings/src/e2ee/types';
56
57
  import Members from '@webex/plugin-meetings/src/members';
57
58
  import * as MembersImport from '@webex/plugin-meetings/src/members';
58
59
  import Roap from '@webex/plugin-meetings/src/roap';
@@ -240,6 +241,7 @@ describe('plugin-meetings', () => {
240
241
  client_id: 'mock-client-id',
241
242
  },
242
243
  meetings: {
244
+ assetsBaseUrl: '/assets/plugin-meetings/',
243
245
  reconnection: {
244
246
  enabled: false,
245
247
  },
@@ -389,8 +391,585 @@ describe('plugin-meetings', () => {
389
391
  ...overrides,
390
392
  });
391
393
 
394
+ describe('Meeting.trustState', () => {
395
+ const createMeetingWithTrustState = ({
396
+ joined = true,
397
+ isV2E2EEncrypted = false,
398
+ isBestEffortE2EEncryption = false,
399
+ state = E2eeState.Disabled,
400
+ hasUntrustedMediaServices = false,
401
+ } = {}) => {
402
+ const e2ee = new EventEmitter();
403
+
404
+ e2ee.state = state;
405
+ e2ee.hasUntrustedMediaServices = hasUntrustedMediaServices;
406
+ const meetingWithE2ee = new Meeting(
407
+ {
408
+ userId: uuid1,
409
+ resource: uuid2,
410
+ deviceUrl: uuid3,
411
+ locus: {url: url1},
412
+ destination: testDestination,
413
+ destinationType: DESTINATION_TYPE.MEETING_ID,
414
+ correlationId,
415
+ selfId: uuid1,
416
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
417
+ },
418
+ {parent: webex}
419
+ );
420
+
421
+ meetingWithE2ee.locusInfo.info = {isV2E2EEncrypted, isBestEffortE2EEncryption};
422
+ if (joined) {
423
+ meetingWithE2ee.joinedWith = {state: 'JOINED'};
424
+ }
425
+
426
+ return meetingWithE2ee;
427
+ };
428
+
429
+ [
430
+ {
431
+ description: 'is undefined before we join Locus, even when MLS has failed',
432
+ options: {joined: false, isV2E2EEncrypted: true, state: E2eeState.Failed},
433
+ expected: undefined,
434
+ },
435
+ {
436
+ description: 'is undefined before we join Locus (not e2ee meeting)',
437
+ options: {joined: false, isV2E2EEncrypted: false},
438
+ expected: undefined,
439
+ },
440
+ {
441
+ description: 'is strong for a non-E2EE meeting with MLS disabled',
442
+ options: {isV2E2EEncrypted: false, isBestEffortE2EEncryption: false},
443
+ expected: 'strong',
444
+ },
445
+ {
446
+ description: 'is strong for an adaptive meeting that has not joined MLS',
447
+ options: {isV2E2EEncrypted: true, isBestEffortE2EEncryption: true},
448
+ expected: 'adaptiveStrong',
449
+ },
450
+ {
451
+ description: 'is calculating while MLS initializes for a strict E2EE meeting',
452
+ options: {isV2E2EEncrypted: true, state: E2eeState.Initializing},
453
+ expected: 'calculating',
454
+ },
455
+ {
456
+ description: 'is calculating while MLS joins an adaptive E2EE meeting',
457
+ options: {
458
+ isV2E2EEncrypted: true,
459
+ isBestEffortE2EEncryption: true,
460
+ state: E2eeState.Joining,
461
+ },
462
+ expected: 'calculating',
463
+ },
464
+ {
465
+ description: 'is zeroTrust after a strict E2EE meeting joins MLS without untrusted media services',
466
+ options: {isV2E2EEncrypted: true, state: E2eeState.Joined},
467
+ expected: 'zeroTrust',
468
+ },
469
+ {
470
+ description:
471
+ 'is adaptiveZeroTrust after an adaptive E2EE meeting joins MLS without untrusted media services',
472
+ options: {
473
+ isV2E2EEncrypted: true,
474
+ isBestEffortE2EEncryption: true,
475
+ state: E2eeState.Joined,
476
+ },
477
+ expected: 'adaptiveZeroTrust',
478
+ },
479
+ {
480
+ description: 'is strong when an E2EE meeting has untrusted media services',
481
+ options: {
482
+ isV2E2EEncrypted: true,
483
+ state: E2eeState.Joined,
484
+ hasUntrustedMediaServices: true,
485
+ },
486
+ expected: 'strong',
487
+ },
488
+ {
489
+ description: 'is adaptiveStrong when an adaptive E2EE meeting has untrusted media services',
490
+ options: {
491
+ isV2E2EEncrypted: true,
492
+ isBestEffortE2EEncryption: true,
493
+ state: E2eeState.Joined,
494
+ hasUntrustedMediaServices: true,
495
+ },
496
+ expected: 'adaptiveStrong',
497
+ },
498
+ {
499
+ description: 'is strong when MLS is joined but the meeting is not marked E2EE', // this shouldn't ever happen in real life
500
+ options: {isV2E2EEncrypted: false, state: E2eeState.Joined},
501
+ expected: 'strong',
502
+ },
503
+ {
504
+ description: 'is failed when MLS fails in a strict E2EE meeting',
505
+ options: {isV2E2EEncrypted: true, state: E2eeState.Failed},
506
+ expected: 'failed',
507
+ },
508
+ {
509
+ description: 'is failed when MLS fails in an adaptive E2EE meeting',
510
+ options: {
511
+ isV2E2EEncrypted: true,
512
+ isBestEffortE2EEncryption: true,
513
+ state: E2eeState.Failed,
514
+ },
515
+ expected: 'failed',
516
+ },
517
+ {
518
+ description: 'is strong after MLS leaves an E2EE meeting',
519
+ options: {isV2E2EEncrypted: true, state: E2eeState.Left},
520
+ expected: 'strong',
521
+ },
522
+ {
523
+ description: 'is adaptiveStrong after MLS is evicted from an adaptive E2EE meeting',
524
+ options: {
525
+ isV2E2EEncrypted: true,
526
+ isBestEffortE2EEncryption: true,
527
+ state: E2eeState.Evicted,
528
+ },
529
+ expected: 'adaptiveStrong',
530
+ },
531
+ ].forEach(({description, options, expected}) => {
532
+ it(description, () => {
533
+ const meetingWithE2ee = createMeetingWithTrustState(options);
534
+
535
+ assert.equal(meetingWithE2ee.trustState, expected);
536
+ });
537
+ });
538
+
539
+ [
540
+ {
541
+ description: 'non-E2EE',
542
+ info: {},
543
+ e2eeState: E2eeState.Disabled,
544
+ expectedTrustStates: ['strong'],
545
+ },
546
+ {
547
+ description: 'strict E2EE',
548
+ info: {isV2E2EEncrypted: true},
549
+ e2eeState: E2eeState.Initializing,
550
+ expectedTrustStates: ['calculating', 'zeroTrust'],
551
+ },
552
+ {
553
+ description: 'best-effort E2EE',
554
+ info: {isV2E2EEncrypted: true, isBestEffortE2EEncryption: true},
555
+ e2eeState: E2eeState.Initializing,
556
+ expectedTrustStates: ['calculating', 'adaptiveZeroTrust'],
557
+ },
558
+ ].forEach(({description, info, e2eeState, expectedTrustStates}) => {
559
+ it(`emits trust updates for ${description} joins via Locus updateSelf`, () => {
560
+ TriggerProxy.trigger.restore();
561
+ const e2ee = new EventEmitter();
562
+
563
+ e2ee.state = e2eeState;
564
+ e2ee.start = sinon.stub().resolves();
565
+ const meetingWithE2ee = new Meeting(
566
+ {
567
+ userId: uuid1,
568
+ resource: uuid2,
569
+ deviceUrl: uuid3,
570
+ locus: {url: url1},
571
+ destination: testDestination,
572
+ destinationType: DESTINATION_TYPE.MEETING_ID,
573
+ correlationId,
574
+ selfId: uuid1,
575
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
576
+ },
577
+ {parent: webex}
578
+ );
579
+ const listener = sinon.spy();
580
+ const self = (state) => ({
581
+ id: uuid1,
582
+ identity: uuid1,
583
+ state,
584
+ devices: [{url: uuid3, state, mediaSessions: []}],
585
+ status: {audioStatus: 'UNKNOWN', videoStatus: 'UNKNOWN'},
586
+ controls: {audio: {}, role: {roles: []}},
587
+ });
588
+
589
+ webex.internal.device.url = uuid3;
590
+ meetingWithE2ee.locusInfo.info = info;
591
+ sinon.stub(meetingWithE2ee.members, 'locusSelfUpdate');
592
+ sinon.stub(meetingWithE2ee, 'pstnUpdate');
593
+ sinon.stub(meetingWithE2ee, 'requestScreenShareFloorIfPending');
594
+ meetingWithE2ee.locusInfo.updateSelf(self('LEFT'));
595
+ meetingWithE2ee.on(EVENT_TRIGGERS.MEETING_TRUST_STATE_CHANGED, listener);
596
+
597
+ meetingWithE2ee.locusInfo.updateSelf(self('JOINED'));
598
+
599
+ assert.equal(meetingWithE2ee.joinedWith.state, 'JOINED');
600
+ assert.equal(meetingWithE2ee.trustState, expectedTrustStates[0]);
601
+
602
+ if (expectedTrustStates.length > 1) {
603
+ e2ee.state = E2eeState.Joined;
604
+ e2ee.emit(EVENT_TRIGGERS.MEETING_E2EE_STATE_CHANGED, {state: E2eeState.Joined});
605
+ }
606
+
607
+ assert.equal(
608
+ meetingWithE2ee.trustState,
609
+ expectedTrustStates[expectedTrustStates.length - 1]
610
+ );
611
+ assert.callCount(listener, expectedTrustStates.length);
612
+ expectedTrustStates.forEach((trustState, index) => {
613
+ assert.calledWithExactly(listener.getCall(index), {trustState});
614
+ });
615
+ });
616
+ });
617
+ });
618
+
392
619
  describe('Public Api Contract', () => {
393
620
  describe('#constructor', () => {
621
+ it('forwards E2EE controller events', () => {
622
+ TriggerProxy.trigger.restore();
623
+ const e2ee = new EventEmitter();
624
+ const e2eeManager = {createE2eeController: sinon.stub().returns(e2ee)};
625
+ const meetingWithE2ee = new Meeting(
626
+ {
627
+ userId: uuid1,
628
+ resource: uuid2,
629
+ deviceUrl: uuid3,
630
+ locus: {url: url1},
631
+ destination: testDestination,
632
+ destinationType: DESTINATION_TYPE.MEETING_ID,
633
+ correlationId,
634
+ selfId: uuid1,
635
+ e2eeManager,
636
+ },
637
+ {parent: webex}
638
+ );
639
+
640
+ const events = [
641
+ [EVENT_TRIGGERS.MEETING_E2EE_SECURITY_CODE_UPDATED, {securityCode: 'SEC'}],
642
+ [EVENT_TRIGGERS.MEETING_E2EE_STATE_CHANGED, {state: E2eeState.Joined}],
643
+ [EVENT_TRIGGERS.MEETING_E2EE_MEDIA_SERVICES_CHANGED, {hasMediaServices: true}],
644
+ [EVENT_TRIGGERS.MEETING_E2EE_FAILURE, {reason: 'joinFailure'}],
645
+ ];
646
+
647
+ events.forEach(([event, payload]) => {
648
+ const listener = sinon.spy();
649
+
650
+ meetingWithE2ee.on(event, listener);
651
+ e2ee.emit(event, payload);
652
+ assert.calledOnceWithExactly(listener, payload);
653
+ });
654
+ });
655
+
656
+ it('provides the current meeting context to the E2EE controller', () => {
657
+ TriggerProxy.trigger.restore();
658
+ const e2ee = new EventEmitter();
659
+ const e2eeManager = {createE2eeController: sinon.stub().returns(e2ee)};
660
+ const meetingWithE2ee = new Meeting(
661
+ {
662
+ userId: uuid1,
663
+ resource: uuid2,
664
+ deviceUrl: uuid3,
665
+ locus: {url: url1},
666
+ destination: testDestination,
667
+ destinationType: DESTINATION_TYPE.MEETING_ID,
668
+ correlationId,
669
+ selfId: uuid1,
670
+ e2eeManager,
671
+ },
672
+ {parent: webex}
673
+ );
674
+ const e2eeContext = e2eeManager.createE2eeController.firstCall.args[0];
675
+
676
+ assert.strictEqual(e2eeContext.members, meetingWithE2ee.members);
677
+ assert.strictEqual(e2eeContext.getCorrelationId(), meetingWithE2ee.correlationId);
678
+ assert.strictEqual(e2eeContext.getLocusInfo(), meetingWithE2ee.locusInfo);
679
+ assert.strictEqual(e2eeContext.getLlmChannel(), meetingWithE2ee.llmChannel);
680
+
681
+ meetingWithE2ee.correlationId = 'updated-correlation-id';
682
+ const updatedLocusInfo = {url: 'https://locus.example.com/updated'};
683
+ const updatedLlmChannel = createMockLLMChannel();
684
+ meetingWithE2ee.locusInfo = updatedLocusInfo;
685
+ meetingWithE2ee.llmChannel = updatedLlmChannel;
686
+
687
+ assert.strictEqual(e2eeContext.getCorrelationId(), 'updated-correlation-id');
688
+ assert.strictEqual(e2eeContext.getLocusInfo(), updatedLocusInfo);
689
+ assert.strictEqual(e2eeContext.getLlmChannel(), updatedLlmChannel);
690
+ });
691
+
692
+ it('starts E2EE only when the current WDM device joins', () => {
693
+ TriggerProxy.trigger.restore();
694
+ const e2ee = new EventEmitter();
695
+
696
+ e2ee.start = sinon.stub().resolves();
697
+ const meetingWithE2ee = new Meeting(
698
+ {
699
+ userId: uuid1,
700
+ resource: uuid2,
701
+ deviceUrl: uuid3,
702
+ locus: {url: url1},
703
+ destination: testDestination,
704
+ destinationType: DESTINATION_TYPE.MEETING_ID,
705
+ correlationId,
706
+ selfId: uuid1,
707
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
708
+ },
709
+ {parent: webex}
710
+ );
711
+
712
+ sinon.stub(meetingWithE2ee.members, 'locusSelfUpdate');
713
+ sinon.stub(meetingWithE2ee, 'pstnUpdate');
714
+ sinon.stub(meetingWithE2ee, 'requestScreenShareFloorIfPending');
715
+
716
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
717
+ oldSelf: {state: 'JOINED'},
718
+ newSelf: {
719
+ state: 'JOINED',
720
+ joinedWith: {url: uuid4, state: 'JOINED'},
721
+ },
722
+ });
723
+
724
+ assert.notCalled(e2ee.start);
725
+
726
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
727
+ oldSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'LEFT'}},
728
+ newSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'JOINED'}},
729
+ });
730
+
731
+ assert.calledOnce(e2ee.start);
732
+ });
733
+
734
+ it('stops E2EE when the current WDM device is moved back to lobby', () => {
735
+ TriggerProxy.trigger.restore();
736
+ const e2ee = new EventEmitter();
737
+
738
+ e2ee.stop = sinon.stub().resolves();
739
+ const meetingWithE2ee = new Meeting(
740
+ {
741
+ userId: uuid1,
742
+ resource: uuid2,
743
+ deviceUrl: uuid3,
744
+ locus: {url: url1},
745
+ destination: testDestination,
746
+ destinationType: DESTINATION_TYPE.MEETING_ID,
747
+ correlationId,
748
+ selfId: uuid1,
749
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
750
+ },
751
+ {parent: webex}
752
+ );
753
+
754
+ sinon.stub(meetingWithE2ee.members, 'locusSelfUpdate');
755
+ sinon.stub(meetingWithE2ee, 'pstnUpdate');
756
+ sinon.stub(meetingWithE2ee, 'requestScreenShareFloorIfPending');
757
+
758
+ // Already unadmitted -> still unadmitted: not an entering-lobby edge, so do not stop.
759
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
760
+ oldSelf: {isUserUnadmitted: true},
761
+ newSelf: {isUserUnadmitted: true},
762
+ });
763
+
764
+ assert.notCalled(e2ee.stop);
765
+
766
+ // Admitted -> still admitted: not a lobby transition, so do not stop.
767
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
768
+ oldSelf: {isUserUnadmitted: false},
769
+ newSelf: {isUserUnadmitted: false},
770
+ });
771
+
772
+ assert.notCalled(e2ee.stop);
773
+
774
+ // Unadmitted -> admitted (host admits from lobby): the inverse edge must not stop E2EE.
775
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
776
+ oldSelf: {isUserUnadmitted: true},
777
+ newSelf: {isUserUnadmitted: false},
778
+ });
779
+
780
+ assert.notCalled(e2ee.stop);
781
+
782
+ // Admitted -> moved back to lobby: leave the MLS group. The controller self-guards when
783
+ // E2EE was never started, so the listener calls stop() unconditionally on this edge.
784
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
785
+ oldSelf: {isUserUnadmitted: false},
786
+ newSelf: {isUserUnadmitted: true},
787
+ });
788
+
789
+ assert.calledOnce(e2ee.stop);
790
+ });
791
+
792
+ it('stops E2EE when the current WDM device leaves the joined state', () => {
793
+ TriggerProxy.trigger.restore();
794
+ const e2ee = new EventEmitter();
795
+
796
+ e2ee.stop = sinon.stub().resolves();
797
+ const meetingWithE2ee = new Meeting(
798
+ {
799
+ userId: uuid1,
800
+ resource: uuid2,
801
+ deviceUrl: uuid3,
802
+ locus: {url: url1},
803
+ destination: testDestination,
804
+ destinationType: DESTINATION_TYPE.MEETING_ID,
805
+ correlationId,
806
+ selfId: uuid1,
807
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
808
+ },
809
+ {parent: webex}
810
+ );
811
+
812
+ sinon.stub(meetingWithE2ee.members, 'locusSelfUpdate');
813
+ sinon.stub(meetingWithE2ee, 'pstnUpdate');
814
+ sinon.stub(meetingWithE2ee, 'requestScreenShareFloorIfPending');
815
+
816
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
817
+ oldSelf: {joinedWith: {url: uuid3, state: 'JOINED'}},
818
+ newSelf: {joinedWith: {url: uuid3, state: 'LEFT'}},
819
+ });
820
+
821
+ assert.calledOnce(e2ee.stop);
822
+ });
823
+
824
+ it('emits trust state changes caused by Locus and E2EE updates', () => {
825
+ TriggerProxy.trigger.restore();
826
+ const e2ee = new EventEmitter();
827
+
828
+ e2ee.state = E2eeState.Initializing;
829
+ e2ee.hasUntrustedMediaServices = false;
830
+ e2ee.start = sinon.stub().resolves();
831
+ e2ee.stop = sinon.stub().resolves();
832
+ const meetingWithE2ee = new Meeting(
833
+ {
834
+ userId: uuid1,
835
+ resource: uuid2,
836
+ deviceUrl: uuid3,
837
+ locus: {url: url1},
838
+ destination: testDestination,
839
+ destinationType: DESTINATION_TYPE.MEETING_ID,
840
+ correlationId,
841
+ selfId: uuid1,
842
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
843
+ },
844
+ {parent: webex}
845
+ );
846
+ const listener = sinon.spy();
847
+
848
+ assert.equal(EVENT_TRIGGERS.MEETING_TRUST_STATE_CHANGED, 'meeting:trustStateChanged');
849
+ meetingWithE2ee.on(EVENT_TRIGGERS.MEETING_TRUST_STATE_CHANGED, listener);
850
+ // E2EE meeting info alone does not produce a trust state until this device joins.
851
+ meetingWithE2ee.locusInfo.info = {isV2E2EEncrypted: true};
852
+ meetingWithE2ee.locusInfo.emitScoped({}, LOCUSINFO.EVENTS.MEETING_INFO_UPDATED, {
853
+ isInitializing: false,
854
+ });
855
+
856
+ assert.isUndefined(meetingWithE2ee.trustState);
857
+ assert.notCalled(listener);
858
+
859
+ // This device joins while aggregate self.state stays JOINED; trust depends on joinedWith.
860
+ meetingWithE2ee.joinedWith = {state: 'JOINED'};
861
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
862
+ oldSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'NOT_JOINED'}},
863
+ newSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'JOINED'}},
864
+ });
865
+
866
+ assert.equal(meetingWithE2ee.trustState, 'calculating');
867
+ assert.calledOnce(listener);
868
+ assert.calledWithExactly(listener.getCall(0), {trustState: 'calculating'});
869
+
870
+ // No trust-state input changed, so a duplicate self update must not emit again.
871
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
872
+ oldSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'JOINED'}},
873
+ newSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'JOINED'}},
874
+ });
875
+ assert.calledOnce(listener);
876
+
877
+ // MLS joining changes the trust state from calculating to zeroTrust.
878
+ e2ee.state = E2eeState.Joined;
879
+ e2ee.emit(EVENT_TRIGGERS.MEETING_E2EE_STATE_CHANGED, {state: E2eeState.Joined});
880
+
881
+ assert.equal(meetingWithE2ee.trustState, 'zeroTrust');
882
+ assert.calledTwice(listener);
883
+ assert.calledWithExactly(listener.getCall(1), {trustState: 'zeroTrust'});
884
+
885
+ // An untrusted media service downgrades zeroTrust to strong.
886
+ e2ee.hasUntrustedMediaServices = true;
887
+ e2ee.emit(EVENT_TRIGGERS.MEETING_E2EE_MEDIA_SERVICES_CHANGED, {hasMediaServices: true});
888
+
889
+ assert.equal(meetingWithE2ee.trustState, 'strong');
890
+ assert.calledThrice(listener);
891
+ assert.calledWithExactly(listener.getCall(2), {trustState: 'strong'});
892
+
893
+ // Locus enables best-effort encryption; the untrusted service keeps trust at adaptiveStrong.
894
+ // (in real life best-effort encryption is not something that changes dynamically)
895
+ meetingWithE2ee.locusInfo.info = {
896
+ isV2E2EEncrypted: true,
897
+ isBestEffortE2EEncryption: true,
898
+ };
899
+ meetingWithE2ee.locusInfo.emitScoped(
900
+ {},
901
+ LOCUSINFO.EVENTS.MEETING_INFO_UPDATED,
902
+ {isInitializing: false}
903
+ );
904
+
905
+ assert.equal(meetingWithE2ee.trustState, 'adaptiveStrong');
906
+ assert.calledWithExactly(listener.getCall(3), {trustState: 'adaptiveStrong'});
907
+
908
+ // Removing the untrusted service restores the adaptive zero-trust state.
909
+ e2ee.hasUntrustedMediaServices = false;
910
+ e2ee.emit(EVENT_TRIGGERS.MEETING_E2EE_MEDIA_SERVICES_CHANGED, {hasMediaServices: false});
911
+
912
+ assert.equal(meetingWithE2ee.trustState, 'adaptiveZeroTrust');
913
+ assert.calledWithExactly(listener.getCall(4), {trustState: 'adaptiveZeroTrust'});
914
+
915
+ // MLS failure takes precedence over the adaptive trust calculation.
916
+ e2ee.state = E2eeState.Failed;
917
+ e2ee.emit(EVENT_TRIGGERS.MEETING_E2EE_STATE_CHANGED, {state: E2eeState.Failed});
918
+
919
+ assert.equal(meetingWithE2ee.trustState, 'failed');
920
+ assert.calledWithExactly(listener.getCall(5), {trustState: 'failed'});
921
+
922
+ // This device leaves while aggregate self.state remains JOINED.
923
+ meetingWithE2ee.joinedWith = {state: 'LEFT'};
924
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
925
+ oldSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'JOINED'}},
926
+ newSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'LEFT'}},
927
+ });
928
+
929
+ assert.isUndefined(meetingWithE2ee.trustState);
930
+ assert.calledWithExactly(listener.getCall(6), {trustState: undefined});
931
+
932
+ // The unchanged left state leaves trustState undefined without another event.
933
+ meetingWithE2ee.locusInfo.emitScoped({}, EVENTS.LOCUS_INFO_UPDATE_SELF, {
934
+ oldSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'LEFT'}},
935
+ newSelf: {state: 'JOINED', joinedWith: {url: uuid3, state: 'LEFT'}},
936
+ });
937
+ assert.callCount(listener, 7);
938
+ });
939
+
940
+ it('reports MLS failure while joined and is undefined after leaving', () => {
941
+ const e2ee = new EventEmitter();
942
+
943
+ e2ee.state = E2eeState.Joining;
944
+ const meetingWithE2ee = new Meeting(
945
+ {
946
+ userId: uuid1,
947
+ resource: uuid2,
948
+ deviceUrl: uuid3,
949
+ locus: {url: url1},
950
+ destination: testDestination,
951
+ destinationType: DESTINATION_TYPE.MEETING_ID,
952
+ correlationId,
953
+ selfId: uuid1,
954
+ e2eeManager: {createE2eeController: sinon.stub().returns(e2ee)},
955
+ },
956
+ {parent: webex}
957
+ );
958
+ meetingWithE2ee.locusInfo.info = {isV2E2EEncrypted: true};
959
+
960
+ assert.isUndefined(meetingWithE2ee.trustState);
961
+
962
+ meetingWithE2ee.joinedWith = {state: 'JOINED'};
963
+ assert.equal(meetingWithE2ee.trustState, 'calculating');
964
+
965
+ e2ee.state = E2eeState.Failed;
966
+ e2ee.emit(EVENT_TRIGGERS.MEETING_E2EE_STATE_CHANGED, {state: E2eeState.Failed});
967
+ assert.equal(meetingWithE2ee.trustState, 'failed');
968
+
969
+ meetingWithE2ee.joinedWith = {state: 'NOT_JOINED'};
970
+ assert.isUndefined(meetingWithE2ee.trustState);
971
+ });
972
+
394
973
  it('should have created a meeting object with public properties', () => {
395
974
  assert.exists(meeting);
396
975
  assert.exists(meeting.webex);
@@ -539,6 +1118,7 @@ describe('plugin-meetings', () => {
539
1118
  client_id: 'mock-client-id',
540
1119
  },
541
1120
  meetings: {
1121
+ assetsBaseUrl: '/assets/plugin-meetings/',
542
1122
  reconnection: {
543
1123
  enabled: false,
544
1124
  },
@@ -3405,6 +3985,53 @@ describe('plugin-meetings', () => {
3405
3985
  }
3406
3986
  });
3407
3987
 
3988
+ it('updates E2EE signaling after the LLM channel connects', async () => {
3989
+ const e2ee = {llmChannelChanged: sinon.stub()};
3990
+ const mockChannel = createMockLLMChannel();
3991
+
3992
+ meeting.e2ee = e2ee;
3993
+ sinon.stub(meeting, 'isJoined').returns(true);
3994
+ webex.internal.llm.createChannel.returns(mockChannel);
3995
+ meeting.updateLLMConnection.restore();
3996
+
3997
+ await meeting.updateLLMConnection();
3998
+
3999
+ assert.calledOnce(e2ee.llmChannelChanged);
4000
+ assert.strictEqual(meeting.llmChannel, mockChannel);
4001
+ });
4002
+
4003
+ it('updates E2EE signaling when the LLM connection fails', async () => {
4004
+ const e2ee = {llmChannelChanged: sinon.stub()};
4005
+ const mockChannel = createMockLLMChannel({
4006
+ registerAndConnect: sinon.stub().rejects(new Error('connect failed')),
4007
+ });
4008
+
4009
+ meeting.e2ee = e2ee;
4010
+ sinon.stub(meeting, 'isJoined').returns(true);
4011
+ webex.internal.llm.createChannel.returns(mockChannel);
4012
+ meeting.updateLLMConnection.restore();
4013
+
4014
+ await assert.isRejected(meeting.updateLLMConnection(), 'connect failed');
4015
+
4016
+ assert.calledTwice(e2ee.llmChannelChanged);
4017
+ assert.isUndefined(meeting.llmChannel);
4018
+ });
4019
+
4020
+ it('updates E2EE signaling when the LLM channel is cleaned up', async () => {
4021
+ const e2ee = {llmChannelChanged: sinon.stub()};
4022
+ const mockChannel = createMockLLMChannel();
4023
+
4024
+ meeting.e2ee = e2ee;
4025
+ meeting.llmChannel = mockChannel;
4026
+ sinon.stub(meeting.annotation, 'deregisterEvents');
4027
+ sinon.stub(meeting, 'clearLLMHealthCheckTimer');
4028
+
4029
+ await meeting.cleanupLLMConneciton({preserveVoiceaChannel: true});
4030
+
4031
+ assert.calledOnce(e2ee.llmChannelChanged);
4032
+ assert.isUndefined(meeting.llmChannel);
4033
+ });
4034
+
3408
4035
  it('handles Locus LLM events', async () => {
3409
4036
  const locusInfoParseStub = sinon.stub(meeting.locusInfo, 'parse');
3410
4037
  sinon.stub(meeting, 'isJoined').returns(true);
@@ -13553,6 +14180,37 @@ describe('plugin-meetings', () => {
13553
14180
 
13554
14181
  describe('#setUpLocusInfoMeetingListener', () => {
13555
14182
  let cleanUpSpy;
14183
+
14184
+ [
14185
+ {
14186
+ description: 'host ends the meeting',
14187
+ parsedLocus: {fullState: {type: 'MEETING', state: 'INACTIVE'}},
14188
+ },
14189
+ {
14190
+ description: 'host removes this user',
14191
+ parsedLocus: {
14192
+ fullState: {type: 'MEETING', state: 'ACTIVE'},
14193
+ self: {removed: true},
14194
+ },
14195
+ },
14196
+ ].forEach(({description, parsedLocus}) => {
14197
+ it(`stops E2EE when Locus destroys the meeting without a leave (${description})`, async () => {
14198
+ const e2eeStop = sinon.stub().resolves();
14199
+ const destroyListener = sinon.spy();
14200
+
14201
+ meeting.e2ee = {stop: e2eeStop};
14202
+ meeting.locusInfo.parsedLocus = parsedLocus;
14203
+ meeting.locusInfo.fullState = parsedLocus.fullState;
14204
+ meeting.locusInfo.on(EVENTS.DESTROY_MEETING, destroyListener);
14205
+
14206
+ meeting.locusInfo.isMeetingActive();
14207
+ await testUtils.flushPromises();
14208
+
14209
+ assert.calledOnceWithMatch(destroyListener, {shouldLeave: false});
14210
+ assert.calledOnce(e2eeStop);
14211
+ });
14212
+ });
14213
+
13556
14214
  it('listens to destroy meeting event from locus info ', (done) => {
13557
14215
  TriggerProxy.trigger.reset();
13558
14216
  sinon.stub(meeting.reconnectionManager, 'cleanUp');
@@ -15832,6 +16490,10 @@ describe('plugin-meetings', () => {
15832
16490
  meeting.annotation.deregisterEvents = sinon.stub();
15833
16491
  meeting.clearLLMHealthCheckTimer = sinon.stub();
15834
16492
  meeting.stopTranscription = sinon.stub();
16493
+ meeting.e2ee = {
16494
+ llmChannelChanged: sinon.stub(),
16495
+ stop: sinon.stub().resolves(),
16496
+ };
15835
16497
  meeting.shareStatus = 'no-share';
15836
16498
  });
15837
16499