@webex/plugin-meetings 3.13.0-next.15 → 3.13.0-next.17

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 (89) 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 +581 -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/constants.js +28 -0
  20. package/dist/e2ee/constants.js.map +1 -0
  21. package/dist/e2ee/mls.js +85 -67
  22. package/dist/e2ee/mls.js.map +1 -1
  23. package/dist/e2ee/types.js +52 -13
  24. package/dist/e2ee/types.js.map +1 -1
  25. package/dist/e2ee/wasm.d.js.map +1 -1
  26. package/dist/hashTree/hashTreeParser.js.map +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/interpretation/index.js +1 -1
  29. package/dist/interpretation/siLanguage.js +1 -1
  30. package/dist/meeting/index.js +394 -249
  31. package/dist/meeting/index.js.map +1 -1
  32. package/dist/meeting/request.js +69 -58
  33. package/dist/meeting/request.js.map +1 -1
  34. package/dist/meeting/util.js +4 -2
  35. package/dist/meeting/util.js.map +1 -1
  36. package/dist/meetings/index.js +87 -61
  37. package/dist/meetings/index.js.map +1 -1
  38. package/dist/meetings/util.js +10 -0
  39. package/dist/meetings/util.js.map +1 -1
  40. package/dist/metrics/constants.js +2 -1
  41. package/dist/metrics/constants.js.map +1 -1
  42. package/dist/types/common/events/typed-events-scope.d.ts +73 -0
  43. package/dist/types/common/types.d.ts +9 -0
  44. package/dist/types/constants.d.ts +5 -0
  45. package/dist/types/e2ee/E2eeController.d.ts +130 -0
  46. package/dist/types/e2ee/E2eeManager.d.ts +26 -6
  47. package/dist/types/e2ee/E2eeSignaling.d.ts +1 -7
  48. package/dist/types/e2ee/MediaEncryptionService.d.ts +1 -3
  49. package/dist/types/e2ee/constants.d.ts +12 -0
  50. package/dist/types/e2ee/mls.d.ts +16 -10
  51. package/dist/types/e2ee/types.d.ts +92 -35
  52. package/dist/types/hashTree/hashTreeParser.d.ts +1 -1
  53. package/dist/types/index.d.ts +1 -0
  54. package/dist/types/meeting/index.d.ts +34 -0
  55. package/dist/types/meeting/util.d.ts +1 -1
  56. package/dist/types/metrics/constants.d.ts +1 -0
  57. package/dist/webinar/index.js +1 -1
  58. package/package.json +22 -22
  59. package/src/common/events/typed-events-scope.ts +110 -0
  60. package/src/common/types.ts +10 -0
  61. package/src/constants.ts +6 -0
  62. package/src/e2ee/DESIGN.md +363 -0
  63. package/src/e2ee/E2eeController.ts +487 -0
  64. package/src/e2ee/E2eeManager.ts +48 -27
  65. package/src/e2ee/E2eeSignaling.ts +13 -28
  66. package/src/e2ee/MediaEncryptionService.ts +2 -4
  67. package/src/e2ee/constants.ts +34 -0
  68. package/src/e2ee/mls.ts +62 -32
  69. package/src/e2ee/types.ts +99 -34
  70. package/src/e2ee/wasm.d.ts +18 -14
  71. package/src/hashTree/hashTreeParser.ts +1 -1
  72. package/src/index.ts +1 -0
  73. package/src/meeting/index.ts +155 -0
  74. package/src/meeting/request.ts +16 -0
  75. package/src/meeting/util.ts +2 -1
  76. package/src/meetings/index.ts +30 -5
  77. package/src/meetings/util.ts +8 -0
  78. package/src/metrics/constants.ts +1 -0
  79. package/test/unit/spec/common/events/typed-events-scope.ts +88 -0
  80. package/test/unit/spec/e2ee/E2eeController.ts +662 -0
  81. package/test/unit/spec/e2ee/E2eeManager.ts +53 -29
  82. package/test/unit/spec/e2ee/E2eeSignaling.ts +19 -10
  83. package/test/unit/spec/e2ee/mls.ts +84 -32
  84. package/test/unit/spec/meeting/index.js +662 -0
  85. package/test/unit/spec/meeting/request.js +35 -0
  86. package/test/unit/spec/meeting/utils.js +4 -0
  87. package/test/unit/spec/meetings/index.js +36 -1
  88. package/test/unit/spec/meetings/utils.js +15 -0
  89. package/test/utils/webex-config.js +1 -0
