@webex/plugin-meetings 3.13.0-next.1 → 3.13.0-next.10

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 (55) hide show
  1. package/babel.config.js +17 -1
  2. package/dist/aiEnableRequest/index.js +1 -1
  3. package/dist/breakouts/breakout.js +1 -1
  4. package/dist/breakouts/index.js +1 -1
  5. package/dist/common/wasm-loader.js +174 -0
  6. package/dist/common/wasm-loader.js.map +1 -0
  7. package/dist/config.js +2 -1
  8. package/dist/config.js.map +1 -1
  9. package/dist/constants.js +1 -1
  10. package/dist/constants.js.map +1 -1
  11. package/dist/e2ee/E2eeManager.js +91 -0
  12. package/dist/e2ee/E2eeManager.js.map +1 -0
  13. package/dist/e2ee/E2eeSignaling.js +200 -0
  14. package/dist/e2ee/E2eeSignaling.js.map +1 -0
  15. package/dist/e2ee/MediaEncryptionService.js +75 -0
  16. package/dist/e2ee/MediaEncryptionService.js.map +1 -0
  17. package/dist/e2ee/mls.js +558 -0
  18. package/dist/e2ee/mls.js.map +1 -0
  19. package/dist/e2ee/types.js +59 -0
  20. package/dist/e2ee/types.js.map +1 -0
  21. package/dist/e2ee/wasm.d.js +7 -0
  22. package/dist/e2ee/wasm.d.js.map +1 -0
  23. package/dist/interpretation/index.js +1 -1
  24. package/dist/interpretation/siLanguage.js +1 -1
  25. package/dist/meetings/index.js +20 -0
  26. package/dist/meetings/index.js.map +1 -1
  27. package/dist/types/common/wasm-loader.d.ts +55 -0
  28. package/dist/types/config.d.ts +1 -0
  29. package/dist/types/constants.d.ts +1 -1
  30. package/dist/types/e2ee/E2eeManager.d.ts +23 -0
  31. package/dist/types/e2ee/E2eeSignaling.d.ts +94 -0
  32. package/dist/types/e2ee/MediaEncryptionService.d.ts +27 -0
  33. package/dist/types/e2ee/mls.d.ts +191 -0
  34. package/dist/types/e2ee/types.d.ts +104 -0
  35. package/dist/types/meetings/index.d.ts +4 -0
  36. package/dist/webinar/index.js +1 -1
  37. package/package.json +14 -14
  38. package/src/common/wasm-loader.ts +124 -0
  39. package/src/config.ts +1 -0
  40. package/src/constants.ts +1 -1
  41. package/src/e2ee/E2eeManager.ts +58 -0
  42. package/src/e2ee/E2eeSignaling.ts +215 -0
  43. package/src/e2ee/MediaEncryptionService.ts +41 -0
  44. package/src/e2ee/mls.ts +548 -0
  45. package/src/e2ee/types.ts +114 -0
  46. package/src/e2ee/wasm.d.ts +153 -0
  47. package/src/meetings/ai-docs/meetings-spec.md +2 -0
  48. package/src/meetings/index.ts +18 -0
  49. package/test/unit/spec/common/wasm-loader.ts +171 -0
  50. package/test/unit/spec/e2ee/E2eeManager.ts +82 -0
  51. package/test/unit/spec/e2ee/E2eeSignaling.ts +172 -0
  52. package/test/unit/spec/e2ee/MediaEncryptionService.ts +43 -0
  53. package/test/unit/spec/e2ee/mls.ts +765 -0
  54. package/test/unit/spec/meeting-info/index.js +2 -3
  55. package/test/unit/spec/meetings/index.js +20 -0
