@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.
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/common/events/typed-events-scope.js +135 -0
- package/dist/common/events/typed-events-scope.js.map +1 -0
- package/dist/common/types.js +7 -0
- package/dist/common/types.js.map +1 -0
- package/dist/config.js +1 -1
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -1
- package/dist/e2ee/E2eeController.js +609 -0
- package/dist/e2ee/E2eeController.js.map +1 -0
- package/dist/e2ee/E2eeManager.js +50 -31
- package/dist/e2ee/E2eeManager.js.map +1 -1
- package/dist/e2ee/E2eeSignaling.js +18 -21
- package/dist/e2ee/E2eeSignaling.js.map +1 -1
- package/dist/e2ee/MediaEncryptionService.js +2 -5
- package/dist/e2ee/MediaEncryptionService.js.map +1 -1
- package/dist/e2ee/MemberMLSReconciler.js +194 -0
- package/dist/e2ee/MemberMLSReconciler.js.map +1 -0
- package/dist/e2ee/constants.js +28 -0
- package/dist/e2ee/constants.js.map +1 -0
- package/dist/e2ee/mls.js +86 -68
- package/dist/e2ee/mls.js.map +1 -1
- package/dist/e2ee/types.js +66 -11
- package/dist/e2ee/types.js.map +1 -1
- package/dist/e2ee/wasm.d.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meeting/index.js +394 -249
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/request.js +69 -58
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +4 -2
- package/dist/meeting/util.js.map +1 -1
- package/dist/meetings/index.js +87 -61
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/util.js +10 -0
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +159 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/members/collection.js +84 -1
- package/dist/members/collection.js.map +1 -1
- package/dist/members/index.js +58 -1
- package/dist/members/index.js.map +1 -1
- package/dist/metrics/constants.js +2 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/types/common/events/typed-events-scope.d.ts +73 -0
- package/dist/types/common/types.d.ts +9 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/e2ee/E2eeController.d.ts +131 -0
- package/dist/types/e2ee/E2eeManager.d.ts +26 -6
- package/dist/types/e2ee/E2eeSignaling.d.ts +1 -7
- package/dist/types/e2ee/MediaEncryptionService.d.ts +1 -3
- package/dist/types/e2ee/MemberMLSReconciler.d.ts +76 -0
- package/dist/types/e2ee/constants.d.ts +12 -0
- package/dist/types/e2ee/mls.d.ts +16 -10
- package/dist/types/e2ee/types.d.ts +117 -36
- package/dist/types/hashTree/hashTreeParser.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/meeting/index.d.ts +34 -0
- package/dist/types/meeting/util.d.ts +1 -1
- package/dist/types/member/index.d.ts +62 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/members/collection.d.ts +30 -0
- package/dist/types/members/index.d.ts +73 -0
- package/dist/types/metrics/constants.d.ts +1 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +21 -21
- package/src/common/events/typed-events-scope.ts +110 -0
- package/src/common/types.ts +10 -0
- package/src/constants.ts +6 -0
- package/src/e2ee/DESIGN.md +363 -0
- package/src/e2ee/E2eeController.ts +513 -0
- package/src/e2ee/E2eeManager.ts +48 -27
- package/src/e2ee/E2eeSignaling.ts +13 -28
- package/src/e2ee/MediaEncryptionService.ts +2 -4
- package/src/e2ee/MemberMLSReconciler.ts +175 -0
- package/src/e2ee/constants.ts +34 -0
- package/src/e2ee/mls.ts +63 -33
- package/src/e2ee/types.ts +129 -35
- package/src/e2ee/wasm.d.ts +18 -14
- package/src/hashTree/hashTreeParser.ts +1 -1
- package/src/index.ts +1 -0
- package/src/meeting/index.ts +155 -0
- package/src/meeting/request.ts +16 -0
- package/src/meeting/util.ts +2 -1
- package/src/meetings/index.ts +30 -5
- package/src/meetings/util.ts +8 -0
- package/src/member/index.ts +169 -0
- package/src/member/types.ts +1 -0
- package/src/members/collection.ts +67 -1
- package/src/members/index.ts +59 -1
- package/src/metrics/constants.ts +1 -0
- package/test/unit/spec/common/events/typed-events-scope.ts +88 -0
- package/test/unit/spec/e2ee/E2eeController.ts +753 -0
- package/test/unit/spec/e2ee/E2eeManager.ts +53 -29
- package/test/unit/spec/e2ee/E2eeSignaling.ts +19 -10
- package/test/unit/spec/e2ee/MemberMLSReconciler.ts +353 -0
- package/test/unit/spec/e2ee/mls.ts +86 -34
- package/test/unit/spec/meeting/index.js +662 -0
- package/test/unit/spec/meeting/request.js +35 -0
- package/test/unit/spec/meeting/utils.js +4 -0
- package/test/unit/spec/meetings/index.js +36 -1
- package/test/unit/spec/meetings/utils.js +15 -0
- package/test/unit/spec/member/index.js +292 -0
- package/test/unit/spec/members/collection.js +50 -0
- package/test/unit/spec/members/index.js +71 -0
- package/test/utils/webex-config.js +1 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import LoggerProxy from '../common/logs/logger-proxy';
|
|
6
|
+
import type Member from '../member';
|
|
7
|
+
import type MembersCollection from '../members/collection';
|
|
8
|
+
import type {MembersUpdatePayload} from '../members';
|
|
9
|
+
import type {E2eeDeviceVerification, E2eeRosterMember} from './types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Reconciles the MLS roster (keyed by device URL) against the meeting's `Members`, stamping a
|
|
13
|
+
* per-device verification onto each `Member` and deriving an aggregate verification state.
|
|
14
|
+
*
|
|
15
|
+
* It holds only the MLS roster; the device-URL -> member lookup lives in `MembersCollection`, and
|
|
16
|
+
* verification lives on each `Member`. Every path iterates its argument exactly once:
|
|
17
|
+
* - Member changes are fed in via `processMembersUpdate` (from the Members pre-emit processor),
|
|
18
|
+
* which stamps the (recreated) members' verification before `members:update` is emitted.
|
|
19
|
+
* - Roster changes update only the members owning the affected device URLs (via the collection's
|
|
20
|
+
* reverse index); members whose verification actually changed are handed to
|
|
21
|
+
* `reportMembersUpdated` so Members emits a `members:update` for them.
|
|
22
|
+
*/
|
|
23
|
+
export default class MemberMLSReconciler {
|
|
24
|
+
private readonly membersCollection: MembersCollection;
|
|
25
|
+
|
|
26
|
+
private readonly reportMembersUpdated: (updatedMembers: Member[]) => void;
|
|
27
|
+
|
|
28
|
+
private readonly rosterByDeviceUrl = new Map<string, E2eeRosterMember>();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {Object} deps
|
|
32
|
+
* @param {MembersCollection} deps.membersCollection - The meeting's members collection.
|
|
33
|
+
* @param {Function} deps.reportMembersUpdated - Asks Members to emit `members:update` for the
|
|
34
|
+
* given members (used for roster-driven verification changes that have no Locus update).
|
|
35
|
+
*/
|
|
36
|
+
constructor({
|
|
37
|
+
membersCollection,
|
|
38
|
+
reportMembersUpdated,
|
|
39
|
+
}: {
|
|
40
|
+
membersCollection: MembersCollection;
|
|
41
|
+
reportMembersUpdated: (updatedMembers: Member[]) => void;
|
|
42
|
+
}) {
|
|
43
|
+
this.membersCollection = membersCollection;
|
|
44
|
+
this.reportMembersUpdated = reportMembersUpdated;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Stamps verification onto the members changed by a Locus update, before `members:update` is
|
|
49
|
+
* emitted. Does not itself emit — Members emits the (single) event.
|
|
50
|
+
* @param {MembersUpdatePayload} payload
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
processMembersUpdate(payload: MembersUpdatePayload): void {
|
|
54
|
+
const {added = [], updated = []} = payload?.delta ?? {};
|
|
55
|
+
|
|
56
|
+
[...added, ...updated].forEach((member) => this.stampMember(member));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Adds/updates MLS roster members, updating the owning member's per-device verification and
|
|
61
|
+
* reporting the members whose verification changed.
|
|
62
|
+
* @param {E2eeRosterMember[]} added
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
applyRosterAdded(added: E2eeRosterMember[]): void {
|
|
66
|
+
const changed = new Set<any>();
|
|
67
|
+
|
|
68
|
+
added.forEach((entry) => {
|
|
69
|
+
this.rosterByDeviceUrl.set(entry.deviceUrl, entry);
|
|
70
|
+
|
|
71
|
+
const member = this.membersCollection.getMemberByDeviceUrl(entry.deviceUrl);
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
member?.setE2eeDeviceVerification?.(
|
|
75
|
+
entry.deviceUrl,
|
|
76
|
+
MemberMLSReconciler.toDeviceVerification(entry)
|
|
77
|
+
)
|
|
78
|
+
) {
|
|
79
|
+
changed.add(member);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
LoggerProxy.logger.info(
|
|
84
|
+
`e2ee: MemberMLSReconciler#applyRosterAdded --> ${added.length} added (roster size ${this.rosterByDeviceUrl.size})`
|
|
85
|
+
);
|
|
86
|
+
this.report(changed);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Removes MLS roster members by device URL, clearing the owning member's per-device verification
|
|
91
|
+
* and reporting the members whose verification changed.
|
|
92
|
+
* @param {string[]} urls
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
applyRosterRemoved(urls: string[]): void {
|
|
96
|
+
const changed = new Set<any>();
|
|
97
|
+
|
|
98
|
+
urls.forEach((url) => {
|
|
99
|
+
this.rosterByDeviceUrl.delete(url);
|
|
100
|
+
|
|
101
|
+
const member = this.membersCollection.getMemberByDeviceUrl(url);
|
|
102
|
+
|
|
103
|
+
if (member?.removeE2eeDeviceVerification?.(url)) {
|
|
104
|
+
changed.add(member);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
LoggerProxy.logger.info(
|
|
109
|
+
`e2ee: MemberMLSReconciler#applyRosterRemoved --> ${urls.length} removed (roster size ${this.rosterByDeviceUrl.size})`
|
|
110
|
+
);
|
|
111
|
+
this.report(changed);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Clears the roster and the verification it had applied, reporting the affected members.
|
|
116
|
+
* @returns {void}
|
|
117
|
+
*/
|
|
118
|
+
reset(): void {
|
|
119
|
+
const changed = new Set<any>();
|
|
120
|
+
|
|
121
|
+
this.rosterByDeviceUrl.forEach((_entry, url) => {
|
|
122
|
+
const member = this.membersCollection.getMemberByDeviceUrl(url);
|
|
123
|
+
|
|
124
|
+
if (member?.removeE2eeDeviceVerification?.(url)) {
|
|
125
|
+
changed.add(member);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
this.rosterByDeviceUrl.clear();
|
|
130
|
+
this.report(changed);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Replaces a member's verification from the current roster (for a recreated member). No report.
|
|
135
|
+
* @param {any} member
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
|
+
private stampMember(member: any): void {
|
|
139
|
+
const verifications: E2eeDeviceVerification[] = [];
|
|
140
|
+
|
|
141
|
+
(member?.participant?.devices ?? []).forEach((device) => {
|
|
142
|
+
const rosterEntry = device?.url ? this.rosterByDeviceUrl.get(device.url) : undefined;
|
|
143
|
+
|
|
144
|
+
if (rosterEntry) {
|
|
145
|
+
verifications.push(MemberMLSReconciler.toDeviceVerification(rosterEntry));
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
member.setE2eeDeviceVerifications?.(verifications);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @param {Set} changed
|
|
154
|
+
* @returns {void}
|
|
155
|
+
*/
|
|
156
|
+
private report(changed: Set<any>): void {
|
|
157
|
+
if (changed.size) {
|
|
158
|
+
this.reportMembersUpdated([...changed]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @param {E2eeRosterMember} rosterEntry
|
|
164
|
+
* @returns {E2eeDeviceVerification}
|
|
165
|
+
*/
|
|
166
|
+
private static toDeviceVerification(rosterEntry: E2eeRosterMember): E2eeDeviceVerification {
|
|
167
|
+
return {
|
|
168
|
+
deviceUrl: rosterEntry.deviceUrl,
|
|
169
|
+
validationResult: rosterEntry.validationResult,
|
|
170
|
+
displayName: rosterEntry.displayName,
|
|
171
|
+
deviceType: rosterEntry.deviceType,
|
|
172
|
+
...(rosterEntry.identityResults && {identityResults: rosterEntry.identityResults}),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/** LLM/Mercury events carrying MLS protocol messages, forwarded to the MLS engine. */
|
|
6
|
+
export const MEDIA_ENCRYPTION_MERCURY_EVENTS = [
|
|
7
|
+
'event:media_encryption.leader_nominated',
|
|
8
|
+
'event:media_encryption.welcome',
|
|
9
|
+
'event:media_encryption.annotated_welcome',
|
|
10
|
+
'event:media_encryption.multi_welcome',
|
|
11
|
+
'event:media_encryption.group_update',
|
|
12
|
+
'event:media_encryption.annotated_commit',
|
|
13
|
+
'event:media_encryption.large_group_update',
|
|
14
|
+
'event:media_encryption.use_key',
|
|
15
|
+
'event:media_encryption.join_request',
|
|
16
|
+
'event:media_encryption.leave_request',
|
|
17
|
+
'event:media_encryption.join_failure',
|
|
18
|
+
'event:media_encryption.leader_changed',
|
|
19
|
+
'event:media_encryption.message_segment',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
/** Webex service names resolved from the service catalog. */
|
|
23
|
+
export const MEDIA_ENCRYPTION_SERVICE = 'media-encryption';
|
|
24
|
+
|
|
25
|
+
/** MLS roster device type identifying a backend media service. */
|
|
26
|
+
export const MEDIA_SERVICE_DEVICE_TYPE = 'MEDIA_SERVICE';
|
|
27
|
+
|
|
28
|
+
/* The WASM module that contains the libe2ee + mlspp libraries with a WebE2EE wrapper around them, required for joining MLS group for E2EE meetings.
|
|
29
|
+
* The version is in the filename as it is important that JS-SDK implementation of MLS class matches the WASM module version.
|
|
30
|
+
*/
|
|
31
|
+
export const E2EE_WASM_ASSET = 'e2ee-0.0.1.wasm';
|
|
32
|
+
|
|
33
|
+
/** Locus join-request device capability advertising support for large (1K) E2EE meetings. */
|
|
34
|
+
export const E2EE_1K_SUPPORTED = 'E2EE_1K_SUPPORTED';
|
package/src/e2ee/mls.ts
CHANGED
|
@@ -23,10 +23,6 @@ import type {
|
|
|
23
23
|
WebE2EEInstance,
|
|
24
24
|
} from './wasm';
|
|
25
25
|
|
|
26
|
-
const DEFAULT_JOIN_TIMEOUT = 180_000;
|
|
27
|
-
const DEFAULT_COALESCE_WINDOW = 500;
|
|
28
|
-
const DEFAULT_DEVICE_TYPE = 'WEB';
|
|
29
|
-
|
|
30
26
|
// WASM log levels, indexed by the numeric level the engine emits (see LogLevel in libe2ee).
|
|
31
27
|
const WASM_LOG_LEVELS = ['', 'FATAL', 'ERROR', 'WARN', 'INFO', 'DEBUG'];
|
|
32
28
|
|
|
@@ -34,7 +30,7 @@ const WASM_LOG_LEVELS = ['', 'FATAL', 'ERROR', 'WARN', 'INFO', 'DEBUG'];
|
|
|
34
30
|
export interface MLSEventMap {
|
|
35
31
|
joinSuccess: {epoch: number; securityCode: string; sframe: SframeParams; key: E2eeKey};
|
|
36
32
|
joinFailure: {reason: string};
|
|
37
|
-
|
|
33
|
+
mediaEncryptionServiceFailure: {errorCode: number; message: string};
|
|
38
34
|
newKey: E2eeKey;
|
|
39
35
|
useKey: {epoch: number};
|
|
40
36
|
purgeKeys: {epoch: number};
|
|
@@ -54,7 +50,7 @@ export type MLSEvent = keyof MLSEventMap;
|
|
|
54
50
|
* emitted as typed events. This keeps it unit-testable in isolation.
|
|
55
51
|
*/
|
|
56
52
|
export default class MLS {
|
|
57
|
-
private readonly
|
|
53
|
+
private readonly module: ModuleInstance;
|
|
58
54
|
|
|
59
55
|
private readonly httpClient: IMlsHttpClient;
|
|
60
56
|
|
|
@@ -64,22 +60,18 @@ export default class MLS {
|
|
|
64
60
|
|
|
65
61
|
private e2ee: WebE2EEInstance | null = null;
|
|
66
62
|
|
|
63
|
+
private readonly waitTimeouts = new Set<ReturnType<typeof setTimeout>>();
|
|
64
|
+
|
|
67
65
|
private lastSecurityCode = '';
|
|
68
66
|
|
|
69
67
|
/**
|
|
70
68
|
* @param {Object} deps
|
|
69
|
+
* @param {ModuleInstance} deps.module - The loaded WASM module used to instantiate the engine.
|
|
71
70
|
* @param {IMlsHttpClient} deps.httpClient - Transport for the engine's protocol requests.
|
|
72
|
-
* @param {Function} deps.loadModule - Loads the WASM module instance; supplied by the integration layer.
|
|
73
71
|
*/
|
|
74
|
-
constructor({
|
|
75
|
-
httpClient,
|
|
76
|
-
loadModule,
|
|
77
|
-
}: {
|
|
78
|
-
httpClient: IMlsHttpClient;
|
|
79
|
-
loadModule: () => Promise<ModuleInstance>;
|
|
80
|
-
}) {
|
|
72
|
+
constructor({httpClient, module}: {httpClient: IMlsHttpClient; module: ModuleInstance}) {
|
|
81
73
|
this.httpClient = httpClient;
|
|
82
|
-
this.
|
|
74
|
+
this.module = module;
|
|
83
75
|
}
|
|
84
76
|
|
|
85
77
|
/**
|
|
@@ -113,30 +105,26 @@ export default class MLS {
|
|
|
113
105
|
}
|
|
114
106
|
|
|
115
107
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
108
|
+
* Instantiates the engine, wires its callbacks, and applies credentials, trust anchors and
|
|
109
|
+
* timeouts. Must be called before {@link join}.
|
|
118
110
|
* @param {MLSConfig} config
|
|
119
|
-
* @returns {
|
|
111
|
+
* @returns {void}
|
|
120
112
|
*/
|
|
121
|
-
|
|
122
|
-
LoggerProxy.logger.info('e2ee: MLS --> initialize:
|
|
123
|
-
const module = await this.loadModule();
|
|
124
|
-
|
|
125
|
-
// When loadModule uses WasmLoader.get(), repeated calls share the in-flight promise or return
|
|
126
|
-
// the cached module, so this check can stay after loading.
|
|
113
|
+
initialize(config: MLSConfig): void {
|
|
114
|
+
LoggerProxy.logger.info('e2ee: MLS --> initialize: instantiating engine');
|
|
127
115
|
if (this.e2ee) {
|
|
128
116
|
LoggerProxy.logger.info('e2ee: MLS --> initialize: already initialized');
|
|
129
117
|
|
|
130
118
|
return;
|
|
131
119
|
}
|
|
132
120
|
|
|
133
|
-
this.e2ee = new module.WebE2EE();
|
|
121
|
+
this.e2ee = new this.module.WebE2EE();
|
|
134
122
|
this.setupCallbacks();
|
|
135
123
|
|
|
136
124
|
this.e2ee.initialize(
|
|
137
125
|
config.participantId,
|
|
138
126
|
config.deviceUrl,
|
|
139
|
-
config.deviceType
|
|
127
|
+
config.deviceType,
|
|
140
128
|
config.correlationId,
|
|
141
129
|
config.displayName,
|
|
142
130
|
config.serviceUrl
|
|
@@ -157,8 +145,12 @@ export default class MLS {
|
|
|
157
145
|
);
|
|
158
146
|
}
|
|
159
147
|
|
|
160
|
-
|
|
161
|
-
|
|
148
|
+
if (config.joinTimeout !== undefined) {
|
|
149
|
+
this.e2ee.setJoinTimeout(config.joinTimeout);
|
|
150
|
+
}
|
|
151
|
+
if (config.coalesceWindow !== undefined) {
|
|
152
|
+
this.e2ee.setCoalesceWindow(config.coalesceWindow);
|
|
153
|
+
}
|
|
162
154
|
|
|
163
155
|
LoggerProxy.logger.info('e2ee: MLS --> initialize: engine initialized');
|
|
164
156
|
}
|
|
@@ -253,9 +245,12 @@ export default class MLS {
|
|
|
253
245
|
});
|
|
254
246
|
|
|
255
247
|
e2ee.setOnWait((milliseconds, handlerId) => {
|
|
256
|
-
setTimeout(() => {
|
|
248
|
+
const timeout = setTimeout(() => {
|
|
249
|
+
this.waitTimeouts.delete(timeout);
|
|
257
250
|
this.e2ee?.completeWait(handlerId);
|
|
258
251
|
}, milliseconds);
|
|
252
|
+
|
|
253
|
+
this.waitTimeouts.add(timeout);
|
|
259
254
|
});
|
|
260
255
|
|
|
261
256
|
e2ee.setOnGotKey((epoch: EpochInfo) => {
|
|
@@ -264,7 +259,7 @@ export default class MLS {
|
|
|
264
259
|
baseKey: new Uint8Array(epoch.base_key),
|
|
265
260
|
index: epoch.index,
|
|
266
261
|
indexBits: epoch.index_bits,
|
|
267
|
-
canEncrypt: false,
|
|
262
|
+
canEncrypt: false, // the key can only be used for encryption after onUseKey is called
|
|
268
263
|
});
|
|
269
264
|
});
|
|
270
265
|
|
|
@@ -379,7 +374,7 @@ export default class MLS {
|
|
|
379
374
|
* `e2ee_negotiation_failure` out of this call when it can't recover from the service's error code
|
|
380
375
|
* or fails to process a successful response; this surfaces in JS as an opaque value with no
|
|
381
376
|
* message. That is unrecoverable for the in-flight operation, so it is reported as
|
|
382
|
-
* `
|
|
377
|
+
* `mediaEncryptionServiceFailure` instead of escaping as an unhandled rejection.
|
|
383
378
|
* @param {number} handlerId
|
|
384
379
|
* @param {boolean} success
|
|
385
380
|
* @param {Uint8Array} body
|
|
@@ -400,7 +395,7 @@ export default class MLS {
|
|
|
400
395
|
LoggerProxy.logger.error(
|
|
401
396
|
`e2ee: MLS --> engine threw while completing HTTP request (success=${success}, errorCode=${errorCode}): ${error}`
|
|
402
397
|
);
|
|
403
|
-
this.emitEvent('
|
|
398
|
+
this.emitEvent('mediaEncryptionServiceFailure', {
|
|
404
399
|
errorCode,
|
|
405
400
|
message: success ? 'Engine failed to process HTTP response' : message,
|
|
406
401
|
});
|
|
@@ -448,6 +443,41 @@ export default class MLS {
|
|
|
448
443
|
this.assertInitialized().leave();
|
|
449
444
|
}
|
|
450
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Detaches engine callbacks and releases the WASM engine and wrapper resources.
|
|
448
|
+
* @returns {void}
|
|
449
|
+
*/
|
|
450
|
+
cleanUp(): void {
|
|
451
|
+
this.waitTimeouts.forEach((timeout) => clearTimeout(timeout));
|
|
452
|
+
this.waitTimeouts.clear();
|
|
453
|
+
this.transactions.clear();
|
|
454
|
+
this.lastSecurityCode = '';
|
|
455
|
+
|
|
456
|
+
const {e2ee} = this;
|
|
457
|
+
|
|
458
|
+
this.e2ee = null;
|
|
459
|
+
|
|
460
|
+
if (e2ee) {
|
|
461
|
+
e2ee.setOnNewTransaction(null);
|
|
462
|
+
e2ee.setOnCompleteTransaction(null);
|
|
463
|
+
e2ee.setOnHttpRequest(null);
|
|
464
|
+
e2ee.setOnWait(null);
|
|
465
|
+
e2ee.setOnGotKey(null);
|
|
466
|
+
e2ee.setOnUseKey(null);
|
|
467
|
+
e2ee.setOnLeader(null);
|
|
468
|
+
e2ee.setOnPurgeBefore(null);
|
|
469
|
+
e2ee.setOnEvicted(null);
|
|
470
|
+
e2ee.setOnAddRoster(null);
|
|
471
|
+
e2ee.setOnRemoveRoster(null);
|
|
472
|
+
e2ee.setOnE2eeVersion(null);
|
|
473
|
+
e2ee.setOnMissingCommit(null);
|
|
474
|
+
e2ee.setOnLog(null);
|
|
475
|
+
e2ee.delete();
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
this.emitter.removeAllListeners();
|
|
479
|
+
}
|
|
480
|
+
|
|
451
481
|
/**
|
|
452
482
|
* Forwards an incoming MLS protocol event (from the signaling channel) to the engine.
|
|
453
483
|
* @param {Uint8Array} eventData
|
|
@@ -518,7 +548,7 @@ export default class MLS {
|
|
|
518
548
|
*/
|
|
519
549
|
private static toRosterMember(member: RosterMember): E2eeRosterMember {
|
|
520
550
|
return {
|
|
521
|
-
|
|
551
|
+
deviceUrl: member.url,
|
|
522
552
|
displayName: member.display_name,
|
|
523
553
|
deviceType: member.device_type,
|
|
524
554
|
validationResult: member.validation_result,
|
package/src/e2ee/types.ts
CHANGED
|
@@ -2,12 +2,88 @@
|
|
|
2
2
|
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import type {IdentityCredentials, IdentityTrustAnchors} from '@webex/internal-plugin-identity';
|
|
6
|
+
import type LLMChannel from '@webex/internal-plugin-llm';
|
|
7
|
+
|
|
8
|
+
import {EVENT_TRIGGERS, type Enum} from '../constants';
|
|
9
|
+
import type {LocusDTO} from '../locus-info/types';
|
|
10
|
+
import type Members from '../members';
|
|
11
|
+
|
|
12
|
+
/** The Locus DTO fields consumed by E2EE, matching the shape exposed by `Meeting.locusInfo`. */
|
|
13
|
+
export type E2eeLocusInfo = Pick<LocusDTO, 'url' | 'info'>;
|
|
14
|
+
|
|
15
|
+
/** Per-meeting context supplied by Meetings without exposing its Meeting class to E2EE. */
|
|
16
|
+
export interface E2eeMeetingContext {
|
|
17
|
+
getCorrelationId(): string;
|
|
18
|
+
getLocusInfo(): E2eeLocusInfo | undefined;
|
|
19
|
+
getLlmChannel(): LLMChannel | undefined;
|
|
20
|
+
members: Members;
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
/**
|
|
6
|
-
* SDK-facing
|
|
7
|
-
* identity-plugin and signaling types are added by the later adapter phases.
|
|
24
|
+
* SDK-facing E2EE types (camelCase), mapped from the raw WASM boundary shapes in wasm.d.ts.
|
|
8
25
|
*/
|
|
9
26
|
|
|
10
|
-
/**
|
|
27
|
+
/** Lifecycle state of a per-meeting MLS session. */
|
|
28
|
+
export const E2eeState = {
|
|
29
|
+
Disabled: 'disabled',
|
|
30
|
+
Initializing: 'initializing',
|
|
31
|
+
Joining: 'joining',
|
|
32
|
+
Joined: 'joined',
|
|
33
|
+
Failed: 'failed',
|
|
34
|
+
Evicted: 'evicted',
|
|
35
|
+
Left: 'left',
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
export type E2eeState = Enum<typeof E2eeState>;
|
|
39
|
+
|
|
40
|
+
/** Event payloads emitted by E2eeController and forwarded through Meeting. */
|
|
41
|
+
export interface E2eeControllerEventMap {
|
|
42
|
+
[EVENT_TRIGGERS.MEETING_E2EE_SECURITY_CODE_UPDATED]: {securityCode: string | undefined};
|
|
43
|
+
[EVENT_TRIGGERS.MEETING_E2EE_STATE_CHANGED]: {state: E2eeState};
|
|
44
|
+
[EVENT_TRIGGERS.MEETING_E2EE_MEDIA_SERVICES_CHANGED]: {hasMediaServices: boolean};
|
|
45
|
+
[EVENT_TRIGGERS.MEETING_E2EE_FAILURE]: {
|
|
46
|
+
reason: string;
|
|
47
|
+
errorCode?: number;
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type E2eeControllerEvent = keyof E2eeControllerEventMap;
|
|
53
|
+
|
|
54
|
+
/** The meeting's overall E2EE trust state, surfaced to the app for its UI indicator. */
|
|
55
|
+
export const TrustState = {
|
|
56
|
+
Calculating: 'calculating',
|
|
57
|
+
Failed: 'failed',
|
|
58
|
+
Strong: 'strong',
|
|
59
|
+
ZeroTrust: 'zeroTrust',
|
|
60
|
+
AdaptiveStrong: 'adaptiveStrong',
|
|
61
|
+
AdaptiveZeroTrust: 'adaptiveZeroTrust',
|
|
62
|
+
} as const;
|
|
63
|
+
|
|
64
|
+
export type TrustState = Enum<typeof TrustState>;
|
|
65
|
+
|
|
66
|
+
/** A media-encryption (SFrame) key for a given MLS epoch. */
|
|
67
|
+
export interface E2eeKey {
|
|
68
|
+
epoch: number;
|
|
69
|
+
baseKey: Uint8Array;
|
|
70
|
+
index: number;
|
|
71
|
+
indexBits: number;
|
|
72
|
+
canEncrypt: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** SFrame parameters negotiated for the group, reported on a successful join. */
|
|
76
|
+
export interface SframeParams {
|
|
77
|
+
cipherSuite: number;
|
|
78
|
+
epochBits: number;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Credential-validation outcome for an MLS roster member. Mirrors (by ordinal) the C++
|
|
83
|
+
* `RosterStatus::ValidationResult` enum in libe2ee (`common/include/e2ee_common/types.h`) — keep
|
|
84
|
+
* the two in sync. For MultiCredential, `PartialSuccess` means at least one credential passed and
|
|
85
|
+
* at least one failed; X.509 identity verification is derived from the individual X.509 results.
|
|
86
|
+
*/
|
|
11
87
|
export const E2eeValidationResult = {
|
|
12
88
|
Success: 0,
|
|
13
89
|
PartialSuccess: 1,
|
|
@@ -25,9 +101,12 @@ export const E2eeValidationResult = {
|
|
|
25
101
|
MissingDisplayNameExtension: 13,
|
|
26
102
|
} as const;
|
|
27
103
|
|
|
28
|
-
export type E2eeValidationResult =
|
|
104
|
+
export type E2eeValidationResult = Enum<typeof E2eeValidationResult>;
|
|
29
105
|
|
|
30
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Identity type attached to the leaf X.509 certificate. Mirrors the C++ `IdentityType` enum in
|
|
108
|
+
* libe2ee (`common/include/e2ee_common/types.h`) — keep the ordinals in sync.
|
|
109
|
+
*/
|
|
31
110
|
export const E2eeIdentityType = {
|
|
32
111
|
WebexAnonymousIdentity: 0,
|
|
33
112
|
WebexMachineIdentity: 1,
|
|
@@ -35,24 +114,9 @@ export const E2eeIdentityType = {
|
|
|
35
114
|
ExternalVerifiedIdentity: 3,
|
|
36
115
|
} as const;
|
|
37
116
|
|
|
38
|
-
export type E2eeIdentityType =
|
|
117
|
+
export type E2eeIdentityType = Enum<typeof E2eeIdentityType>;
|
|
39
118
|
|
|
40
|
-
/**
|
|
41
|
-
export interface E2eeKey {
|
|
42
|
-
epoch: number;
|
|
43
|
-
baseKey: Uint8Array;
|
|
44
|
-
index: number;
|
|
45
|
-
indexBits: number;
|
|
46
|
-
canEncrypt: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** SFrame parameters negotiated for an MLS group. */
|
|
50
|
-
export interface SframeParams {
|
|
51
|
-
cipherSuite: number;
|
|
52
|
-
epochBits: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Parsed certificate information returned with a roster member. */
|
|
119
|
+
/** Parsed X.509 certificate details from a member's certificate chain. */
|
|
56
120
|
export interface E2eeCertificateInfo {
|
|
57
121
|
primaryName: string;
|
|
58
122
|
commonName: string;
|
|
@@ -68,35 +132,60 @@ export interface E2eeCertificateInfo {
|
|
|
68
132
|
}
|
|
69
133
|
|
|
70
134
|
export interface E2eeIdentityResult {
|
|
135
|
+
/** Result for this X.509 credential, which may differ from the overall MultiCredential result. */
|
|
71
136
|
result: E2eeValidationResult;
|
|
72
137
|
certificateChain: E2eeCertificateInfo[];
|
|
73
138
|
failedCertIndex?: number;
|
|
74
139
|
}
|
|
75
140
|
|
|
76
|
-
/** A member of the MLS roster and its credential
|
|
141
|
+
/** A member of the MLS roster and its overall libe2ee credential validation result. */
|
|
77
142
|
export interface E2eeRosterMember {
|
|
78
|
-
|
|
143
|
+
deviceUrl: string;
|
|
79
144
|
displayName: string;
|
|
80
145
|
deviceType: string;
|
|
81
146
|
validationResult: E2eeValidationResult;
|
|
82
147
|
identityResults?: E2eeIdentityResult[];
|
|
83
148
|
}
|
|
84
149
|
|
|
85
|
-
/**
|
|
150
|
+
/** Per-device E2EE verification result, derived from the MLS roster and applied onto a Member. */
|
|
151
|
+
export interface E2eeDeviceVerification {
|
|
152
|
+
deviceUrl: string;
|
|
153
|
+
/** Overall libe2ee result for this device's credential or MultiCredential. */
|
|
154
|
+
validationResult: E2eeValidationResult;
|
|
155
|
+
displayName?: string;
|
|
156
|
+
deviceType?: string;
|
|
157
|
+
identityResults?: E2eeIdentityResult[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** E2EE verification state of a single device, derived from its X.509 identity result. */
|
|
161
|
+
export const E2eeDeviceVerificationState = {
|
|
162
|
+
Unknown: 'unknown',
|
|
163
|
+
Verified: 'verified',
|
|
164
|
+
Unverified: 'unverified',
|
|
165
|
+
} as const;
|
|
166
|
+
|
|
167
|
+
export type E2eeDeviceVerificationState = Enum<typeof E2eeDeviceVerificationState>;
|
|
168
|
+
|
|
169
|
+
/** A member's aggregate E2EE verification state across all of their devices. */
|
|
170
|
+
export const E2eeMemberVerificationState = {
|
|
171
|
+
Unknown: 'unknown',
|
|
172
|
+
Verified: 'verified',
|
|
173
|
+
Unverified: 'unverified',
|
|
174
|
+
PartiallyVerified: 'partiallyVerified',
|
|
175
|
+
} as const;
|
|
176
|
+
|
|
177
|
+
export type E2eeMemberVerificationState = Enum<typeof E2eeMemberVerificationState>;
|
|
178
|
+
|
|
179
|
+
/** Configuration for initializing an MLS group session. */
|
|
86
180
|
export interface MLSConfig {
|
|
87
181
|
participantId: string;
|
|
88
182
|
deviceUrl: string;
|
|
89
|
-
deviceType
|
|
183
|
+
deviceType: string;
|
|
90
184
|
correlationId: string;
|
|
91
185
|
displayName: string;
|
|
92
186
|
serviceUrl: string;
|
|
93
|
-
credentials?:
|
|
94
|
-
trustAnchors?:
|
|
95
|
-
webexCaRoots?: string;
|
|
96
|
-
domainNameRoots?: string;
|
|
97
|
-
userIdentityRoots?: string;
|
|
98
|
-
domainNameRootsP7b?: Uint8Array;
|
|
99
|
-
};
|
|
187
|
+
credentials?: IdentityCredentials;
|
|
188
|
+
trustAnchors?: IdentityTrustAnchors;
|
|
100
189
|
joinTimeout?: number;
|
|
101
190
|
coalesceWindow?: number;
|
|
102
191
|
}
|
|
@@ -110,5 +199,10 @@ export interface IMlsHttpClient {
|
|
|
110
199
|
request(url: string, body: unknown): Promise<unknown>;
|
|
111
200
|
}
|
|
112
201
|
|
|
113
|
-
/**
|
|
114
|
-
export
|
|
202
|
+
/** Which signaling channel an incoming MLS protocol event arrived on. */
|
|
203
|
+
export const E2eeSignalingSource = {
|
|
204
|
+
Llm: 'llm',
|
|
205
|
+
Mercury: 'mercury',
|
|
206
|
+
} as const;
|
|
207
|
+
|
|
208
|
+
export type E2eeSignalingSource = Enum<typeof E2eeSignalingSource>;
|
package/src/e2ee/wasm.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ export interface RosterMember {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export interface WebE2EEInstance {
|
|
88
|
+
delete(): void;
|
|
89
|
+
|
|
88
90
|
initialize(
|
|
89
91
|
participantId: string,
|
|
90
92
|
deviceUrl: string,
|
|
@@ -123,20 +125,22 @@ export interface WebE2EEInstance {
|
|
|
123
125
|
setJoinTimeout(milliseconds: number): void;
|
|
124
126
|
setPurgeKeysTimeout(milliseconds: number): void;
|
|
125
127
|
|
|
126
|
-
setOnNewTransaction(callback: (transaction: Transaction) => void): void;
|
|
127
|
-
setOnCompleteTransaction(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
setOnNewTransaction(callback: ((transaction: Transaction) => void) | null): void;
|
|
129
|
+
setOnCompleteTransaction(
|
|
130
|
+
callback: ((id: string, result: TransactionResult) => void) | null
|
|
131
|
+
): void;
|
|
132
|
+
setOnHttpRequest(callback: ((request: HTTPRequest) => void) | null): void;
|
|
133
|
+
setOnWait(callback: ((milliseconds: number, handlerId: number) => void) | null): void;
|
|
134
|
+
setOnGotKey(callback: ((epoch: EpochInfo) => void) | null): void;
|
|
135
|
+
setOnUseKey(callback: ((epoch: number) => void) | null): void;
|
|
136
|
+
setOnLeader(callback: (() => void) | null): void;
|
|
137
|
+
setOnPurgeBefore(callback: ((epoch: number) => void) | null): void;
|
|
138
|
+
setOnEvicted(callback: (() => void) | null): void;
|
|
139
|
+
setOnAddRoster(callback: ((added: RosterMember[]) => void) | null): void;
|
|
140
|
+
setOnRemoveRoster(callback: ((removed: string[]) => void) | null): void;
|
|
141
|
+
setOnE2eeVersion(callback: ((version: number) => void) | null): void;
|
|
142
|
+
setOnMissingCommit(callback: ((mlsEpoch: number, useKeyEpoch: number) => void) | null): void;
|
|
143
|
+
setOnLog(callback: ((level: number, message: string) => void) | null): void;
|
|
140
144
|
|
|
141
145
|
completeHttpRequest(
|
|
142
146
|
handlerId: number,
|
|
@@ -8,6 +8,7 @@ import {Enum, HTTP_VERBS} from '../constants';
|
|
|
8
8
|
import {DataSetNames, DATA_SET_INIT_PRIORITY, EMPTY_HASH, LLM_DATASET_NAMES} from './constants';
|
|
9
9
|
import {ObjectType, HtMeta, HashTreeObject} from './types';
|
|
10
10
|
import {LocusDTO, LocusErrorCodes} from '../locus-info/types';
|
|
11
|
+
import type {WebexRequestMethod} from '../common/types';
|
|
11
12
|
import {deleteNestedObjectsWithHtMeta, isMetadata, sleep, sortByInitPriority} from './utils';
|
|
12
13
|
|
|
13
14
|
export enum SyncAllBackoffType {
|
|
@@ -61,7 +62,6 @@ interface InternalDataSet extends DataSet {
|
|
|
61
62
|
syncAbortController?: AbortController;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
type WebexRequestMethod = (options: Record<string, any>) => Promise<any>;
|
|
65
65
|
type GenerateTrackingId = () => string | undefined;
|
|
66
66
|
|
|
67
67
|
export const LocusInfoUpdateType = {
|