@webex/plugin-meetings 3.13.0-next.6 → 3.13.0-next.8
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/config.js +1 -1
- 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/e2ee/mls.js +558 -0
- package/dist/e2ee/mls.js.map +1 -0
- package/dist/e2ee/types.js +59 -0
- package/dist/e2ee/types.js.map +1 -0
- package/dist/e2ee/wasm.d.js +7 -0
- package/dist/e2ee/wasm.d.js.map +1 -0
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/types/e2ee/E2eeSignaling.d.ts +94 -0
- package/dist/types/e2ee/MediaEncryptionService.d.ts +27 -0
- package/dist/types/e2ee/mls.d.ts +191 -0
- package/dist/types/e2ee/types.d.ts +104 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +1 -1
- package/src/e2ee/E2eeSignaling.ts +215 -0
- package/src/e2ee/MediaEncryptionService.ts +41 -0
- package/src/e2ee/mls.ts +548 -0
- package/src/e2ee/types.ts +114 -0
- package/src/e2ee/wasm.d.ts +153 -0
- package/test/unit/spec/e2ee/E2eeSignaling.ts +172 -0
- package/test/unit/spec/e2ee/MediaEncryptionService.ts +43 -0
- package/test/unit/spec/e2ee/mls.ts +769 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type {E2eeIdentityType, E2eeValidationResult} from './types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Raw WebAssembly (WebE2EE) boundary types. These mirror the emscripten-generated MLS engine API
|
|
9
|
+
* exactly (including its snake_case fields); the SDK-facing camelCase shapes live in types.ts.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface Transaction {
|
|
13
|
+
id: string;
|
|
14
|
+
type: 'join' | 'update';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface JoinSuccessResult {
|
|
18
|
+
status: 'join_success';
|
|
19
|
+
epoch: number;
|
|
20
|
+
base_key: Uint8Array;
|
|
21
|
+
index: number;
|
|
22
|
+
index_bits: number;
|
|
23
|
+
sec_code: string;
|
|
24
|
+
sframe_cipher_suite: number;
|
|
25
|
+
sframe_epoch_bits: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UpdateSuccessResult {
|
|
29
|
+
status: 'update_success';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TransactionFailureResult {
|
|
33
|
+
status: 'failure';
|
|
34
|
+
reason:
|
|
35
|
+
| 'timeout'
|
|
36
|
+
| 'join_failure'
|
|
37
|
+
| 'tree_fetch_failure'
|
|
38
|
+
| 'commit_fetch_failure'
|
|
39
|
+
| 'update_override';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type TransactionResult = JoinSuccessResult | UpdateSuccessResult | TransactionFailureResult;
|
|
43
|
+
|
|
44
|
+
export interface HTTPRequest {
|
|
45
|
+
url: string;
|
|
46
|
+
/** A view into WASM memory (`typed_memory_view`); only valid during the callback — copy before async use. */
|
|
47
|
+
body: Uint8Array;
|
|
48
|
+
handlerId: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface EpochInfo {
|
|
52
|
+
epoch: number;
|
|
53
|
+
base_key: Uint8Array;
|
|
54
|
+
index: number;
|
|
55
|
+
index_bits: number;
|
|
56
|
+
sec_code: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface CertificateInfo {
|
|
60
|
+
primary_name: string;
|
|
61
|
+
common_name: string;
|
|
62
|
+
organization_name: string;
|
|
63
|
+
email_addresses: string[];
|
|
64
|
+
domain_names: string[];
|
|
65
|
+
not_before: number;
|
|
66
|
+
not_after: number;
|
|
67
|
+
signature_algorithm: string;
|
|
68
|
+
public_key_algorithm: string;
|
|
69
|
+
identity_type?: E2eeIdentityType;
|
|
70
|
+
der: Uint8Array;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface CertificateResult {
|
|
74
|
+
result: E2eeValidationResult;
|
|
75
|
+
member_certs: CertificateInfo[];
|
|
76
|
+
failed_cert_index?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface RosterMember {
|
|
80
|
+
url: string;
|
|
81
|
+
display_name: string;
|
|
82
|
+
device_type: string;
|
|
83
|
+
validation_result: E2eeValidationResult;
|
|
84
|
+
x509?: CertificateResult[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface WebE2EEInstance {
|
|
88
|
+
initialize(
|
|
89
|
+
participantId: string,
|
|
90
|
+
deviceUrl: string,
|
|
91
|
+
deviceType: string,
|
|
92
|
+
correlationId: string,
|
|
93
|
+
displayName: string,
|
|
94
|
+
serviceUrl: string
|
|
95
|
+
): void;
|
|
96
|
+
|
|
97
|
+
addX509Credential(privateKey: Uint8Array, certChain: Uint8Array[]): void;
|
|
98
|
+
setTrustAnchors(
|
|
99
|
+
webexCaRoots: string,
|
|
100
|
+
domainNameRoots: string,
|
|
101
|
+
userIdentityRoots: string,
|
|
102
|
+
domainNameRootsP7b: Uint8Array
|
|
103
|
+
): void;
|
|
104
|
+
|
|
105
|
+
join(): void;
|
|
106
|
+
leave(): void;
|
|
107
|
+
joined(): boolean;
|
|
108
|
+
securityCode(): string;
|
|
109
|
+
sessionSecret(): Uint8Array | null;
|
|
110
|
+
contentKey(): Uint8Array | null;
|
|
111
|
+
contentKeyId(): string;
|
|
112
|
+
roster(): RosterMember[];
|
|
113
|
+
handle(event: Uint8Array): void;
|
|
114
|
+
isLeader(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Used by backend services such as Homer; client SDKs do not need to call this.
|
|
117
|
+
*/
|
|
118
|
+
keepAlive(): void;
|
|
119
|
+
llmConnected(): void;
|
|
120
|
+
setLlmConnectedBeforeJoin(connected: boolean): void;
|
|
121
|
+
setGzipThreshold(threshold: number): void;
|
|
122
|
+
setCoalesceWindow(milliseconds: number): void;
|
|
123
|
+
setJoinTimeout(milliseconds: number): void;
|
|
124
|
+
setPurgeKeysTimeout(milliseconds: number): void;
|
|
125
|
+
|
|
126
|
+
setOnNewTransaction(callback: (transaction: Transaction) => void): void;
|
|
127
|
+
setOnCompleteTransaction(callback: (id: string, result: TransactionResult) => void): void;
|
|
128
|
+
setOnHttpRequest(callback: (request: HTTPRequest) => void): void;
|
|
129
|
+
setOnWait(callback: (milliseconds: number, handlerId: number) => void): void;
|
|
130
|
+
setOnGotKey(callback: (epoch: EpochInfo) => void): void;
|
|
131
|
+
setOnUseKey(callback: (epoch: number) => void): void;
|
|
132
|
+
setOnLeader(callback: () => void): void;
|
|
133
|
+
setOnPurgeBefore(callback: (epoch: number) => void): void;
|
|
134
|
+
setOnEvicted(callback: () => void): void;
|
|
135
|
+
setOnAddRoster(callback: (added: RosterMember[]) => void): void;
|
|
136
|
+
setOnRemoveRoster(callback: (removed: string[]) => void): void;
|
|
137
|
+
setOnE2eeVersion(callback: (version: number) => void): void;
|
|
138
|
+
setOnMissingCommit(callback: (mlsEpoch: number, useKeyEpoch: number) => void): void;
|
|
139
|
+
setOnLog(callback: (level: number, message: string) => void): void;
|
|
140
|
+
|
|
141
|
+
completeHttpRequest(
|
|
142
|
+
handlerId: number,
|
|
143
|
+
success: boolean,
|
|
144
|
+
body: Uint8Array,
|
|
145
|
+
errorCode: number,
|
|
146
|
+
errorMessage: string
|
|
147
|
+
): void;
|
|
148
|
+
completeWait(handlerId: number): void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface ModuleInstance {
|
|
152
|
+
WebE2EE: new () => WebE2EEInstance;
|
|
153
|
+
}
|
|
@@ -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
|
+
});
|