@webex/plugin-meetings 3.13.0-next.5 → 3.13.0-next.7
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/babel.config.js +17 -1
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/common/wasm-loader.js +174 -0
- package/dist/common/wasm-loader.js.map +1 -0
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/e2ee/E2eeManager.js +91 -0
- package/dist/e2ee/E2eeManager.js.map +1 -0
- package/dist/e2ee/E2eeSignaling.js +200 -0
- package/dist/e2ee/E2eeSignaling.js.map +1 -0
- package/dist/e2ee/MediaEncryptionService.js +75 -0
- package/dist/e2ee/MediaEncryptionService.js.map +1 -0
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meetings/index.js +20 -0
- package/dist/meetings/index.js.map +1 -1
- package/dist/types/common/wasm-loader.d.ts +55 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/e2ee/E2eeManager.d.ts +23 -0
- package/dist/types/e2ee/E2eeSignaling.d.ts +94 -0
- package/dist/types/e2ee/MediaEncryptionService.d.ts +27 -0
- package/dist/types/meetings/index.d.ts +4 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +1 -1
- package/src/common/wasm-loader.ts +124 -0
- package/src/config.ts +1 -0
- package/src/e2ee/E2eeManager.ts +58 -0
- package/src/e2ee/E2eeSignaling.ts +215 -0
- package/src/e2ee/MediaEncryptionService.ts +41 -0
- package/src/meetings/ai-docs/meetings-spec.md +2 -0
- package/src/meetings/index.ts +18 -0
- package/test/unit/spec/common/wasm-loader.ts +171 -0
- package/test/unit/spec/e2ee/E2eeManager.ts +82 -0
- package/test/unit/spec/e2ee/E2eeSignaling.ts +172 -0
- package/test/unit/spec/e2ee/MediaEncryptionService.ts +43 -0
- package/test/unit/spec/meetings/index.js +20 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const MEDIA_ENCRYPTION_SERVICE = 'media-encryption';
|
|
6
|
+
|
|
7
|
+
/** The bound webex.request function shape consumed by this adapter. */
|
|
8
|
+
type WebexRequestMethod = (options: Record<string, any>) => Promise<any>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Routes the MLS engine's protocol HTTP requests to the media-encryption service via
|
|
12
|
+
* webex.request. Bodies are plain JS objects; MLS owns the conversion to/from the engine's bytes.
|
|
13
|
+
* Requests use standard webex auth (Authorization bearer token) — no custom header is needed.
|
|
14
|
+
*/
|
|
15
|
+
export default class MediaEncryptionService {
|
|
16
|
+
private readonly webexRequest: WebexRequestMethod;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} deps
|
|
20
|
+
* @param {WebexRequestMethod} deps.webexRequest - The (bound) webex.request method.
|
|
21
|
+
*/
|
|
22
|
+
constructor({webexRequest}: {webexRequest: WebexRequestMethod}) {
|
|
23
|
+
this.webexRequest = webexRequest;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} url - The absolute request URL provided by the engine.
|
|
28
|
+
* @param {unknown} body - Request payload, sent as JSON.
|
|
29
|
+
* @returns {Promise<unknown>} The JSON-parsed response body.
|
|
30
|
+
*/
|
|
31
|
+
async request(url: string, body: unknown): Promise<unknown> {
|
|
32
|
+
const {body: responseBody} = await this.webexRequest({
|
|
33
|
+
method: 'POST',
|
|
34
|
+
service: MEDIA_ENCRYPTION_SERVICE,
|
|
35
|
+
url,
|
|
36
|
+
body,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return responseBody;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -115,6 +115,7 @@ Webex core host, device and Mercury plugins, meeting-info services, Meeting cons
|
|
|
115
115
|
| `MEETINGS-R-003` | `executeRegistrationStep()` marks a step `true` whenever its supplied promise resolves and rethrows a rejection without resetting other flags. `fetchUserPreferredWebexSite()` catches its own failures and resolves, while the `startReachability` registration callback catches that gather rejection and resolves; those two steps are therefore marked successful even when their underlying work failed. `unregister()` removes Locus, ROAP, and `ONLINE` Mercury listeners plus device state, but leaves the `OFFLINE` listener installed. | Registration status records wrapper settlement, not necessarily underlying site/reachability success; other rejected steps preserve partial progress until the next `register()` reset, and the residual `OFFLINE` listener must stay visible as a teardown gap. | `src/meetings/index.ts` | `test/unit/spec/meetings/index.js` | characterize absorbed site/reachability failures, partial status after a non-absorbed rejection, and the surviving `OFFLINE` callback | PRESENT |
|
|
116
116
|
| `MEETINGS-R-004` | `register()` starts site, geo, reachability, device-registration, and H.264 work together through `Promise.all`; Mercury connect is chained after device registration. Each wrapper-resolved step updates its own status, including the failure-absorbing site and reachability wrappers. `syncMeetings()` runs later from the Mercury `ONLINE` handler installed by `listenForEvents()`. | Registration readiness and active-meeting synchronization are distinct phases, and preserving wrapper-level settlement and actual concurrency prevents callers from depending on a nonexistent success definition or serial order. | `src/meetings/index.ts`, `src/meetings/meetings.types.ts` | `test/unit/spec/meetings/index.js` | none | PRESENT |
|
|
117
117
|
| `MEETINGS-R-007` | `emitWasmRuntimePerformance(correlationId)` is a `once()`-wrapped private probe that runs `WasmRuntimeProbe.check()` and reports `WASM_RUNTIME_PERFORMANCE` (`js_sdk_wasm_runtime_performance`) with `status`, `capability`, `reason`, the destructured measurements `divRatio`, `sqrtRatio`, `addNsPerOp`, `addMedianMs`, `divMedianMs`, `sqrtMedianMs`, and `correlation_id`. Each measurement defaults to `null` when `result.measurements` is absent or omits it. Both a probe rejection and a metric-submission rejection are caught and logged only. | The probe is diagnostic: it exists to find browsers where real-time WASM effects run poorly, so it must never be able to fail meeting creation. Explicit `null` defaults keep the metric schema fixed-width so the fields stay comparable across browsers that report partial measurements, and `once()` keeps one sample per plugin instance rather than one per meeting. | `src/meetings/index.ts`, `src/metrics/constants.ts` | `test/unit/spec/meetings/index.js` | none | PRESENT |
|
|
118
|
+
| `MEETINGS-R-008` | Meetings owns one shared `WasmLoader`; after successful registration it starts E2EE WASM preloading when `meetings.enableE2ee` is true and WebAssembly is supported. Preload is fire-and-forget, so a preload rejection is logged and does not change registration success. | Keep module initialization off the meeting join path while preserving registration behavior when the optional asset is unavailable. | `src/meetings/index.ts`, `src/common/wasm-loader.ts`, `src/e2ee/E2eeManager.ts` | `test/unit/spec/meetings/index.js`, `test/unit/spec/common/wasm-loader.ts`, `test/unit/spec/e2ee/E2eeManager.ts` | Actual E2EE assets are supplied separately. | PRESENT |
|
|
118
119
|
| `MEETINGS-R-005` | Mercury/Locus events resolve an existing meeting by supported keys before creating or routing a new object. | Stable meeting identity prevents duplicate Meeting objects and misrouted realtime updates. | `src/meetings/index.ts`, `src/meetings/collection.ts` | `test/unit/spec/meetings/index.js`, `test/unit/spec/meetings/collection.js` | none | PRESENT |
|
|
119
120
|
| `MEETINGS-R-006` | Reachability, geo hints, site preferences, PMR, and active-meeting queries delegate to their current request/controller boundaries. | Central plugin access must preserve host credentials, service discovery, and established response/error behavior. | `src/meetings/index.ts`, `src/meetings/request.ts` | `test/unit/spec/meetings/request.js` | none | PRESENT |
|
|
120
121
|
|
|
@@ -289,6 +290,7 @@ Use the current mirrored suites: `test/unit/spec/meetings/collection.js`, `test/
|
|
|
289
290
|
| `MEETINGS-R-005` | `test/unit/spec/meetings/index.js`, `test/unit/spec/meetings/collection.js` | verify alternate-key collision cases |
|
|
290
291
|
| `MEETINGS-R-006` | `test/unit/spec/meetings/request.js` | none |
|
|
291
292
|
| `MEETINGS-R-007` | `test/unit/spec/meetings/index.js` | covered for the full-measurements payload, the `null` defaults when measurements are absent, and the swallowed probe rejection |
|
|
293
|
+
| `MEETINGS-R-008` | `test/unit/spec/meetings/index.js`, `test/unit/spec/common/wasm-loader.ts`, `test/unit/spec/e2ee/E2eeManager.ts` | cover configured asset URL, config/capability gating, module caching/retry, and registration resilience |
|
|
292
294
|
|
|
293
295
|
## Traceability
|
|
294
296
|
|
package/src/meetings/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ import LoggerRequest from '../common/logs/request';
|
|
|
21
21
|
import Trigger from '../common/events/trigger-proxy';
|
|
22
22
|
import Media from '../media';
|
|
23
23
|
import MeetingUtil from '../meeting/util';
|
|
24
|
+
import WasmLoader from '../common/wasm-loader';
|
|
25
|
+
import E2eeManager from '../e2ee/E2eeManager';
|
|
24
26
|
import {
|
|
25
27
|
MEETINGS,
|
|
26
28
|
EVENTS,
|
|
@@ -210,6 +212,8 @@ export default class Meetings extends WebexPlugin {
|
|
|
210
212
|
breakoutLocusForHandleLater: any;
|
|
211
213
|
namespace = MEETINGS;
|
|
212
214
|
registrationStatus: MeetingRegistrationStatus;
|
|
215
|
+
wasmLoader?: WasmLoader;
|
|
216
|
+
e2eeManager?: E2eeManager;
|
|
213
217
|
|
|
214
218
|
/**
|
|
215
219
|
* Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
|
|
@@ -348,6 +352,9 @@ export default class Meetings extends WebexPlugin {
|
|
|
348
352
|
getUserMedia: Media.getUserMedia,
|
|
349
353
|
};
|
|
350
354
|
|
|
355
|
+
// Shared runtime cache for WASM modules used by meetings.
|
|
356
|
+
this.wasmLoader = new WasmLoader();
|
|
357
|
+
|
|
351
358
|
this.onReady();
|
|
352
359
|
}
|
|
353
360
|
|
|
@@ -808,6 +815,10 @@ export default class Meetings extends WebexPlugin {
|
|
|
808
815
|
mediaLogger = new MediaLogger();
|
|
809
816
|
setLogger(mediaLogger);
|
|
810
817
|
|
|
818
|
+
// Construct after READY because the manager uses the initialized webex client and config.
|
|
819
|
+
// @ts-ignore
|
|
820
|
+
this.e2eeManager = new E2eeManager({webex: this.webex, wasmLoader: this.wasmLoader});
|
|
821
|
+
|
|
811
822
|
/**
|
|
812
823
|
* The MeetingInfo object to interact with server
|
|
813
824
|
* @instance
|
|
@@ -1125,6 +1136,13 @@ export default class Meetings extends WebexPlugin {
|
|
|
1125
1136
|
);
|
|
1126
1137
|
this.registered = true;
|
|
1127
1138
|
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETINGS_REGISTRATION_SUCCESS);
|
|
1139
|
+
|
|
1140
|
+
// Preload is best-effort and must not delay or fail Meetings registration.
|
|
1141
|
+
this.e2eeManager?.preload().catch((error) => {
|
|
1142
|
+
LoggerProxy.logger.warn(
|
|
1143
|
+
`Meetings:index#register --> E2EE preload failed: ${error?.message || error}`
|
|
1144
|
+
);
|
|
1145
|
+
});
|
|
1128
1146
|
})
|
|
1129
1147
|
.catch((error) => {
|
|
1130
1148
|
LoggerProxy.logger.error(
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import 'jsdom-global/register';
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import sinon from 'sinon';
|
|
7
|
+
import WasmLoader from '@webex/plugin-meetings/src/common/wasm-loader';
|
|
8
|
+
|
|
9
|
+
describe('plugin-meetings', () => {
|
|
10
|
+
describe('WasmLoader', () => {
|
|
11
|
+
const WASM_URL = '/assets/e2ee.wasm';
|
|
12
|
+
const OTHER_WASM_URL = '/assets/other.wasm';
|
|
13
|
+
|
|
14
|
+
let factory;
|
|
15
|
+
let importModule;
|
|
16
|
+
let moduleInstance;
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
moduleInstance = {name: 'e2ee-module'};
|
|
20
|
+
factory = sinon.stub().resolves(moduleInstance);
|
|
21
|
+
importModule = sinon.stub().resolves({default: factory});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
sinon.restore();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('get', () => {
|
|
29
|
+
it('derives the .js loader url from the .wasm url and points locateFile at the .wasm binary', async () => {
|
|
30
|
+
const loader = new WasmLoader({importModule});
|
|
31
|
+
|
|
32
|
+
const result = await loader.get(WASM_URL);
|
|
33
|
+
|
|
34
|
+
assert.calledOnceWithExactly(importModule, '/assets/e2ee.js');
|
|
35
|
+
assert.calledOnce(factory);
|
|
36
|
+
const {locateFile} = factory.firstCall.args[0];
|
|
37
|
+
assert.equal(locateFile('e2ee.wasm'), WASM_URL);
|
|
38
|
+
assert.equal(locateFile('e2ee.worker.js'), 'e2ee.worker.js');
|
|
39
|
+
assert.strictEqual(result, moduleInstance);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
wasmUrl: 'https://cdn.example.com/x.wasm-assets/e2ee-0.0.1.wasm',
|
|
45
|
+
jsUrl: 'https://cdn.example.com/x.wasm-assets/e2ee-0.0.1.js',
|
|
46
|
+
},
|
|
47
|
+
{wasmUrl: '/assets/e2ee.wasm?v=1', jsUrl: '/assets/e2ee.js?v=1'},
|
|
48
|
+
{wasmUrl: '/assets/e2ee.wasm#hash', jsUrl: '/assets/e2ee.js#hash'},
|
|
49
|
+
].forEach(({wasmUrl, jsUrl}) => {
|
|
50
|
+
it(`imports ${jsUrl} for ${wasmUrl}, replacing only the .wasm suffix`, async () => {
|
|
51
|
+
const loader = new WasmLoader({importModule});
|
|
52
|
+
|
|
53
|
+
await loader.get(wasmUrl);
|
|
54
|
+
|
|
55
|
+
assert.calledOnceWithExactly(importModule, jsUrl);
|
|
56
|
+
assert.equal(factory.firstCall.args[0].locateFile('e2ee.wasm'), wasmUrl);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('loads each url only once and returns the cached instance on subsequent calls', async () => {
|
|
61
|
+
const loader = new WasmLoader({importModule});
|
|
62
|
+
|
|
63
|
+
const first = await loader.get(WASM_URL);
|
|
64
|
+
const second = await loader.get(WASM_URL);
|
|
65
|
+
|
|
66
|
+
assert.calledOnce(importModule);
|
|
67
|
+
assert.calledOnce(factory);
|
|
68
|
+
assert.strictEqual(first, second);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('shares a single load across concurrent calls for the same url', async () => {
|
|
72
|
+
const loader = new WasmLoader({importModule});
|
|
73
|
+
|
|
74
|
+
const [first, second] = await Promise.all([loader.get(WASM_URL), loader.get(WASM_URL)]);
|
|
75
|
+
|
|
76
|
+
assert.calledOnce(importModule);
|
|
77
|
+
assert.strictEqual(first, second);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('loads distinct urls independently', async () => {
|
|
81
|
+
const otherInstance = {name: 'other-module'};
|
|
82
|
+
importModule
|
|
83
|
+
.withArgs('/assets/e2ee.js')
|
|
84
|
+
.resolves({default: factory})
|
|
85
|
+
.withArgs('/assets/other.js')
|
|
86
|
+
.resolves({default: sinon.stub().resolves(otherInstance)});
|
|
87
|
+
const loader = new WasmLoader({importModule});
|
|
88
|
+
|
|
89
|
+
const e2ee = await loader.get(WASM_URL);
|
|
90
|
+
const other = await loader.get(OTHER_WASM_URL);
|
|
91
|
+
|
|
92
|
+
assert.calledTwice(importModule);
|
|
93
|
+
assert.calledWith(importModule, '/assets/e2ee.js');
|
|
94
|
+
assert.calledWith(importModule, '/assets/other.js');
|
|
95
|
+
assert.strictEqual(e2ee, moduleInstance);
|
|
96
|
+
assert.strictEqual(other, otherInstance);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('resets so a failed load can be retried, then rejects', async () => {
|
|
100
|
+
const error = new Error('network down');
|
|
101
|
+
importModule.onFirstCall().rejects(error).onSecondCall().resolves({default: factory});
|
|
102
|
+
const loader = new WasmLoader({importModule});
|
|
103
|
+
|
|
104
|
+
await assert.isRejected(
|
|
105
|
+
loader.get(WASM_URL),
|
|
106
|
+
/Failed to load WASM module \/assets\/e2ee\.wasm/
|
|
107
|
+
);
|
|
108
|
+
assert.isFalse(loader.isLoaded(WASM_URL));
|
|
109
|
+
|
|
110
|
+
const result = await loader.get(WASM_URL);
|
|
111
|
+
|
|
112
|
+
assert.calledTwice(importModule);
|
|
113
|
+
assert.strictEqual(result, moduleInstance);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('preserves the underlying error as the cause when the factory fails', async () => {
|
|
117
|
+
const error = new Error('instantiate failed');
|
|
118
|
+
factory.rejects(error);
|
|
119
|
+
const loader = new WasmLoader({importModule});
|
|
120
|
+
|
|
121
|
+
const rejection = await loader.get(WASM_URL).catch((e) => e);
|
|
122
|
+
|
|
123
|
+
assert.equal(
|
|
124
|
+
rejection.message,
|
|
125
|
+
'Failed to load WASM module /assets/e2ee.wasm: Error: instantiate failed'
|
|
126
|
+
);
|
|
127
|
+
assert.strictEqual(rejection.cause, error);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('preload', () => {
|
|
132
|
+
it('warms the cache for the given url', async () => {
|
|
133
|
+
const loader = new WasmLoader({importModule});
|
|
134
|
+
|
|
135
|
+
await loader.preload(WASM_URL);
|
|
136
|
+
|
|
137
|
+
assert.calledOnceWithExactly(importModule, '/assets/e2ee.js');
|
|
138
|
+
assert.isTrue(loader.isLoaded(WASM_URL));
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe('isLoaded', () => {
|
|
143
|
+
it('is false for an unknown url', () => {
|
|
144
|
+
const loader = new WasmLoader({importModule});
|
|
145
|
+
|
|
146
|
+
assert.isFalse(loader.isLoaded(WASM_URL));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('is false while loading is in flight and true once resolved', async () => {
|
|
150
|
+
const loader = new WasmLoader({importModule});
|
|
151
|
+
|
|
152
|
+
const pending = loader.get(WASM_URL);
|
|
153
|
+
|
|
154
|
+
assert.isFalse(loader.isLoaded(WASM_URL));
|
|
155
|
+
|
|
156
|
+
await pending;
|
|
157
|
+
|
|
158
|
+
assert.isTrue(loader.isLoaded(WASM_URL));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('tracks each url independently', async () => {
|
|
162
|
+
const loader = new WasmLoader({importModule});
|
|
163
|
+
|
|
164
|
+
await loader.get(WASM_URL);
|
|
165
|
+
|
|
166
|
+
assert.isTrue(loader.isLoaded(WASM_URL));
|
|
167
|
+
assert.isFalse(loader.isLoaded(OTHER_WASM_URL));
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import 'jsdom-global/register';
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import sinon from 'sinon';
|
|
7
|
+
import E2eeManager from '@webex/plugin-meetings/src/e2ee/E2eeManager';
|
|
8
|
+
import WasmLoader from '@webex/plugin-meetings/src/common/wasm-loader';
|
|
9
|
+
import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
|
|
10
|
+
|
|
11
|
+
describe('plugin-meetings', () => {
|
|
12
|
+
describe('E2eeManager', () => {
|
|
13
|
+
let supportsWasmStub;
|
|
14
|
+
|
|
15
|
+
const makeWebex = (enableE2ee?: boolean, assetsBaseUrl = '/assets/plugin-meetings/') => ({
|
|
16
|
+
config: {meetings: {enableE2ee, assetsBaseUrl}},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const makeWasmLoader = () => {
|
|
20
|
+
const wasmLoader = sinon.createStubInstance(WasmLoader);
|
|
21
|
+
wasmLoader.preload.resolves();
|
|
22
|
+
|
|
23
|
+
return wasmLoader;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
supportsWasmStub = sinon
|
|
28
|
+
.stub(WebCapabilities, 'supportsWasm')
|
|
29
|
+
.returns(CapabilityState.CAPABLE);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
sinon.restore();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('preload', () => {
|
|
37
|
+
it('preloads the module from the configured assets directory when enabled and supported', async () => {
|
|
38
|
+
const wasmLoader = makeWasmLoader();
|
|
39
|
+
const manager = new E2eeManager({
|
|
40
|
+
webex: makeWebex(true, 'https://cdn.example.com/sdk/meetings/'),
|
|
41
|
+
wasmLoader,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
await manager.preload();
|
|
45
|
+
|
|
46
|
+
assert.calledOnceWithExactly(
|
|
47
|
+
wasmLoader.preload,
|
|
48
|
+
'https://cdn.example.com/sdk/meetings/e2ee-0.0.1.wasm'
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('does not preload when the feature is disabled', async () => {
|
|
53
|
+
const wasmLoader = makeWasmLoader();
|
|
54
|
+
const manager = new E2eeManager({webex: makeWebex(false), wasmLoader});
|
|
55
|
+
|
|
56
|
+
await manager.preload();
|
|
57
|
+
|
|
58
|
+
assert.notCalled(wasmLoader.preload);
|
|
59
|
+
assert.calledOnce(supportsWasmStub);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('does not preload when WebAssembly is unsupported', async () => {
|
|
63
|
+
supportsWasmStub.returns(CapabilityState.NOT_CAPABLE);
|
|
64
|
+
const wasmLoader = makeWasmLoader();
|
|
65
|
+
const manager = new E2eeManager({webex: makeWebex(true), wasmLoader});
|
|
66
|
+
|
|
67
|
+
await manager.preload();
|
|
68
|
+
|
|
69
|
+
assert.notCalled(wasmLoader.preload);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('propagates preload errors for the registration caller to handle', async () => {
|
|
73
|
+
const error = new Error('asset load failed');
|
|
74
|
+
const wasmLoader = makeWasmLoader();
|
|
75
|
+
wasmLoader.preload.rejects(error);
|
|
76
|
+
const manager = new E2eeManager({webex: makeWebex(true), wasmLoader});
|
|
77
|
+
|
|
78
|
+
await assert.isRejected(manager.preload(), /asset load failed/);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import 'jsdom-global/register';
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import sinon from 'sinon';
|
|
7
|
+
import E2eeSignaling, {
|
|
8
|
+
LLM_ONLINE_EVENT,
|
|
9
|
+
MEDIA_ENCRYPTION_MERCURY_EVENTS,
|
|
10
|
+
} from '../../../../src/e2ee/E2eeSignaling';
|
|
11
|
+
|
|
12
|
+
describe('plugin-meetings', () => {
|
|
13
|
+
describe('E2eeSignaling', () => {
|
|
14
|
+
let session;
|
|
15
|
+
let llm;
|
|
16
|
+
let mercury;
|
|
17
|
+
let signaling;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
llm = {
|
|
21
|
+
on: sinon.stub(),
|
|
22
|
+
off: sinon.stub(),
|
|
23
|
+
isConnected: sinon.stub().returns(false),
|
|
24
|
+
getLocusUrl: sinon.stub().returns('locus-1'),
|
|
25
|
+
};
|
|
26
|
+
mercury = {
|
|
27
|
+
on: sinon.stub(),
|
|
28
|
+
off: sinon.stub(),
|
|
29
|
+
};
|
|
30
|
+
session = {
|
|
31
|
+
handleEvent: sinon.stub(),
|
|
32
|
+
setLlmConnectedBeforeJoin: sinon.stub(),
|
|
33
|
+
llmConnected: sinon.stub(),
|
|
34
|
+
};
|
|
35
|
+
signaling = new E2eeSignaling({llm, mercury, getLocusUrl: () => 'locus-1', session});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
sinon.restore();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('subscribes to every mercury event on start', () => {
|
|
43
|
+
signaling.start();
|
|
44
|
+
|
|
45
|
+
MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
|
|
46
|
+
assert.calledWith(llm.on, event, sinon.match.func);
|
|
47
|
+
assert.calledWith(mercury.on, event, sinon.match.func);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('forwards mercury event data to the session as JSON bytes, tagged with the llm source', () => {
|
|
52
|
+
signaling.start();
|
|
53
|
+
|
|
54
|
+
const handler = llm.on.getCall(0).args[1];
|
|
55
|
+
|
|
56
|
+
handler({data: {foo: 'bar'}});
|
|
57
|
+
|
|
58
|
+
assert.calledOnce(session.handleEvent);
|
|
59
|
+
const [bytes, source] = session.handleEvent.firstCall.args;
|
|
60
|
+
|
|
61
|
+
assert.instanceOf(bytes, Uint8Array);
|
|
62
|
+
assert.deepEqual(JSON.parse(new TextDecoder().decode(bytes)), {foo: 'bar'});
|
|
63
|
+
assert.equal(source, 'llm');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('forwards events coming from the mercury channel to the session, tagged with the mercury source', () => {
|
|
67
|
+
signaling.start();
|
|
68
|
+
|
|
69
|
+
const handler = mercury.on.getCall(0).args[1];
|
|
70
|
+
|
|
71
|
+
handler({data: {foo: 'baz'}});
|
|
72
|
+
|
|
73
|
+
assert.calledOnce(session.handleEvent);
|
|
74
|
+
const [bytes, source] = session.handleEvent.firstCall.args;
|
|
75
|
+
|
|
76
|
+
assert.instanceOf(bytes, Uint8Array);
|
|
77
|
+
assert.deepEqual(JSON.parse(new TextDecoder().decode(bytes)), {foo: 'baz'});
|
|
78
|
+
assert.equal(source, 'mercury');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('tells the engine the channel is already connected when online for this meeting', () => {
|
|
82
|
+
llm.isConnected.returns(true);
|
|
83
|
+
llm.getLocusUrl.returns('locus-1');
|
|
84
|
+
|
|
85
|
+
signaling.start();
|
|
86
|
+
|
|
87
|
+
assert.calledOnceWithExactly(session.setLlmConnectedBeforeJoin, true);
|
|
88
|
+
assert.neverCalledWith(llm.on, LLM_ONLINE_EVENT, sinon.match.func);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('waits for online and notifies only when it is for this meeting', () => {
|
|
92
|
+
signaling.start();
|
|
93
|
+
|
|
94
|
+
const onlineCall = llm.on.getCalls().find((call) => call.args[0] === LLM_ONLINE_EVENT);
|
|
95
|
+
|
|
96
|
+
assert.isDefined(onlineCall);
|
|
97
|
+
const onOnline = onlineCall.args[1];
|
|
98
|
+
|
|
99
|
+
// Online for a different meeting -> no notify.
|
|
100
|
+
llm.isConnected.returns(true);
|
|
101
|
+
llm.getLocusUrl.returns('other-locus');
|
|
102
|
+
onOnline();
|
|
103
|
+
assert.notCalled(session.llmConnected);
|
|
104
|
+
|
|
105
|
+
// Online for our meeting -> notify.
|
|
106
|
+
llm.getLocusUrl.returns('locus-1');
|
|
107
|
+
onOnline();
|
|
108
|
+
assert.calledOnce(session.llmConnected);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('moves subscriptions when the meeting replaces or clears its LLM channel', () => {
|
|
112
|
+
signaling.start();
|
|
113
|
+
|
|
114
|
+
const replacementLlm = {
|
|
115
|
+
on: sinon.stub(),
|
|
116
|
+
off: sinon.stub(),
|
|
117
|
+
isConnected: sinon.stub().returns(false),
|
|
118
|
+
getLocusUrl: sinon.stub().returns('locus-1'),
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
signaling.setLlmChannel(replacementLlm);
|
|
122
|
+
|
|
123
|
+
MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
|
|
124
|
+
assert.calledWith(llm.off, event, sinon.match.func);
|
|
125
|
+
assert.calledWith(replacementLlm.on, event, sinon.match.func);
|
|
126
|
+
});
|
|
127
|
+
assert.calledWith(llm.off, LLM_ONLINE_EVENT, sinon.match.func);
|
|
128
|
+
assert.calledWith(replacementLlm.on, LLM_ONLINE_EVENT, sinon.match.func);
|
|
129
|
+
|
|
130
|
+
const replacementHandler = replacementLlm.on.getCall(0).args[1];
|
|
131
|
+
|
|
132
|
+
replacementHandler({data: {foo: 'replacement'}});
|
|
133
|
+
|
|
134
|
+
const [bytes, source] = session.handleEvent.firstCall.args;
|
|
135
|
+
|
|
136
|
+
assert.deepEqual(JSON.parse(new TextDecoder().decode(bytes)), {foo: 'replacement'});
|
|
137
|
+
assert.equal(source, 'llm');
|
|
138
|
+
|
|
139
|
+
signaling.setLlmChannel(undefined);
|
|
140
|
+
|
|
141
|
+
MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
|
|
142
|
+
assert.calledWith(replacementLlm.off, event, sinon.match.func);
|
|
143
|
+
});
|
|
144
|
+
assert.calledWith(replacementLlm.off, LLM_ONLINE_EVENT, sinon.match.func);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('removes all subscriptions on stop', () => {
|
|
148
|
+
signaling.start();
|
|
149
|
+
signaling.stop();
|
|
150
|
+
|
|
151
|
+
MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
|
|
152
|
+
assert.calledWith(llm.off, event, sinon.match.func);
|
|
153
|
+
assert.calledWith(mercury.off, event, sinon.match.func);
|
|
154
|
+
});
|
|
155
|
+
assert.calledWith(llm.off, LLM_ONLINE_EVENT, sinon.match.func);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('is idempotent across repeated start/stop calls', () => {
|
|
159
|
+
signaling.start();
|
|
160
|
+
const onCountAfterStart = llm.on.callCount;
|
|
161
|
+
|
|
162
|
+
signaling.start();
|
|
163
|
+
assert.equal(llm.on.callCount, onCountAfterStart);
|
|
164
|
+
|
|
165
|
+
signaling.stop();
|
|
166
|
+
const offCountAfterStop = llm.off.callCount;
|
|
167
|
+
|
|
168
|
+
signaling.stop();
|
|
169
|
+
assert.equal(llm.off.callCount, offCountAfterStop);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import 'jsdom-global/register';
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import sinon from 'sinon';
|
|
7
|
+
import MediaEncryptionService from '../../../../src/e2ee/MediaEncryptionService';
|
|
8
|
+
|
|
9
|
+
describe('plugin-meetings', () => {
|
|
10
|
+
describe('MediaEncryptionService', () => {
|
|
11
|
+
let webexRequest;
|
|
12
|
+
let service;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
webexRequest = sinon.stub().resolves({body: {result: 'ok', n: 1}});
|
|
16
|
+
service = new MediaEncryptionService({webexRequest});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
sinon.restore();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('posts the request object to the media-encryption service and resolves with the response body', async () => {
|
|
24
|
+
const requestBody = {op: 'join', epoch: 2};
|
|
25
|
+
|
|
26
|
+
const result = await service.request('https://mes.webex.com/op', requestBody);
|
|
27
|
+
|
|
28
|
+
assert.calledOnceWithExactly(webexRequest, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
service: 'media-encryption',
|
|
31
|
+
url: 'https://mes.webex.com/op',
|
|
32
|
+
body: requestBody,
|
|
33
|
+
});
|
|
34
|
+
assert.deepEqual(result, {result: 'ok', n: 1});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('rejects when webex.request rejects', async () => {
|
|
38
|
+
webexRequest.rejects(new Error('boom'));
|
|
39
|
+
|
|
40
|
+
await assert.isRejected(service.request('https://mes.webex.com/op', {}), /boom/);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -20,6 +20,7 @@ import {Services} from '@webex/webex-core';
|
|
|
20
20
|
import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
|
|
21
21
|
import Meetings from '@webex/plugin-meetings/src/meetings';
|
|
22
22
|
import MeetingCollection from '@webex/plugin-meetings/src/meetings/collection';
|
|
23
|
+
import E2eeManager from '@webex/plugin-meetings/src/e2ee/E2eeManager';
|
|
23
24
|
import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
|
|
24
25
|
import {SitePreferenceSelectOption} from '@webex/plugin-meetings/src/meetings/meetings.types';
|
|
25
26
|
import PersonalMeetingRoom from '@webex/plugin-meetings/src/personal-meeting-room';
|
|
@@ -128,6 +129,7 @@ describe('plugin-meetings', () => {
|
|
|
128
129
|
enable: true,
|
|
129
130
|
verboseEvents: true,
|
|
130
131
|
},
|
|
132
|
+
assetsBaseUrl: '/assets/plugin-meetings/',
|
|
131
133
|
});
|
|
132
134
|
|
|
133
135
|
Object.assign(webex, {
|
|
@@ -464,6 +466,24 @@ describe('plugin-meetings', () => {
|
|
|
464
466
|
assert.isTrue(webex.meetings.registered);
|
|
465
467
|
});
|
|
466
468
|
|
|
469
|
+
it('preloads E2EE resources after successful registration', async () => {
|
|
470
|
+
webex.canAuthorize = true;
|
|
471
|
+
const preloadStub = sinon.stub(E2eeManager.prototype, 'preload').resolves();
|
|
472
|
+
|
|
473
|
+
await webex.meetings.register();
|
|
474
|
+
|
|
475
|
+
assert.calledOnce(preloadStub);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('does not fail registration when E2EE preloading rejects', async () => {
|
|
479
|
+
webex.canAuthorize = true;
|
|
480
|
+
sinon.stub(E2eeManager.prototype, 'preload').rejects(new Error('asset load failed'));
|
|
481
|
+
|
|
482
|
+
await webex.meetings.register();
|
|
483
|
+
|
|
484
|
+
assert.isTrue(webex.meetings.registered);
|
|
485
|
+
});
|
|
486
|
+
|
|
467
487
|
it('rejects when SDK canAuthorize is false', async () => {
|
|
468
488
|
webex.canAuthorize = false;
|
|
469
489
|
await assert.isRejected(webex.meetings.register());
|