@webex/internal-plugin-board 2.59.2 → 2.59.3-next.1
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/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/board.js +161 -161
- package/dist/board.js.map +1 -1
- package/dist/config.js +21 -21
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/realtime-channel-collection.js +4 -4
- package/dist/realtime-channel-collection.js.map +1 -1
- package/dist/realtime-channel.js +4 -4
- package/dist/realtime-channel.js.map +1 -1
- package/dist/realtime.js +48 -48
- package/dist/realtime.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +20 -19
- package/process +1 -1
- package/src/board.js +764 -764
- package/src/config.js +44 -44
- package/src/index.js +105 -105
- package/src/realtime-channel-collection.js +18 -18
- package/src/realtime-channel.js +40 -40
- package/src/realtime.js +252 -252
- package/test/integration/spec/board.js +717 -717
- package/test/integration/spec/realtime.js +194 -194
- package/test/integration/spec/sharing-mercury.js +285 -285
- package/test/unit/spec/board.js +635 -635
- package/test/unit/spec/encryption.js +255 -255
- package/test/unit/spec/realtime.js +473 -473
|
@@ -1,255 +1,255 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {assert} from '@webex/test-helper-chai';
|
|
6
|
-
import MockWebex from '@webex/test-helper-mock-webex';
|
|
7
|
-
import sinon from 'sinon';
|
|
8
|
-
import Board, {config as boardConfig} from '@webex/internal-plugin-board';
|
|
9
|
-
|
|
10
|
-
describe('plugin-board', () => {
|
|
11
|
-
let webex;
|
|
12
|
-
const encryptedData = 'encryptedData';
|
|
13
|
-
const decryptedText = 'decryptedText';
|
|
14
|
-
const fakeURL = `${
|
|
15
|
-
process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
|
|
16
|
-
}/encryption/api/v1/keys/8a7d3d78-ce75-48aa-a943-2e8acf63fbc9`;
|
|
17
|
-
|
|
18
|
-
beforeAll(() => {
|
|
19
|
-
webex = new MockWebex({
|
|
20
|
-
children: {
|
|
21
|
-
board: Board,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
Object.assign(webex.internal, {
|
|
26
|
-
device: {
|
|
27
|
-
deviceType: 'FAKE_DEVICE',
|
|
28
|
-
},
|
|
29
|
-
encryption: {
|
|
30
|
-
decryptText: sinon.stub().returns(Promise.resolve(decryptedText)),
|
|
31
|
-
encryptText: sinon.stub().returns(Promise.resolve(encryptedData)),
|
|
32
|
-
encryptBinary: sinon.stub().returns(
|
|
33
|
-
Promise.resolve({
|
|
34
|
-
scr: {},
|
|
35
|
-
cdata: encryptedData,
|
|
36
|
-
})
|
|
37
|
-
),
|
|
38
|
-
decryptScr: sinon.stub().returns(Promise.resolve('decryptedFoo')),
|
|
39
|
-
encryptScr: sinon.stub().returns(Promise.resolve('encryptedFoo')),
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
webex.config.board = boardConfig.board;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('encryption', () => {
|
|
47
|
-
describe('#decryptContents', () => {
|
|
48
|
-
beforeAll(() => {
|
|
49
|
-
sinon.stub(webex.internal.board, 'decryptSingleContent').callsFake(sinon.stub().returns(Promise.resolve({})));
|
|
50
|
-
sinon.spy(webex.internal.board, 'decryptSingleFileContent');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
afterAll(() => {
|
|
54
|
-
webex.internal.board.decryptSingleContent.restore();
|
|
55
|
-
webex.internal.board.decryptSingleFileContent.restore();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
afterEach(() => {
|
|
59
|
-
webex.internal.board.decryptSingleFileContent.resetHistory();
|
|
60
|
-
webex.internal.board.decryptSingleContent.resetHistory();
|
|
61
|
-
webex.internal.encryption.decryptScr.resetHistory();
|
|
62
|
-
webex.internal.encryption.decryptText.resetHistory();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('calls decryptSingleContent when type is not image', () => {
|
|
66
|
-
const curveContents = {
|
|
67
|
-
items: [
|
|
68
|
-
{
|
|
69
|
-
type: 'STRING',
|
|
70
|
-
payload: encryptedData,
|
|
71
|
-
encryptionKeyUrl: fakeURL,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return webex.internal.board.decryptContents(curveContents).then(() => {
|
|
77
|
-
assert.calledWith(webex.internal.board.decryptSingleContent, fakeURL, encryptedData);
|
|
78
|
-
assert.notCalled(webex.internal.encryption.decryptScr);
|
|
79
|
-
assert.notCalled(webex.internal.encryption.decryptText);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('calls decryptSingleFileContent when type is FILE', () => {
|
|
84
|
-
const imageContents = {
|
|
85
|
-
items: [
|
|
86
|
-
{
|
|
87
|
-
type: 'FILE',
|
|
88
|
-
payload: JSON.stringify({
|
|
89
|
-
type: 'image',
|
|
90
|
-
displayName: 'encryptedDisplayName',
|
|
91
|
-
}),
|
|
92
|
-
file: {
|
|
93
|
-
scr: 'encryptedScr',
|
|
94
|
-
},
|
|
95
|
-
encryptionKeyUrl: fakeURL,
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return webex.internal.board.decryptContents(imageContents).then(() => {
|
|
101
|
-
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
102
|
-
assert.calledWith(
|
|
103
|
-
webex.internal.encryption.decryptText,
|
|
104
|
-
fakeURL,
|
|
105
|
-
JSON.stringify({type: 'image', displayName: 'encryptedDisplayName'})
|
|
106
|
-
);
|
|
107
|
-
assert.calledWith(webex.internal.encryption.decryptScr, fakeURL, 'encryptedScr');
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('does not require payload when type is FILE', () => {
|
|
112
|
-
const imageContents = {
|
|
113
|
-
items: [
|
|
114
|
-
{
|
|
115
|
-
type: 'FILE',
|
|
116
|
-
file: {
|
|
117
|
-
scr: 'encryptedScr',
|
|
118
|
-
},
|
|
119
|
-
encryptionKeyUrl: fakeURL,
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
return webex.internal.board.decryptContents(imageContents).then(() => {
|
|
125
|
-
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
126
|
-
assert.notCalled(webex.internal.encryption.decryptText);
|
|
127
|
-
assert.calledWith(webex.internal.encryption.decryptScr, fakeURL, 'encryptedScr');
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('decrypts FILE metadata displayName', () => {
|
|
132
|
-
const imageContentsWithMetadata = {
|
|
133
|
-
items: [
|
|
134
|
-
{
|
|
135
|
-
type: 'FILE',
|
|
136
|
-
payload: JSON.stringify({
|
|
137
|
-
type: 'image',
|
|
138
|
-
displayName: 'encryptedDisplayName',
|
|
139
|
-
}),
|
|
140
|
-
file: {
|
|
141
|
-
scr: 'encryptedScr',
|
|
142
|
-
},
|
|
143
|
-
encryptionKeyUrl: fakeURL,
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
webex.internal.encryption.decryptText
|
|
149
|
-
.onFirstCall()
|
|
150
|
-
.returns(JSON.stringify({displayName: 'decryptedDisplayName'}));
|
|
151
|
-
|
|
152
|
-
return webex.internal.board.decryptContents(imageContentsWithMetadata).then((contents) => {
|
|
153
|
-
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
154
|
-
assert.calledWith(webex.internal.encryption.decryptScr, fakeURL, 'encryptedScr');
|
|
155
|
-
assert.calledWith(
|
|
156
|
-
webex.internal.encryption.decryptText,
|
|
157
|
-
fakeURL,
|
|
158
|
-
JSON.stringify({type: 'image', displayName: 'encryptedDisplayName'})
|
|
159
|
-
);
|
|
160
|
-
assert.equal(contents[0].metadata.displayName, 'decryptedDisplayName');
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('assigns FILE payload metadata to decrypted file', () => {
|
|
165
|
-
const imageContentsWithMetadata = {
|
|
166
|
-
items: [
|
|
167
|
-
{
|
|
168
|
-
type: 'FILE',
|
|
169
|
-
payload: JSON.stringify({
|
|
170
|
-
type: 'image',
|
|
171
|
-
size: 123,
|
|
172
|
-
}),
|
|
173
|
-
file: {
|
|
174
|
-
scr: 'encryptedScr',
|
|
175
|
-
},
|
|
176
|
-
encryptionKeyUrl: fakeURL,
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
webex.internal.encryption.decryptText
|
|
182
|
-
.onFirstCall()
|
|
183
|
-
.returns(JSON.stringify({type: 'image', size: 123}));
|
|
184
|
-
|
|
185
|
-
return webex.internal.board.decryptContents(imageContentsWithMetadata).then((contents) => {
|
|
186
|
-
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
187
|
-
assert.deepEqual(contents[0].metadata, {
|
|
188
|
-
type: 'image',
|
|
189
|
-
size: 123,
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
describe('#encryptContents', () => {
|
|
196
|
-
beforeAll(() => {
|
|
197
|
-
sinon.stub(webex.internal.board, 'encryptSingleContent').returns(Promise.resolve({
|
|
198
|
-
encryptedData,
|
|
199
|
-
encryptionKeyUrl: fakeURL
|
|
200
|
-
}));
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
afterEach(() => {
|
|
204
|
-
webex.internal.board.encryptSingleContent.resetHistory();
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('calls encryptSingleContent when type is not image', () => {
|
|
208
|
-
const curveContents = [
|
|
209
|
-
{
|
|
210
|
-
type: 'curve',
|
|
211
|
-
},
|
|
212
|
-
];
|
|
213
|
-
|
|
214
|
-
return webex.internal.board.encryptContents(fakeURL, curveContents).then(() => {
|
|
215
|
-
assert.calledWith(webex.internal.board.encryptSingleContent, fakeURL, curveContents[0]);
|
|
216
|
-
assert.notCalled(webex.internal.encryption.encryptScr);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it('calls encryptText and encryptScr when scr is found in content', () => {
|
|
221
|
-
const imageContents = [
|
|
222
|
-
{
|
|
223
|
-
displayName: 'FileName',
|
|
224
|
-
file: {
|
|
225
|
-
scr: {
|
|
226
|
-
loc: fakeURL,
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
];
|
|
231
|
-
|
|
232
|
-
return webex.internal.board.encryptContents(fakeURL, imageContents).then(() => {
|
|
233
|
-
assert.calledWith(webex.internal.encryption.encryptScr, fakeURL, {loc: fakeURL});
|
|
234
|
-
assert.calledWith(
|
|
235
|
-
webex.internal.encryption.encryptText,
|
|
236
|
-
fakeURL,
|
|
237
|
-
JSON.stringify({displayName: 'FileName'})
|
|
238
|
-
);
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it('sets the device to config deviceType', () => {
|
|
243
|
-
const curveContents = [
|
|
244
|
-
{
|
|
245
|
-
type: 'curve',
|
|
246
|
-
},
|
|
247
|
-
];
|
|
248
|
-
|
|
249
|
-
return webex.internal.board.encryptContents(fakeURL, curveContents).then((res) => {
|
|
250
|
-
assert.equal(res[0].device, 'FAKE_DEVICE');
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import MockWebex from '@webex/test-helper-mock-webex';
|
|
7
|
+
import sinon from 'sinon';
|
|
8
|
+
import Board, {config as boardConfig} from '@webex/internal-plugin-board';
|
|
9
|
+
|
|
10
|
+
describe('plugin-board', () => {
|
|
11
|
+
let webex;
|
|
12
|
+
const encryptedData = 'encryptedData';
|
|
13
|
+
const decryptedText = 'decryptedText';
|
|
14
|
+
const fakeURL = `${
|
|
15
|
+
process.env.ENCRYPTION_SERVICE_URL || 'https://encryption-a.wbx2.com'
|
|
16
|
+
}/encryption/api/v1/keys/8a7d3d78-ce75-48aa-a943-2e8acf63fbc9`;
|
|
17
|
+
|
|
18
|
+
beforeAll(() => {
|
|
19
|
+
webex = new MockWebex({
|
|
20
|
+
children: {
|
|
21
|
+
board: Board,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
Object.assign(webex.internal, {
|
|
26
|
+
device: {
|
|
27
|
+
deviceType: 'FAKE_DEVICE',
|
|
28
|
+
},
|
|
29
|
+
encryption: {
|
|
30
|
+
decryptText: sinon.stub().returns(Promise.resolve(decryptedText)),
|
|
31
|
+
encryptText: sinon.stub().returns(Promise.resolve(encryptedData)),
|
|
32
|
+
encryptBinary: sinon.stub().returns(
|
|
33
|
+
Promise.resolve({
|
|
34
|
+
scr: {},
|
|
35
|
+
cdata: encryptedData,
|
|
36
|
+
})
|
|
37
|
+
),
|
|
38
|
+
decryptScr: sinon.stub().returns(Promise.resolve('decryptedFoo')),
|
|
39
|
+
encryptScr: sinon.stub().returns(Promise.resolve('encryptedFoo')),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
webex.config.board = boardConfig.board;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('encryption', () => {
|
|
47
|
+
describe('#decryptContents', () => {
|
|
48
|
+
beforeAll(() => {
|
|
49
|
+
sinon.stub(webex.internal.board, 'decryptSingleContent').callsFake(sinon.stub().returns(Promise.resolve({})));
|
|
50
|
+
sinon.spy(webex.internal.board, 'decryptSingleFileContent');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
afterAll(() => {
|
|
54
|
+
webex.internal.board.decryptSingleContent.restore();
|
|
55
|
+
webex.internal.board.decryptSingleFileContent.restore();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
afterEach(() => {
|
|
59
|
+
webex.internal.board.decryptSingleFileContent.resetHistory();
|
|
60
|
+
webex.internal.board.decryptSingleContent.resetHistory();
|
|
61
|
+
webex.internal.encryption.decryptScr.resetHistory();
|
|
62
|
+
webex.internal.encryption.decryptText.resetHistory();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('calls decryptSingleContent when type is not image', () => {
|
|
66
|
+
const curveContents = {
|
|
67
|
+
items: [
|
|
68
|
+
{
|
|
69
|
+
type: 'STRING',
|
|
70
|
+
payload: encryptedData,
|
|
71
|
+
encryptionKeyUrl: fakeURL,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return webex.internal.board.decryptContents(curveContents).then(() => {
|
|
77
|
+
assert.calledWith(webex.internal.board.decryptSingleContent, fakeURL, encryptedData);
|
|
78
|
+
assert.notCalled(webex.internal.encryption.decryptScr);
|
|
79
|
+
assert.notCalled(webex.internal.encryption.decryptText);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('calls decryptSingleFileContent when type is FILE', () => {
|
|
84
|
+
const imageContents = {
|
|
85
|
+
items: [
|
|
86
|
+
{
|
|
87
|
+
type: 'FILE',
|
|
88
|
+
payload: JSON.stringify({
|
|
89
|
+
type: 'image',
|
|
90
|
+
displayName: 'encryptedDisplayName',
|
|
91
|
+
}),
|
|
92
|
+
file: {
|
|
93
|
+
scr: 'encryptedScr',
|
|
94
|
+
},
|
|
95
|
+
encryptionKeyUrl: fakeURL,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return webex.internal.board.decryptContents(imageContents).then(() => {
|
|
101
|
+
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
102
|
+
assert.calledWith(
|
|
103
|
+
webex.internal.encryption.decryptText,
|
|
104
|
+
fakeURL,
|
|
105
|
+
JSON.stringify({type: 'image', displayName: 'encryptedDisplayName'})
|
|
106
|
+
);
|
|
107
|
+
assert.calledWith(webex.internal.encryption.decryptScr, fakeURL, 'encryptedScr');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('does not require payload when type is FILE', () => {
|
|
112
|
+
const imageContents = {
|
|
113
|
+
items: [
|
|
114
|
+
{
|
|
115
|
+
type: 'FILE',
|
|
116
|
+
file: {
|
|
117
|
+
scr: 'encryptedScr',
|
|
118
|
+
},
|
|
119
|
+
encryptionKeyUrl: fakeURL,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return webex.internal.board.decryptContents(imageContents).then(() => {
|
|
125
|
+
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
126
|
+
assert.notCalled(webex.internal.encryption.decryptText);
|
|
127
|
+
assert.calledWith(webex.internal.encryption.decryptScr, fakeURL, 'encryptedScr');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('decrypts FILE metadata displayName', () => {
|
|
132
|
+
const imageContentsWithMetadata = {
|
|
133
|
+
items: [
|
|
134
|
+
{
|
|
135
|
+
type: 'FILE',
|
|
136
|
+
payload: JSON.stringify({
|
|
137
|
+
type: 'image',
|
|
138
|
+
displayName: 'encryptedDisplayName',
|
|
139
|
+
}),
|
|
140
|
+
file: {
|
|
141
|
+
scr: 'encryptedScr',
|
|
142
|
+
},
|
|
143
|
+
encryptionKeyUrl: fakeURL,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
webex.internal.encryption.decryptText
|
|
149
|
+
.onFirstCall()
|
|
150
|
+
.returns(JSON.stringify({displayName: 'decryptedDisplayName'}));
|
|
151
|
+
|
|
152
|
+
return webex.internal.board.decryptContents(imageContentsWithMetadata).then((contents) => {
|
|
153
|
+
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
154
|
+
assert.calledWith(webex.internal.encryption.decryptScr, fakeURL, 'encryptedScr');
|
|
155
|
+
assert.calledWith(
|
|
156
|
+
webex.internal.encryption.decryptText,
|
|
157
|
+
fakeURL,
|
|
158
|
+
JSON.stringify({type: 'image', displayName: 'encryptedDisplayName'})
|
|
159
|
+
);
|
|
160
|
+
assert.equal(contents[0].metadata.displayName, 'decryptedDisplayName');
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('assigns FILE payload metadata to decrypted file', () => {
|
|
165
|
+
const imageContentsWithMetadata = {
|
|
166
|
+
items: [
|
|
167
|
+
{
|
|
168
|
+
type: 'FILE',
|
|
169
|
+
payload: JSON.stringify({
|
|
170
|
+
type: 'image',
|
|
171
|
+
size: 123,
|
|
172
|
+
}),
|
|
173
|
+
file: {
|
|
174
|
+
scr: 'encryptedScr',
|
|
175
|
+
},
|
|
176
|
+
encryptionKeyUrl: fakeURL,
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
webex.internal.encryption.decryptText
|
|
182
|
+
.onFirstCall()
|
|
183
|
+
.returns(JSON.stringify({type: 'image', size: 123}));
|
|
184
|
+
|
|
185
|
+
return webex.internal.board.decryptContents(imageContentsWithMetadata).then((contents) => {
|
|
186
|
+
assert.calledOnce(webex.internal.board.decryptSingleFileContent);
|
|
187
|
+
assert.deepEqual(contents[0].metadata, {
|
|
188
|
+
type: 'image',
|
|
189
|
+
size: 123,
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
describe('#encryptContents', () => {
|
|
196
|
+
beforeAll(() => {
|
|
197
|
+
sinon.stub(webex.internal.board, 'encryptSingleContent').returns(Promise.resolve({
|
|
198
|
+
encryptedData,
|
|
199
|
+
encryptionKeyUrl: fakeURL
|
|
200
|
+
}));
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
afterEach(() => {
|
|
204
|
+
webex.internal.board.encryptSingleContent.resetHistory();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('calls encryptSingleContent when type is not image', () => {
|
|
208
|
+
const curveContents = [
|
|
209
|
+
{
|
|
210
|
+
type: 'curve',
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
return webex.internal.board.encryptContents(fakeURL, curveContents).then(() => {
|
|
215
|
+
assert.calledWith(webex.internal.board.encryptSingleContent, fakeURL, curveContents[0]);
|
|
216
|
+
assert.notCalled(webex.internal.encryption.encryptScr);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('calls encryptText and encryptScr when scr is found in content', () => {
|
|
221
|
+
const imageContents = [
|
|
222
|
+
{
|
|
223
|
+
displayName: 'FileName',
|
|
224
|
+
file: {
|
|
225
|
+
scr: {
|
|
226
|
+
loc: fakeURL,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
];
|
|
231
|
+
|
|
232
|
+
return webex.internal.board.encryptContents(fakeURL, imageContents).then(() => {
|
|
233
|
+
assert.calledWith(webex.internal.encryption.encryptScr, fakeURL, {loc: fakeURL});
|
|
234
|
+
assert.calledWith(
|
|
235
|
+
webex.internal.encryption.encryptText,
|
|
236
|
+
fakeURL,
|
|
237
|
+
JSON.stringify({displayName: 'FileName'})
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('sets the device to config deviceType', () => {
|
|
243
|
+
const curveContents = [
|
|
244
|
+
{
|
|
245
|
+
type: 'curve',
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
return webex.internal.board.encryptContents(fakeURL, curveContents).then((res) => {
|
|
250
|
+
assert.equal(res[0].device, 'FAKE_DEVICE');
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
});
|