@@ -0,0 +1,363 @@
1
+ # E2EE / MLS in `plugin-meetings` — Design
2
+
3
+ > End-to-end-encrypted (E2EE) meetings, backed by MLS, are handled inside `@webex/plugin-meetings`,
4
+ > so an SDK client joins an E2EE meeting exactly like any other meeting (`meeting.joinWithMedia()`).
5
+
6
+ ## Requirements
7
+
8
+ The SDK must:
9
+
10
+ 1. Expose the meeting **security code**.
11
+ 2. Expose per-**member** identity-verification status and certificate data, sourced from the MLS roster.
12
+ 3. Pass SFrame media-encryption keys to the media connection
13
+ (`MediaProperties.webrtcMediaConnection`).
14
+ 4. Report whether **media services** (recording / transcoding / streaming servers) are in the MLS
15
+ roster. Their presence means the meeting is not fully zero-trust.
16
+ 5. Expose the meeting **trust state** (`calculating` | `strong` | `zeroTrust` | `adaptiveStrong` |
17
+ `adaptiveZeroTrust`), derived live from the Locus flags, the MLS state and media-service presence.
18
+
19
+ The WASM module (libe2ee + mlspp, with a `WebE2EE` wrapper) is built outside this package and
20
+ placed in `packages/@webex/plugin-meetings/assets`.
21
+
22
+ ## How a meeting becomes E2EE
23
+
24
+ E2EE is gated by the `meetings.enableE2ee` config (default `false`) **and** WebAssembly support
25
+ (`WebCapabilities.supportsWasm()`); both are checked by `MeetingsUtil.isE2eeEnabledAndSupported()`.
26
+
27
+ **Client → Locus** (join request, `meeting/request.ts`, only when E2EE is enabled and supported):
28
+
29
+ - `supportsV2E2EEncryption: true`
30
+ - `E2EE_1K_SUPPORTED` pushed onto `deviceCapabilities`
31
+
32
+ **Locus → client** (read from `locusInfo.info`):
33
+
34
+ - `isV2E2EEncrypted` — the meeting requires an MLS join and SFrame media encryption.
35
+ - `isBestEffortE2EEncryption` — adaptive ("best effort") E2EE; selects the `adaptive*` trust states.
36
+ - `mediaEncryptionGroupUrl` — the MLS group service URL.
37
+
38
+ An MLS join happens only when E2EE is enabled and supported, `isV2E2EEncrypted` is true and
39
+ `mediaEncryptionGroupUrl` is present (`E2eeController.required()`).
40
+
41
+ Once joined, the meeting **stays on MLS + SFrame** for its whole lifetime; there is no switching to
42
+ or from plain SRTP. In an adaptive meeting a non-E2EE client may join and have a media service
43
+ (Homer) encrypt on its behalf. That only changes the reported trust state
44
+ (`adaptiveZeroTrust → adaptiveStrong`), not our media encryption path.
45
+
46
+ ## Decisions
47
+
48
+ | # | Decision |
49
+ |---|----------|
50
+ | D1 | E2EE is a **per-meeting component** owned by `Meeting` (`meeting.e2ee`), like `members` / `roap`. |
51
+ | D2 | The MLS engine is **isolated from I/O**: HTTP, signaling and module loading are injected adapters. |
52
+ | D3 | Identity/credentials live in a separate plugin, **`@webex/internal-plugin-identity`** (one instance per Webex client), split from MLS group logic. |
53
+ | D4 | Member verification is exposed on `Member`, but MLS roster data is kept in a **separate registry keyed by device URL** and reconciled, because Locus member updates and MLS roster updates arrive independently and in any order. |
54
+ | D5 | A device is **verified** when its selected X.509 identity result is `E2eeValidationResult.Success` with a verified identity type. `Member` exposes per-device data and an aggregated state. |
55
+ | D6 | The WASM module is **preloaded** in `Meetings.register()`; credentials are fetched lazily on the first E2EE meeting and cached. |
56
+ | D7 | MLS failures are **fatal for the E2EE session**, not the meeting: the session is torn down, a failure event and a behavioral metric are emitted, and the state becomes `failed` / `evicted`. The SDK does not leave the meeting; the app decides whether to retry (`meeting.e2ee.start()`) or leave. |
57
+ | D8 | Media-key injection uses a **new `internal-media-core` API** defined by this package (`IE2eeMediaConnection`); its implementation is out of scope here. |
58
+
59
+ ## Architecture
60
+
61
+ Code lives in `src/e2ee/`; the generic WASM loader is `src/common/wasm-loader.ts`; credentials
62
+ come from `@webex/internal-plugin-identity` (imported by `plugin-meetings` and available as
63
+ `webex.internal.identity`).
64
+
65
+ **Ownership** — who owns or creates what:
66
+
67
+ ```mermaid
68
+ graph TD
69
+ Meetings[Meetings plugin] -->|owns| WasmLoader
70
+ Meetings -->|owns one| Mgr[E2eeManager]
71
+ Meetings -->|creates| Meeting
72
+ Meeting -->|owns| Members
73
+ Meeting -->|owns| LLM[LLM channel]
74
+ Mgr -->|createE2eeController| Ctl[E2eeController]
75
+ Meeting -->|this.e2ee| Ctl
76
+ Ctl -->|creates in constructor| Recon[MemberMLSReconciler]
77
+ Ctl -->|"creates in start()"| MLS[MLS engine]
78
+ Ctl -->|"creates in start()"| Sig[E2eeSignaling]
79
+ Ctl -->|"creates in start(),<br/>passes to MLS"| Svc[MediaEncryptionService]
80
+ ```
81
+
82
+ **MLS protocol** — how the engine gets its inputs and talks to the service:
83
+
84
+ ```mermaid
85
+ graph LR
86
+ Mercury -->|media_encryption.*| Sig[E2eeSignaling]
87
+ LLM[LLM channel] -->|media_encryption.* / online| Sig
88
+ Sig -->|"handleEvent / llmConnected<br/>(IMlsSignalingTarget)"| MLS[MLS engine]
89
+ Ctl[E2eeController] -->|initialize / join / leave| MLS
90
+ Ctl -->|getCredentials / getTrustAnchors| Ident[internal-plugin-identity]
91
+ Ident -->|CSR / cert| CA[webex-certificate-authority]
92
+ MLS -->|loadModule| WasmLoader
93
+ MLS -->|"request<br/>(IMlsHttpClient)"| Svc[MediaEncryptionService]
94
+ Svc -->|POST| MES[media-encryption service]
95
+ ```
96
+
97
+ **State to the app** — how MLS results reach `Meeting`, `Members` and the SDK client (dashed
98
+ arrows are events):
99
+
100
+ ```mermaid
101
+ graph LR
102
+ MLS[MLS engine] -.->|joinSuccess / roster* / failures| Ctl[E2eeController]
103
+ Meeting -->|start / stop / llmChannelChanged| Ctl
104
+ Ctl -.->|e2ee:* events| Meeting
105
+ Meeting -.->|e2ee:* / trustState events| App[SDK client]
106
+ Ctl -->|applyRosterAdded / applyRosterRemoved| Recon[MemberMLSReconciler]
107
+ Members -->|processMembersUpdate| Recon
108
+ Recon -->|setE2eeDeviceVerification / reportMembersUpdated| Members
109
+ Members -.->|members:update| App
110
+ ```
111
+
112
+ ```
113
+ src/e2ee/
114
+ ├── E2eeManager.ts # one per Meetings plugin; preloads WASM, creates E2eeController
115
+ ├── E2eeController.ts # per-meeting orchestrator (meeting.e2ee)
116
+ ├── mls.ts # MLS engine wrapping the WebE2EE WASM module (no I/O deps)
117
+ ├── E2eeSignaling.ts # LLM + mercury media_encryption.* events -> MLS
118
+ ├── MediaEncryptionService.ts # MLS HTTP requests -> webex.request (media-encryption)
119
+ ├── MemberMLSReconciler.ts # MLS roster <-> Members verification
120
+ ├── types.ts # shared E2EE types and enums
121
+ ├── constants.ts # event names, service name, timeouts, WASM asset name
122
+ └── wasm.d.ts # WebE2EE WASM typings
123
+ ```
124
+
125
+ ## Components
126
+
127
+ ### `WasmLoader` (`common/wasm-loader.ts`)
128
+
129
+ Generic, not E2EE-specific. `preload(wasmUrl)`, `get(wasmUrl)` and `isLoaded(wasmUrl)` load and
130
+ cache a module keyed by its `.wasm` URL; the `.js` loader URL is derived by replacing the suffix.
131
+ `Meetings` owns one instance.
132
+
133
+ ### `E2eeManager`
134
+
135
+ One per `Meetings` plugin, created in the `READY` handler (`webex.config` and `webex.request` are not
136
+ available when plugins are constructed). `Meetings` resolves the WASM URL from
137
+ `meetings.assetsBaseUrl` + `E2EE_WASM_ASSET` and passes it in.
138
+
139
+ - `isEnabled` — `isE2eeEnabledAndSupported(webex.config)`.
140
+ - `preload()` — warms the WASM module when enabled. `register()` calls it fire-and-forget, so a
141
+ failure never blocks registration.
142
+ - `createE2eeController(context)` — injects the loader, WASM URL and `webex.internal.identity`.
143
+
144
+ ### `MLS` (`mls.ts`)
145
+
146
+ Wraps `WebE2EE`. Constructed with an `IMlsHttpClient` and a `loadModule()` callback; it has no
147
+ webex, HTTP or LLM dependencies.
148
+
149
+ - Methods: `initialize(config)`, `join()`, `leave()`, `handleEvent(bytes, source)`,
150
+ `setLlmConnectedBeforeJoin(connected)`, `llmConnected()`, `getSecurityCode()`, `getRoster()`,
151
+ `isLeader()`, `on()` / `off()`.
152
+ - Events: `joinSuccess` `{epoch, securityCode, sframe, key}`, `joinFailure` `{reason}`,
153
+ `mediaEncryptionServiceFailure` `{errorCode, message}`, `newKey`, `useKey` `{epoch}`,
154
+ `purgeKeys` `{epoch}`, `rosterAdded` `E2eeRosterMember[]`, `rosterRemoved` `{urls}`,
155
+ `leaderChanged`, `evicted`, `versionNegotiated`, `securityCodeChanged` `{code}`.
156
+
157
+ Transactions are tracked by ID so a completion maps to its `join` or `update` origin. A failed
158
+ `join` emits `joinFailure` with the engine's reason (`timeout`, `join_failure`,
159
+ `tree_fetch_failure`, `commit_fetch_failure`). A failed `update` (including
160
+ `update_override`) is only logged: the engine rolls back and stays in the group.
161
+
162
+ **HTTP:** the engine's request bytes are JSON-decoded, sent via `httpClient.request(url, body)`, and
163
+ the response is JSON-encoded back into `completeHttpRequest`. Completion is always asynchronous so
164
+ the engine is never re-entered from its own callback. On failure MLS completes the request as failed
165
+ with the service's `error.body.errorCode`, or `0` for client-side errors (JSON, network).
166
+
167
+ If libe2ee cannot recover from a service error code, or fails to process a response, it throws
168
+ `e2ee_negotiation_failure` out of `completeHttpRequest` (recoverable codes such as `not_leader` and
169
+ `epochs_not_matching` are handled internally). In WASM this is an opaque value with no message, so MLS
170
+ catches it and emits `mediaEncryptionServiceFailure` instead of letting it become an unhandled
171
+ rejection.
172
+
173
+ The engine's `keepAlive()` is for backend services (e.g. Homer) and is not called by the SDK.
174
+
175
+ ### `MediaEncryptionService`
176
+
177
+ Implements `IMlsHttpClient` with a bound `webex.request`:
178
+ `POST {service: 'media-encryption', url, body}`, resolving with the parsed response body.
179
+ Standard webex auth applies.
180
+
181
+ ### `E2eeSignaling`
182
+
183
+ Subscribes to the `media_encryption.*` events (see `MEDIA_ENCRYPTION_MERCURY_EVENTS`) on **both**
184
+ the meeting's LLM channel and mercury, since either can deliver them, and forwards each envelope to
185
+ `session.handleEvent(bytes, source)` tagged `'llm'` or `'mercury'`.
186
+
187
+ When the LLM channel is already connected for this meeting's locus it calls
188
+ `setLlmConnectedBeforeJoin(true)`; otherwise it calls `llmConnected()` on the next locus-matched
189
+ `online`. The locus URL is read through a `getLocusUrl()` callback so it stays correct across
190
+ breakout moves. `setLlmChannel()` swaps the channel when `Meeting` replaces it on reconnect.
191
+
192
+ ### `internal-plugin-identity`
193
+
194
+ - `getCredentials(contactId)` — generates an EC P-256 CSR, requests a certificate from
195
+ `webex-certificate-authority` (including the root), and caches the in-flight promise per contact.
196
+ Cached credentials are renewed when the leaf certificate expires within a day; concurrent callers
197
+ share one renewal.
198
+ - `getTrustAnchors()` — `{webexCaRoots, userIdentityRoots}`. Integration roots when
199
+ `services.isIntegrationEnvironment()` is true, otherwise production + FedRAMP roots.
200
+ `userIdentityRoots` is currently empty.
201
+
202
+ ### `MemberMLSReconciler`
203
+
204
+ Holds only the MLS roster (`Map<deviceUrl, E2eeRosterMember>`). The `deviceUrl → Member` index
205
+ lives in `MembersCollection.getMemberByDeviceUrl()`, and verification is stored on each `Member`.
206
+ Matching is per device: `rosterMember.url === member.participant.devices[i].url`.
207
+
208
+ Verification is surfaced through the existing `members:update` event; there is no dedicated event:
209
+
210
+ - **Locus-driven** — `Members` calls a registered pre-emit processor (`setMembersUpdateProcessor`)
211
+ before emitting `members:update`; `processMembersUpdate` stamps verification onto the delta members.
212
+ - **Roster-driven** — `applyRosterAdded` / `applyRosterRemoved` update the affected devices and pass
213
+ members whose verification changed to `reportMembersUpdated`, which makes `Members` emit
214
+ `members:update` with them in `delta.updated`.
215
+
216
+ Roster entries without a matching member stay in the map and are applied when that member next
217
+ appears, so ordering does not matter. The controller creates the reconciler in its constructor
218
+ (when E2EE is enabled), so verification is stamped for the whole meeting lifetime.
219
+
220
+ **Member state.** Each device verification keeps libe2ee's overall `validationResult` and the parsed
221
+ X.509 `identityResults` (one per credential, each with its chain leaf-first), so apps can show
222
+ identity and certificate details without parsing DER. Per device, the first successful result is
223
+ selected, falling back to the first result. A failed selected result is unverified; otherwise its
224
+ leaf `identityType` decides: Webex user/machine and external verified identities are verified,
225
+ anonymous identities are unverified, and no result or an unknown type is unknown. `Member.e2eeVerificationState`
226
+ aggregates devices: all verified → `verified`; all unknown → `unknown`; none verified but at least
227
+ one unverified → `unverified`; otherwise `partiallyVerified`. Verifiable-credential identities are
228
+ not supported.
229
+
230
+ ### `E2eeController` (`meeting.e2ee`)
231
+
232
+ Constructed with an `E2eeMeetingContext` (`correlationId`, `getLocusInfo()`, `getLlmChannel()`,
233
+ `members`), so it never references `Meeting` directly.
234
+
235
+ Public API: `state`, `getSecurityCode()`, `hasUntrustedMediaServices`, `start()`, `stop()`,
236
+ `llmChannelChanged()`, plus events (`EventsScope`).
237
+
238
+ `start()` never rejects, and is a no-op unless `required()` or while a session is already
239
+ `initializing`, `joining` or `joined`. It runs from `disabled`, `left`, `failed` and `evicted`, so an
240
+ app can retry after a failure by calling it again; each run creates a fresh MLS session:
241
+
242
+ 1. State → `initializing`. Load the WASM module and fetch credentials in parallel.
243
+ 2. Create `MediaEncryptionService` and `MLS`, wire session events, and `initialize()` with the device,
244
+ correlation ID, display name, group URL, credentials, trust anchors and timeouts.
245
+ 3. Start `E2eeSignaling`, state → `joining`, `session.join()`.
246
+
247
+ Session events:
248
+
249
+ - `joinSuccess` / `securityCodeChanged` → update the security code and emit
250
+ `SECURITY_CODE_UPDATED`.
251
+ - `rosterAdded` / `rosterRemoved` → update the reconciler, recompute media-service presence, and
252
+ check join completion.
253
+ - `joinFailure` / `mediaEncryptionServiceFailure` / `evicted` → `handleFatal()`.
254
+
255
+ **Join completion.** State becomes `joined` only when our own device URL appears in the MLS roster,
256
+ not on `joinSuccess`. This is what moves the trust state from `calculating` to `zeroTrust`.
257
+
258
+ **Media services.** `hasUntrustedMediaServices` is true when any roster member has device type
259
+ `MEDIA_SERVICE`. It is recomputed on every roster change and cleared on teardown; changes emit
260
+ `MEDIA_SERVICES_CHANGED {hasMediaServices}`. Some media services (video mesh) could be trusted in
261
+ future; for now any media service counts as untrusted.
262
+
263
+ **`handleFatal(state, reason, details)`** logs, sends the `js_sdk_e2ee_failure` behavioral metric
264
+ (`correlation_id`, `state`, `reason`, plus `errorCode` / `errorMessage` when available), tears down the
265
+ session, sets state `failed` or `evicted` (clearing the security code), and emits
266
+ `MEETING_E2EE_FAILURE {reason, errorCode?, errorMessage?}`. Reasons: `startFailed`, the engine's join-failure reason,
267
+ `mediaEncryptionServiceFailure`, `evicted`. It does not leave the meeting (see D7); the SDK does not
268
+ retry on its own.
269
+
270
+ **`stop()`** tears down (stop signaling, unsubscribe, `session.leave()`, reset the reconciler) and
271
+ sets state `left`. It is silent when state is `disabled`, so callers can invoke it unconditionally.
272
+ It also cancels a `start()` still awaiting the WASM module, credentials or MLS initialization: that
273
+ `start()` returns without starting signaling or joining, and without reporting a failure.
274
+
275
+ ## Integration
276
+
277
+ **`Meetings`** — owns `WasmLoader` and `E2eeManager`, preloads in `register()`, and passes
278
+ `e2eeManager` to each `Meeting`.
279
+
280
+ **`Meeting`**
281
+
282
+ - Constructor: `this.e2ee = attrs.e2eeManager?.createE2eeController(context)`; E2EE events are
283
+ forwarded on the `Meeting` emitter.
284
+ - Lifecycle (`updateE2eeOnSelfChange`, on `LOCUS_INFO_UPDATE_SELF`):
285
+ - **start** when this device's `joinedWith` transitions to `JOINED`. Gating on this device, not the
286
+ aggregate self state, avoids starting when another of the user's devices joins.
287
+ - **stop** when this device leaves `JOINED` or is moved back into the lobby
288
+ (`isUserUnadmitted` becomes true); a later re-admit starts again.
289
+ - **stop** in `MeetingUtil.cleanUp()` for meeting teardown.
290
+ - `llmChannelChanged()` is called whenever `Meeting` replaces its LLM channel.
291
+ - `trustState` getter:
292
+
293
+ ```ts
294
+ if (!this.isJoined()) return undefined;
295
+ const adaptive = !!info?.isBestEffortE2EEncryption;
296
+ const isEncrypted = !!info?.isV2E2EEncrypted;
297
+ if (isEncrypted && this.e2ee?.state !== E2eeState.Joined) return 'calculating';
298
+ const zeroTrust = isEncrypted && !this.e2ee?.hasUntrustedMediaServices;
299
+ if (adaptive) return zeroTrust ? 'adaptiveZeroTrust' : 'adaptiveStrong';
300
+ return zeroTrust ? 'zeroTrust' : 'strong';
301
+ ```
302
+
303
+ `meeting:trustStateChanged {trustState}` is emitted whenever this value changes.
304
+
305
+ **`Member`** — `e2eeVerificationState` plus per-device `get/set/removeE2eeDeviceVerification(s)`.
306
+ `ParticipantDevice` gains `url` (present at runtime, previously missing from the type).
307
+
308
+ **Events** (`EVENT_TRIGGERS`):
309
+
310
+ | Event | Payload |
311
+ |-------|---------|
312
+ | `meeting:e2ee:securityCodeUpdated` | `{securityCode: string | undefined}` |
313
+ | `meeting:e2ee:stateChanged` | `{state: E2eeState}` |
314
+ | `meeting:e2ee:mediaServicesChanged` | `{hasMediaServices}` |
315
+ | `meeting:e2ee:failure` | `{reason: string, errorCode?: number, errorMessage?: string}` |
316
+ | `meeting:trustStateChanged` | `{trustState}` |
317
+
318
+ The E2EE controller payloads are typed by `E2eeControllerEventMap` in `e2ee/types.ts`.
319
+
320
+ ## Static assets
321
+
322
+ The WASM module (`E2EE_WASM_ASSET`, with a sibling `.js` loader) is a runtime asset, not part of the
323
+ JS bundle, and is loaded from `meetings.assetsBaseUrl`. By default that URL is version-pinned on
324
+ unpkg (`webex@<sdk>/umd/assets/plugin-meetings/`, falling back to the plugin's `dist/assets/`), or
325
+ `/assets/plugin-meetings/` in development and when no version is known.
326
+
327
+ Each plugin keeps its files in its own `assets` folder. The package build copies them to
328
+ `dist/assets`, and the UMD build gathers them under `packages/webex/umd/assets/<plugin-name>/`, so
329
+ same-named files cannot collide. `samples:serve` serves each plugin's `assets` at
330
+ `/assets/<plugin-name>`. Self-hosting apps set `assetsBaseUrl` to a version-matched location; the
331
+ host must allow cross-origin requests and serve the `.js` file with a JavaScript MIME type.
332
+
333
+ ## Planned / not yet implemented
334
+
335
+ - **Media-key injection.** `internal-media-core` will implement a new method (working name
336
+ `setEncryptionKeys`; exact shape to be agreed with the media team) on both media connection types:
337
+
338
+ ```ts
339
+ interface IE2eeMediaConnection {
340
+ setEncryptionKeys(config: {
341
+ cipherSuite: number;
342
+ epochBits: number;
343
+ keys: Array<{epoch: number; baseKey: Uint8Array; index: number; indexBits: number}>;
344
+ activeEncryptionEpoch?: number; // undefined => decrypt-only
345
+ }): void;
346
+ }
347
+ ```
348
+
349
+ A `MediaKeyController` will buffer the SFrame params (from `joinSuccess`) and keys (`newKey`,
350
+ `useKey`, `purgeKeys`), and pass the **full key set** on every change. The call is idempotent, so
351
+ keys that arrive before media and media recreated on reconnect are both handled by replaying the
352
+ set. `Meeting` will attach it after `createMediaConnection()` and detach it in
353
+ `closePeerConnections()`. The MLS session and LLM persist across media reconnects, so the group is
354
+ not rejoined.
355
+ - **Media while E2EE has failed.** Because the SDK no longer leaves on failure (D7), the
356
+ `MediaKeyController` must ensure media is never sent unencrypted while E2EE is `failed` /
357
+ `evicted`. `trustState` currently stays `calculating` in that case; a dedicated failed value may
358
+ be added for app UIs.
359
+
360
+ ## Testing
361
+
362
+ Unit specs live in `test/unit/spec/e2ee/` (one per module) plus `common/wasm-loader`, `meeting`,
363
+ `meetings`, `member(s)` and `internal-plugin-identity` specs. `MLS` is tested against a fake `WebE2EE` module with no webex dependency, and the adapters against stubbed `webex.request`, LLM and mercury.