@@ -0,0 +1,124 @@
1
+ /*!
2
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import LoggerProxy from './logs/logger-proxy';
6
+
7
+ /**
8
+ * An emscripten MODULARIZE factory — the default export of a generated `*.js` WASM loader. Calling
9
+ * it instantiates the module; `locateFile` lets us point the loader at the `.wasm` binary URL.
10
+ */
11
+ export type EmscriptenModuleFactory<TModule = unknown> = (moduleOverrides?: {
12
+ locateFile?: (path: string) => string;
13
+ }) => Promise<TModule>;
14
+
15
+ type ModuleImporter = (jsUrl: string) => Promise<{default: EmscriptenModuleFactory}>;
16
+
17
+ /**
18
+ * Natively imports an emscripten loader served at runtime.
19
+ *
20
+ * This must stay a real `import()`: babel.config.js excludes `transform-dynamic-import` for this
21
+ * file so Babel doesn't rewrite it to `require()`, and `webpackIgnore` stops consumers' webpack
22
+ * from trying to bundle it. The URL is resolved against the document because a native `import()`
23
+ * would otherwise resolve relative paths against the SDK bundle's URL.
24
+ * @param {string} jsUrl - URL of the emscripten loader module (e.g. '/assets/plugin-meetings/e2ee.js').
25
+ * @returns {Promise<{default: EmscriptenModuleFactory}>}
26
+ */
27
+ const nativeImport: ModuleImporter = (jsUrl) =>
28
+ import(/* webpackIgnore: true */ new URL(jsUrl, document.baseURI).href);
29
+
30
+ interface CachedModule {
31
+ instance: unknown | null;
32
+ loadPromise: Promise<unknown> | null;
33
+ }
34
+
35
+ /**
36
+ * Loads and caches emscripten WebAssembly modules, each uniquely identified by its `.wasm` URL
37
+ * (the `.js` loader URL is derived by replacing the `.wasm` suffix). A single instance can load
38
+ * multiple distinct modules; each URL is loaded at most once and cached. Instantiated once per
39
+ * session so slow loads can be warmed ahead of when they're needed.
40
+ */
41
+ export default class WasmLoader {
42
+ private readonly importModule: ModuleImporter;
43
+
44
+ private readonly modules = new Map<string, CachedModule>();
45
+
46
+ /**
47
+ * @param {Object} [options]
48
+ * @param {Function} [options.importModule] - Override the dynamic import (used by tests).
49
+ */
50
+ constructor({importModule}: {importModule?: ModuleImporter} = {}) {
51
+ this.importModule = importModule || nativeImport;
52
+ }
53
+
54
+ /**
55
+ * @param {string} wasmUrl
56
+ * @returns {boolean} whether the module for the given URL has finished loading and is cached.
57
+ */
58
+ isLoaded(wasmUrl: string): boolean {
59
+ const cached = this.modules.get(wasmUrl);
60
+
61
+ return !!cached && cached.instance !== null;
62
+ }
63
+
64
+ /**
65
+ * Warms the cache for the given module URL. Safe to call repeatedly; concurrent calls share a
66
+ * single load.
67
+ * @param {string} wasmUrl
68
+ * @returns {Promise<void>}
69
+ */
70
+ async preload(wasmUrl: string): Promise<void> {
71
+ await this.get(wasmUrl);
72
+ }
73
+
74
+ /**
75
+ * Returns the cached module for the given URL, loading it if necessary.
76
+ * @param {string} wasmUrl
77
+ * @returns {Promise<TModule>}
78
+ */
79
+ get<TModule = unknown>(wasmUrl: string): Promise<TModule> {
80
+ let cached = this.modules.get(wasmUrl);
81
+
82
+ if (!cached) {
83
+ cached = {instance: null, loadPromise: null};
84
+ this.modules.set(wasmUrl, cached);
85
+ }
86
+
87
+ if (cached.instance !== null) {
88
+ return Promise.resolve(cached.instance as TModule);
89
+ }
90
+ if (!cached.loadPromise) {
91
+ cached.loadPromise = this.load(wasmUrl, cached);
92
+ }
93
+
94
+ return cached.loadPromise as Promise<TModule>;
95
+ }
96
+
97
+ /**
98
+ * @param {string} wasmUrl
99
+ * @param {CachedModule} cached
100
+ * @returns {Promise<unknown>}
101
+ */
102
+ private async load(wasmUrl: string, cached: CachedModule): Promise<unknown> {
103
+ const jsUrl = wasmUrl.replace(/\.wasm(?=[?#]|$)/, '.js');
104
+
105
+ try {
106
+ const {default: factory} = await this.importModule(jsUrl);
107
+ const instance = await factory({
108
+ locateFile: (path: string) => (path.endsWith('.wasm') ? wasmUrl : path),
109
+ });
110
+
111
+ cached.instance = instance;
112
+
113
+ return instance;
114
+ } catch (error) {
115
+ // Reset so a failed load can be retried on the next get().
116
+ cached.loadPromise = null;
117
+ LoggerProxy.logger.error(
118
+ `WasmLoader#load --> failed to load WASM module ${wasmUrl}: ${error}`
119
+ );
120
+
121
+ throw new Error(`Failed to load WASM module ${wasmUrl}: ${error}`, {cause: error});
122
+ }
123
+ }
124
+ }
package/src/config.ts CHANGED
@@ -84,6 +84,7 @@ export default {
84
84
  receiveTranscription: false,
85
85
  enableExtmap: false,
86
86
  enableAutomaticLLM: false,
87
+ enableE2ee: false,
87
88
  assetsBaseUrl: getUmdAssetsBaseUrl('plugin-meetings', SDK_VERSION, PACKAGE_VERSION),
88
89
  installedOrgID: undefined,
89
90
  multipartSitePrefixList: ['.my.', '.mydmz.', '.mybts.', '.mydev.', '.myats2.', '.myats.'],
package/src/constants.ts CHANGED
@@ -202,7 +202,7 @@ export const ICE_FAIL_TIMEOUT = 3000;
202
202
  export const RETRY_TIMEOUT = 3000;
203
203
 
204
204
  export const ICE_CONNECTION_TIMEOUT = 20000;
205
- export const DTLS_CONNECTION_TIMEOUT = 7000;
205
+ export const DTLS_CONNECTION_TIMEOUT = 15000;
206
206
  export const ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT = 35000;
207
207
  export const WEBINAR_ERROR_WEBCAST = [403026];
208
208
  export const WEBINAR_ERROR_REGISTRATION_ID = [403037, 403137];
@@ -0,0 +1,58 @@
1
+ /*!
2
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
6
+ // @ts-ignore - StaticAssetLoader is exported from webex-core's JavaScript entry point.
7
+ import {StaticAssetLoader} from '@webex/webex-core';
8
+
9
+ import LoggerProxy from '../common/logs/logger-proxy';
10
+ import WasmLoader from '../common/wasm-loader';
11
+
12
+ /* The WASM module that contains the libe2ee + mlspp libraries with a WebE2EE wrapper around them, required for joining MLS group for E2EE meetings.
13
+ * The version is in the filename as it is important that JS-SDK implementation of MLS class matches the WASM module version.
14
+ */
15
+ const E2EE_WASM_ASSET = 'e2ee-0.0.1.wasm';
16
+
17
+ /**
18
+ * Owns E2EE resource preloading for a Meetings plugin session. The per-meeting controller is added
19
+ * in the follow-up integration change; this first step keeps the slow WASM load off the join path.
20
+ */
21
+ export default class E2eeManager {
22
+ private readonly webex: any;
23
+
24
+ private readonly wasmLoader: WasmLoader;
25
+
26
+ private readonly assetLoader: StaticAssetLoader;
27
+
28
+ constructor({webex, wasmLoader}: {webex: any; wasmLoader: WasmLoader}) {
29
+ this.webex = webex;
30
+ this.wasmLoader = wasmLoader;
31
+ this.assetLoader = new StaticAssetLoader(
32
+ {baseUrl: webex.config.meetings.assetsBaseUrl},
33
+ {parent: webex}
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Warms the E2EE WASM module when configured and supported. Callers should not await this from
39
+ * registration; a loading failure must not prevent the client from registering for meetings.
40
+ * @returns {Promise<void>}
41
+ */
42
+ async preload(): Promise<void> {
43
+ const enabled = !!this.webex?.config?.meetings?.enableE2ee;
44
+ const supported = WebCapabilities.supportsWasm() === CapabilityState.CAPABLE;
45
+
46
+ if (!enabled || !supported) {
47
+ LoggerProxy.logger.info('e2ee: E2eeManager#preload --> E2EE disabled or unsupported');
48
+
49
+ return;
50
+ }
51
+
52
+ const wasmUrl = this.assetLoader.getUrl(E2EE_WASM_ASSET);
53
+
54
+ LoggerProxy.logger.info('e2ee: E2eeManager#preload --> preloading WASM module');
55
+ await this.wasmLoader.preload(wasmUrl);
56
+ LoggerProxy.logger.info('e2ee: E2eeManager#preload --> WASM module preloaded');
57
+ }
58
+ }
@@ -0,0 +1,215 @@
1
+ /*!
2
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import type LLMChannel from '@webex/internal-plugin-llm';
6
+
7
+ /** Source labels passed to the MLS engine for incoming signaling messages. */
8
+ type E2eeSignalingSource = 'llm' | 'mercury';
9
+
10
+ /** LLM event carrying the channel's connection state. */
11
+ export const LLM_ONLINE_EVENT = 'online';
12
+
13
+ /** Mercury events carrying MLS protocol messages. */
14
+ export const MEDIA_ENCRYPTION_MERCURY_EVENTS = [
15
+ 'event:media_encryption.leader_nominated',
16
+ 'event:media_encryption.welcome',
17
+ 'event:media_encryption.annotated_welcome',
18
+ 'event:media_encryption.multi_welcome',
19
+ 'event:media_encryption.group_update',
20
+ 'event:media_encryption.annotated_commit',
21
+ 'event:media_encryption.large_group_update',
22
+ 'event:media_encryption.use_key',
23
+ 'event:media_encryption.join_request',
24
+ 'event:media_encryption.leave_request',
25
+ 'event:media_encryption.join_failure',
26
+ 'event:media_encryption.leader_changed',
27
+ 'event:media_encryption.message_segment',
28
+ ];
29
+
30
+ /** The subset of the MLS engine the signaling adapter drives. */
31
+ export interface IMlsSignalingTarget {
32
+ handleEvent(bytes: Uint8Array, source: E2eeSignalingSource): void;
33
+ setLlmConnectedBeforeJoin(connected: boolean): void;
34
+ llmConnected(): void;
35
+ }
36
+
37
+ /** The subset of a mercury channel the adapter subscribes to for MLS protocol events. */
38
+ export interface IMercuryChannel {
39
+ on(event: string, handler: (envelope: any) => void): void;
40
+ off(event: string, handler: (envelope: any) => void): void;
41
+ }
42
+
43
+ /**
44
+ * Mercury (and LLM) adapter for the MLS engine. Subscribes to this meeting's
45
+ * media_encryption.* events on both the LLM and mercury channels and forwards them to the engine,
46
+ * and tracks whether the signaling channel is connected so the engine knows when it can proceed
47
+ * with its join.
48
+ */
49
+ export default class E2eeSignaling {
50
+ private llm?: LLMChannel;
51
+
52
+ private readonly mercury: IMercuryChannel;
53
+
54
+ private readonly getLocusUrl: () => string | undefined;
55
+
56
+ private readonly session: IMlsSignalingTarget;
57
+
58
+ private started = false;
59
+
60
+ /**
61
+ * @param {Object} deps
62
+ * @param {LLMChannel} [deps.llm] - This meeting's LLM channel, when one is available.
63
+ * @param {IMercuryChannel} deps.mercury - The mercury channel (webex.internal.mercury).
64
+ * @param {Function} deps.getLocusUrl - Returns the meeting's current locus url (read live, as it
65
+ * can change, e.g. when moving between breakout sessions).
66
+ * @param {IMlsSignalingTarget} deps.session - The MLS engine to drive.
67
+ */
68
+ constructor({
69
+ llm,
70
+ mercury,
71
+ getLocusUrl,
72
+ session,
73
+ }: {
74
+ llm?: LLMChannel;
75
+ mercury: IMercuryChannel;
76
+ getLocusUrl: () => string | undefined;
77
+ session: IMlsSignalingTarget;
78
+ }) {
79
+ this.llm = llm;
80
+ this.mercury = mercury;
81
+ this.getLocusUrl = getLocusUrl;
82
+ this.session = session;
83
+ }
84
+
85
+ /**
86
+ * Subscribes to MLS mercury events and wires up connection tracking. Idempotent.
87
+ * @returns {void}
88
+ */
89
+ start(): void {
90
+ if (this.started) {
91
+ return;
92
+ }
93
+ this.started = true;
94
+
95
+ MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
96
+ this.mercury.on(event, this.onMercuryEvent);
97
+ });
98
+
99
+ if (this.llm && this.isLlmOnlineForThisSession()) {
100
+ this.session.setLlmConnectedBeforeJoin(true);
101
+ }
102
+ this.subscribeToLlmEvents();
103
+ }
104
+
105
+ /**
106
+ * Removes all subscriptions. Idempotent.
107
+ * @returns {void}
108
+ */
109
+ stop(): void {
110
+ if (!this.started) {
111
+ return;
112
+ }
113
+ this.started = false;
114
+
115
+ MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
116
+ this.mercury.off(event, this.onMercuryEvent);
117
+ });
118
+ this.unsubscribeFromLlmEvents();
119
+ }
120
+
121
+ /**
122
+ * Replaces the meeting-owned LLM channel after the meeting reconnects its data channel.
123
+ * @param {LLMChannel} [llm]
124
+ * @returns {void}
125
+ */
126
+ setLlmChannel(llm?: LLMChannel): void {
127
+ if (this.llm === llm) {
128
+ return;
129
+ }
130
+
131
+ this.unsubscribeFromLlmEvents();
132
+ this.llm = llm;
133
+
134
+ if (!this.started || !this.llm) {
135
+ return;
136
+ }
137
+
138
+ this.subscribeToLlmEvents();
139
+
140
+ if (this.isLlmOnlineForThisSession()) {
141
+ this.session.llmConnected();
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Forwards a signaling envelope to the engine, tagging which channel it came from.
147
+ * @param {Object} envelope - The mercury event envelope.
148
+ * @param {E2eeSignalingSource} source - The channel the envelope arrived on.
149
+ * @returns {void}
150
+ */
151
+ private forwardEvent(envelope: any, source: E2eeSignalingSource): void {
152
+ const eventData = envelope?.data ?? envelope;
153
+ const bytes = new TextEncoder().encode(JSON.stringify(eventData));
154
+
155
+ this.session.handleEvent(new Uint8Array(bytes), source);
156
+ }
157
+
158
+ /**
159
+ * @param {Object} envelope - The mercury event envelope from the LLM channel.
160
+ * @returns {void}
161
+ */
162
+ private onLlmEvent = (envelope: any): void => {
163
+ this.forwardEvent(envelope, 'llm');
164
+ };
165
+
166
+ /**
167
+ * @param {Object} envelope - The mercury event envelope from the mercury channel.
168
+ * @returns {void}
169
+ */
170
+ private onMercuryEvent = (envelope: any): void => {
171
+ this.forwardEvent(envelope, 'mercury');
172
+ };
173
+
174
+ /**
175
+ * @returns {void}
176
+ */
177
+ private onLlmOnline = (): void => {
178
+ if (this.isLlmOnlineForThisSession()) {
179
+ this.session.llmConnected();
180
+ }
181
+ };
182
+
183
+ /** @returns {void} */
184
+ private subscribeToLlmEvents(): void {
185
+ if (!this.started || !this.llm) {
186
+ return;
187
+ }
188
+
189
+ MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
190
+ this.llm?.on(event, this.onLlmEvent);
191
+ });
192
+ if (!this.isLlmOnlineForThisSession()) {
193
+ this.llm.on(LLM_ONLINE_EVENT, this.onLlmOnline);
194
+ }
195
+ }
196
+
197
+ /** @returns {void} */
198
+ private unsubscribeFromLlmEvents(): void {
199
+ this.llm?.off(LLM_ONLINE_EVENT, this.onLlmOnline);
200
+ MEDIA_ENCRYPTION_MERCURY_EVENTS.forEach((event) => {
201
+ this.llm?.off(event, this.onLlmEvent);
202
+ });
203
+ }
204
+
205
+ /**
206
+ * @returns {boolean} whether the LLM is connected for this specific session (locus-url matched).
207
+ */
208
+ private isLlmOnlineForThisSession(): boolean {
209
+ const sessionLocusUrl = this.getLocusUrl();
210
+
211
+ return (
212
+ !!sessionLocusUrl && !!this.llm?.isConnected() && sessionLocusUrl === this.llm.getLocusUrl()
213
+ );
214
+ }
215
+ }
@@ -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
+ }