@webex/internal-plugin-conversation 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 +47 -47
- package/babel.config.js +3 -3
- package/dist/activities.js +4 -4
- package/dist/activities.js.map +1 -1
- package/dist/activity-thread-ordering.js +34 -34
- package/dist/activity-thread-ordering.js.map +1 -1
- package/dist/config.js +12 -12
- package/dist/config.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/conversation.js +474 -474
- package/dist/conversation.js.map +1 -1
- package/dist/convo-error.js +4 -4
- package/dist/convo-error.js.map +1 -1
- package/dist/decryption-transforms.js +155 -155
- package/dist/decryption-transforms.js.map +1 -1
- package/dist/encryption-transforms.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/share-activity.js +57 -57
- package/dist/share-activity.js.map +1 -1
- package/dist/to-array.js +7 -7
- package/dist/to-array.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +21 -20
- package/process +1 -1
- package/src/activities.js +157 -157
- package/src/activity-thread-ordering.js +283 -283
- package/src/activity-threading.md +282 -282
- package/src/config.js +37 -37
- package/src/constants.js +3 -3
- package/src/conversation.js +2535 -2535
- package/src/convo-error.js +15 -15
- package/src/decryption-transforms.js +541 -541
- package/src/encryption-transforms.js +345 -345
- package/src/index.js +327 -327
- package/src/share-activity.js +436 -436
- package/src/to-array.js +29 -29
- package/test/integration/spec/create.js +290 -290
- package/test/integration/spec/encryption.js +333 -333
- package/test/integration/spec/get.js +1255 -1255
- package/test/integration/spec/mercury.js +94 -94
- package/test/integration/spec/share.js +537 -537
- package/test/integration/spec/verbs.js +1041 -1041
- package/test/unit/spec/conversation.js +823 -823
- package/test/unit/spec/decrypt-transforms.js +460 -460
- package/test/unit/spec/encryption-transforms.js +93 -93
- package/test/unit/spec/share-activity.js +178 -178
|
@@ -1,460 +1,460 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import sinon from 'sinon';
|
|
6
|
-
import {assert, expect} from '@webex/test-helper-chai';
|
|
7
|
-
import {transforms} from '@webex/internal-plugin-conversation/src/decryption-transforms';
|
|
8
|
-
|
|
9
|
-
describe('plugin-conversation', () => {
|
|
10
|
-
describe('decryption transforms', () => {
|
|
11
|
-
describe('decryptObject()', () => {
|
|
12
|
-
it('calls the correct method if a recording microappInstance is passed to it', () => {
|
|
13
|
-
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
14
|
-
const transformStub = sinon.stub();
|
|
15
|
-
|
|
16
|
-
const ctx = {
|
|
17
|
-
transform: transformStub,
|
|
18
|
-
};
|
|
19
|
-
const key = null;
|
|
20
|
-
const activity = {
|
|
21
|
-
objectType: 'microappInstance',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
transform.fn(ctx, key, activity);
|
|
25
|
-
|
|
26
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptMicroappinstance');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe('decryptComment()', () => {
|
|
31
|
-
it('calls the correct method if an array prop is passed to it', () => {
|
|
32
|
-
const transform = transforms.find((t) => t.name === 'decryptComment');
|
|
33
|
-
const transformStub = sinon.stub();
|
|
34
|
-
|
|
35
|
-
const ctx = {
|
|
36
|
-
transform: transformStub,
|
|
37
|
-
};
|
|
38
|
-
const key = null;
|
|
39
|
-
const activity = {
|
|
40
|
-
objectType: 'comment',
|
|
41
|
-
cards: [
|
|
42
|
-
'eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..QQeWYBBB8H7MCnWm.6C-feMX3zp70t4VZNNrsFQRMpWSpByJFYXPOfTUeTXi6SNXvw0s2jVfHbLSBCyiOJCQxMtzNAbnWsqL0LC3HdEWbLee2DYVMLHLpLTleUKErgoIy3xvO6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CRgrXqnsuQmtkE__gWoNMVtdI-dwVIrjt3cVEUoITHXWq8cQAyxcSQVYZXrtK413JLxZXhCptFscAWom95RKJmF3yO40m2narRkXqXXpbYHJwrBF2zz_eZqTDudVtKuRALfZHdG7KN0_qRSdOCxLMi8AcHZAEIuCRdOjXLuVLB8dJ3E0dXFRk5we8nQJ_oQwgKpMKDfMj5-eWau8VzOZxZNzKf-QVqtXnBxt_2cMv1rzgwZ3c8zjbUrTbamkCOQvsxgogBe36ySbsY1R1wQUfXSeJOgkLqbteDlrMthf5QEstJGm3BYJHFBFEYW-nSzEbiea0CEMNwWzOjAUvetdg5lKBXwT_dIiVa_ZRxofe6-v7fbXiZ15TE73GYlldtyYcY9js32rKHCN47BoBKYATM-njnymmN8Vts0znsRM53WAHr-27tJYQC46YMyPCJoajIFYmlcX8og9hRhvgR_WUWt1QcTyG1DUCpUiferYYC5j5ifU9Gv35JIFpCfOFti-H4eSyPY8N_EIC3Yf-dbCPK9qSJUu0Sfo7PzCybcC3HgbucQI8k3rK_l_9758hYoZR2fZh3gMlOSmNqVhO0a7-YwSv_bxpKvHOIyiIlAVFIsrGLvdal4tJbLq8kGwyYS8X60qK_l-8G4uJ8F7LBkUO6zn-6kxTi10woXqwPGyo5MBYyMKH7HGG67jKRuADJRqSis8RHolHt7LEhlimh6fIqPxBKmorq__TF4IYTGKgnyl41NM_r_XjC6QSLMgTBszXYPDI6CnUZrAl5GI09WCEOC4bKp98I2Qa3ssS2AlBIwwP6Z7oRsUg0om2FUr9kW4HSsv0kNMTbGa7fqlgbCRn1bGttU7W8EVwmBlCJw9v5RklkHbj9qpaNA4iyTCRxfHWyjIQkOA6jUfOaNIRZLHywaUEG-1yZ4bNFdTLjEQ_gvzQgg.jM6UaCTq9P_i4tKbkxrLrg',
|
|
43
|
-
],
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
transform.fn(ctx, key, activity);
|
|
47
|
-
expect(transformStub.lastCall.args[0]).to.equal('decryptPropCardItem');
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe('decryptMicroappinstance()', () => {
|
|
52
|
-
it('decrypts the model prop inside of decryptMicroappinstance()', () => {
|
|
53
|
-
const transform = transforms.find((t) => t.name === 'decryptMicroappinstance');
|
|
54
|
-
const transformStub = sinon.stub();
|
|
55
|
-
|
|
56
|
-
const ctx = {
|
|
57
|
-
transform: transformStub,
|
|
58
|
-
};
|
|
59
|
-
const key = null;
|
|
60
|
-
const microappInstance = {
|
|
61
|
-
model: 'Longencryptedstring',
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
transform.fn(ctx, key, microappInstance);
|
|
65
|
-
|
|
66
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptPropModel');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('previous', () => {
|
|
71
|
-
it('calls the correct method if a previous object is passed in', () => {
|
|
72
|
-
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
73
|
-
const transformStub = sinon.stub();
|
|
74
|
-
|
|
75
|
-
const ctx = {
|
|
76
|
-
transform: transformStub,
|
|
77
|
-
};
|
|
78
|
-
const key = null;
|
|
79
|
-
const activity = {
|
|
80
|
-
objectType: 'conversation',
|
|
81
|
-
previous: {},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
transform.fn(ctx, key, activity);
|
|
85
|
-
|
|
86
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptConversation');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('decrypts the activity object with a previous conversation', () => {
|
|
90
|
-
const transform = transforms.find((t) => t.name === 'decryptActivity');
|
|
91
|
-
const transformStub = sinon.spy();
|
|
92
|
-
|
|
93
|
-
const ctx = {
|
|
94
|
-
transform: transformStub,
|
|
95
|
-
};
|
|
96
|
-
const key = null;
|
|
97
|
-
const activity = {
|
|
98
|
-
objectType: 'activity',
|
|
99
|
-
verb: 'update',
|
|
100
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
101
|
-
object: {
|
|
102
|
-
objectType: 'conversation',
|
|
103
|
-
previous: {
|
|
104
|
-
displayName: 'test123',
|
|
105
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
111
|
-
assert.equal(transformStub.callCount, 1);
|
|
112
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('decrypts the activity object with a previousValue in the conversation', () => {
|
|
117
|
-
const transform = transforms.find((t) => t.name === 'decryptActivity');
|
|
118
|
-
const transformStub = sinon.spy();
|
|
119
|
-
|
|
120
|
-
const ctx = {
|
|
121
|
-
transform: transformStub,
|
|
122
|
-
};
|
|
123
|
-
const key = null;
|
|
124
|
-
const activity = {
|
|
125
|
-
objectType: 'activity',
|
|
126
|
-
verb: 'update',
|
|
127
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
128
|
-
object: {
|
|
129
|
-
objectType: 'conversation',
|
|
130
|
-
previousValue: {
|
|
131
|
-
displayName: 'test123',
|
|
132
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
138
|
-
assert.equal(transformStub.callCount, 1);
|
|
139
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
describe('threads', () => {
|
|
145
|
-
it('decrypts childActivities if a thread object is passed in', () => {
|
|
146
|
-
const transform = transforms.find((t) => t.name === 'decryptThread');
|
|
147
|
-
const transformStub = sinon.stub();
|
|
148
|
-
|
|
149
|
-
const ctx = {
|
|
150
|
-
transform: transformStub,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const threadObject = {
|
|
154
|
-
childType: 'reply',
|
|
155
|
-
actorId: '123',
|
|
156
|
-
childActivities: [
|
|
157
|
-
{
|
|
158
|
-
objectType: 'activity',
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
transform.fn(ctx, threadObject);
|
|
164
|
-
|
|
165
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptObject');
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
describe('reactions', () => {
|
|
170
|
-
it('calls the correct method if a reaction2Summary object is passed in', () => {
|
|
171
|
-
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
172
|
-
const transformStub = sinon.stub();
|
|
173
|
-
|
|
174
|
-
const ctx = {
|
|
175
|
-
transform: transformStub,
|
|
176
|
-
};
|
|
177
|
-
const key = null;
|
|
178
|
-
const activity = {
|
|
179
|
-
objectType: 'reaction2Summary',
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
transform.fn(ctx, key, activity);
|
|
183
|
-
|
|
184
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptReaction2summary');
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('decrypts the activity object and its children and its reactions', () => {
|
|
188
|
-
const transform = transforms.find((t) => t.name === 'decryptActivity');
|
|
189
|
-
const transformStub = sinon.spy();
|
|
190
|
-
|
|
191
|
-
const ctx = {
|
|
192
|
-
transform: transformStub,
|
|
193
|
-
};
|
|
194
|
-
const key = null;
|
|
195
|
-
const activity = {
|
|
196
|
-
objectType: 'activity',
|
|
197
|
-
verb: 'post',
|
|
198
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
199
|
-
object: {
|
|
200
|
-
objectType: 'comment',
|
|
201
|
-
},
|
|
202
|
-
children: [
|
|
203
|
-
{
|
|
204
|
-
verb: 'add',
|
|
205
|
-
objectType: 'activity',
|
|
206
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
207
|
-
object: {
|
|
208
|
-
objectType: 'reaction2Summary',
|
|
209
|
-
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
verb: 'add',
|
|
214
|
-
objectType: 'activity',
|
|
215
|
-
encryptionKeyUrl: 'keyUrl1',
|
|
216
|
-
object: {
|
|
217
|
-
objectType: 'reaction2Summary',
|
|
218
|
-
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
225
|
-
assert.equal(transformStub.callCount, 3); // once for the parents object and then once for each child
|
|
226
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
227
|
-
assert.equal(transformStub.getCall(1).args[0], 'decryptObject');
|
|
228
|
-
assert.equal(transformStub.getCall(2).args[0], 'decryptObject');
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it('decrypts the reaction2Summary object and the reactions', () => {
|
|
233
|
-
const transform = transforms.find((t) => t.name === 'decryptReaction2summary');
|
|
234
|
-
const transformStub = sinon.spy();
|
|
235
|
-
|
|
236
|
-
const ctx = {
|
|
237
|
-
transform: transformStub,
|
|
238
|
-
};
|
|
239
|
-
const key = null;
|
|
240
|
-
const activity = {
|
|
241
|
-
objectType: 'reaction2Summary',
|
|
242
|
-
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
246
|
-
assert.equal(transformStub.callCount, 2);
|
|
247
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
248
|
-
assert.equal(transformStub.getCall(1).args[0], 'decryptPropDisplayName');
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
it('calls the correct method if a reaction2SelfSummary object is passed in', () => {
|
|
253
|
-
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
254
|
-
const transformStub = sinon.stub();
|
|
255
|
-
|
|
256
|
-
const ctx = {
|
|
257
|
-
transform: transformStub,
|
|
258
|
-
};
|
|
259
|
-
const key = null;
|
|
260
|
-
const activity = {
|
|
261
|
-
objectType: 'reaction2SelfSummary',
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
transform.fn(ctx, key, activity);
|
|
265
|
-
|
|
266
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptReaction2selfsummary');
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('calls the correct method if a reaction2 object is passed in', () => {
|
|
270
|
-
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
271
|
-
const transformStub = sinon.stub();
|
|
272
|
-
|
|
273
|
-
const ctx = {
|
|
274
|
-
transform: transformStub,
|
|
275
|
-
};
|
|
276
|
-
const key = null;
|
|
277
|
-
const activity = {
|
|
278
|
-
objectType: 'reaction2',
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
transform.fn(ctx, key, activity);
|
|
282
|
-
|
|
283
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptReaction2');
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
describe('link activity', () => {
|
|
288
|
-
it('calls the correct method if a content object is passed in', () => {
|
|
289
|
-
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
290
|
-
const transformStub = sinon.stub();
|
|
291
|
-
|
|
292
|
-
const ctx = {
|
|
293
|
-
transform: transformStub,
|
|
294
|
-
};
|
|
295
|
-
const key = null;
|
|
296
|
-
const activity = {
|
|
297
|
-
objectType: 'content',
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
transform.fn(ctx, key, activity);
|
|
301
|
-
|
|
302
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptContent');
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
it('calls the correct method if a link content category is passed in', () => {
|
|
306
|
-
const transform = transforms.find((t) => t.name === 'decryptContent');
|
|
307
|
-
const transformStub = sinon.stub();
|
|
308
|
-
|
|
309
|
-
const ctx = {
|
|
310
|
-
transform: transformStub,
|
|
311
|
-
};
|
|
312
|
-
const key = null;
|
|
313
|
-
const activity = {
|
|
314
|
-
objectType: 'content',
|
|
315
|
-
contentCategory: 'links',
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
transform.fn(ctx, key, activity);
|
|
319
|
-
|
|
320
|
-
assert.equal(transformStub.lastCall.args[0], 'decryptContentLinks');
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it('decrypts the link and the comment', () => {
|
|
324
|
-
const transform = transforms.find((t) => t.name === 'decryptContentLinks');
|
|
325
|
-
const transformStub = sinon.spy();
|
|
326
|
-
|
|
327
|
-
const ctx = {
|
|
328
|
-
transform: transformStub,
|
|
329
|
-
};
|
|
330
|
-
const key = null;
|
|
331
|
-
const activity = {
|
|
332
|
-
objectType: 'content',
|
|
333
|
-
contentCategory: 'links',
|
|
334
|
-
links: {
|
|
335
|
-
items: [{item1: 'item1'}],
|
|
336
|
-
},
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
340
|
-
assert.equal(transformStub.callCount, 2);
|
|
341
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
342
|
-
assert.equal(transformStub.getCall(1).args[0], 'decryptComment');
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
it('decrypts a link object', () => {
|
|
347
|
-
const transform = transforms.find((t) => t.name === 'decryptLink');
|
|
348
|
-
const transformStub = sinon.spy();
|
|
349
|
-
|
|
350
|
-
const ctx = {
|
|
351
|
-
transform: transformStub,
|
|
352
|
-
};
|
|
353
|
-
const key = null;
|
|
354
|
-
const activity = {
|
|
355
|
-
objectType: 'content',
|
|
356
|
-
contentCategory: 'links',
|
|
357
|
-
links: {
|
|
358
|
-
items: [{item1: 'item1'}],
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
363
|
-
assert.equal(transformStub.callCount, 2);
|
|
364
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptPropSslr');
|
|
365
|
-
assert.equal(transformStub.getCall(1).args[0], 'decryptPropDisplayName');
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
it('decrypts an sslr', () => {
|
|
370
|
-
const transform = transforms.find((t) => t.name === 'decryptPropSslr');
|
|
371
|
-
|
|
372
|
-
const ORIG_SSLR = 'ORIG_SSLR';
|
|
373
|
-
const DECRYPTED_SSLR = 'DECRYPTED_SSLR';
|
|
374
|
-
const transformStub = sinon.spy(() => Promise.resolve(DECRYPTED_SSLR));
|
|
375
|
-
|
|
376
|
-
const ctx = {
|
|
377
|
-
webex: {
|
|
378
|
-
internal: {
|
|
379
|
-
encryption: {
|
|
380
|
-
decryptScr: transformStub,
|
|
381
|
-
},
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
};
|
|
385
|
-
const key = null;
|
|
386
|
-
const activity = {
|
|
387
|
-
objectType: 'content',
|
|
388
|
-
contentCategory: 'links',
|
|
389
|
-
links: {
|
|
390
|
-
items: [{item1: 'item1'}],
|
|
391
|
-
},
|
|
392
|
-
sslr: ORIG_SSLR,
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
return transform.fn(ctx, key, activity).then(() => {
|
|
396
|
-
assert.equal(transformStub.callCount, 1);
|
|
397
|
-
assert.equal(transformStub.getCall(0).args[1], ORIG_SSLR);
|
|
398
|
-
assert.equal(activity.sslr, DECRYPTED_SSLR);
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
describe('meeting containers', () => {
|
|
403
|
-
it('decrypts a meeting container activity with only display name', () => {
|
|
404
|
-
const transform = transforms.find((t) => t.name === 'decryptMeetingcontainer');
|
|
405
|
-
const transformStub = sinon.spy();
|
|
406
|
-
const ctx = {
|
|
407
|
-
transform: transformStub,
|
|
408
|
-
};
|
|
409
|
-
const key = null;
|
|
410
|
-
const meetingContainer = {
|
|
411
|
-
id: 'd5416be0-aeb9-11ec-bac4-ad7fbcfb8ba2',
|
|
412
|
-
objectType: 'meetingContainer',
|
|
413
|
-
displayName:
|
|
414
|
-
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvYjhjOTg1MTYtNmY0OS00Zjk2LThhMmEtZGIxOTc2ZTAwYTk5IiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..H-Ef6wjRGeolqSTJ.xZUwyy5VnKPGdsWDCg0T1A.3Vrx_z7Z0Z2NlnNr3vf43A',
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
return transform.fn(ctx, key, meetingContainer).then(() => {
|
|
418
|
-
assert.equal(transformStub.callCount, 1); // once for the parents object and then once for each child
|
|
419
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
it('decrypts a meeting container activity with display name and extension with recording', () => {
|
|
424
|
-
const transform = transforms.find((t) => t.name === 'decryptMeetingcontainer');
|
|
425
|
-
const transformStub = sinon.spy();
|
|
426
|
-
const ctx = {
|
|
427
|
-
transform: transformStub,
|
|
428
|
-
};
|
|
429
|
-
const key = null;
|
|
430
|
-
const meetingContainer = {
|
|
431
|
-
id: 'd5416be0-aeb9-11ec-bac4-ad7fbcfb8ba2',
|
|
432
|
-
objectType: 'meetingContainer',
|
|
433
|
-
displayName:
|
|
434
|
-
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvYjhjOTg1MTYtNmY0OS00Zjk2LThhMmEtZGIxOTc2ZTAwYTk5IiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..H-Ef6wjRGeolqSTJ.xZUwyy5VnKPGdsWDCg0T1A.3Vrx_z7Z0Z2NlnNr3vf43A',
|
|
435
|
-
extensions: {
|
|
436
|
-
items: [
|
|
437
|
-
{
|
|
438
|
-
data: {
|
|
439
|
-
id: '6a055bbe96aa103a9afd005056818248',
|
|
440
|
-
objectType: 'recording',
|
|
441
|
-
topic:
|
|
442
|
-
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvOTAwYjUwZmMtYzg0Yi00YTM4LTk0MGQtYWJjM2IyNjJiMWUyIiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..5LXICENQ0AvplBc4.yUlXzF86eyP9sZR75l6spOtAaEwYWIzRx2N-kWZQLVB2JwudN2U.-DWv7fce_Ac2K_l5QryDCQ',
|
|
443
|
-
},
|
|
444
|
-
encryptionKeyUrl:
|
|
445
|
-
'kms://kms-cisco.wbx2.com/keys/900b50fc-c84b-4a38-940d-abc3b262b1e2',
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
},
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
return transform.fn(ctx, key, meetingContainer).then(() => {
|
|
452
|
-
assert.equal(transformStub.callCount, 2); // once for the parents object and then once for each child
|
|
453
|
-
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
454
|
-
assert.equal(transformStub.getCall(1).args[0], 'decryptPropTopic');
|
|
455
|
-
});
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import sinon from 'sinon';
|
|
6
|
+
import {assert, expect} from '@webex/test-helper-chai';
|
|
7
|
+
import {transforms} from '@webex/internal-plugin-conversation/src/decryption-transforms';
|
|
8
|
+
|
|
9
|
+
describe('plugin-conversation', () => {
|
|
10
|
+
describe('decryption transforms', () => {
|
|
11
|
+
describe('decryptObject()', () => {
|
|
12
|
+
it('calls the correct method if a recording microappInstance is passed to it', () => {
|
|
13
|
+
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
14
|
+
const transformStub = sinon.stub();
|
|
15
|
+
|
|
16
|
+
const ctx = {
|
|
17
|
+
transform: transformStub,
|
|
18
|
+
};
|
|
19
|
+
const key = null;
|
|
20
|
+
const activity = {
|
|
21
|
+
objectType: 'microappInstance',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
transform.fn(ctx, key, activity);
|
|
25
|
+
|
|
26
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptMicroappinstance');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('decryptComment()', () => {
|
|
31
|
+
it('calls the correct method if an array prop is passed to it', () => {
|
|
32
|
+
const transform = transforms.find((t) => t.name === 'decryptComment');
|
|
33
|
+
const transformStub = sinon.stub();
|
|
34
|
+
|
|
35
|
+
const ctx = {
|
|
36
|
+
transform: transformStub,
|
|
37
|
+
};
|
|
38
|
+
const key = null;
|
|
39
|
+
const activity = {
|
|
40
|
+
objectType: 'comment',
|
|
41
|
+
cards: [
|
|
42
|
+
'eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..QQeWYBBB8H7MCnWm.6C-feMX3zp70t4VZNNrsFQRMpWSpByJFYXPOfTUeTXi6SNXvw0s2jVfHbLSBCyiOJCQxMtzNAbnWsqL0LC3HdEWbLee2DYVMLHLpLTleUKErgoIy3xvO6vbDcv3USaF4qq64m5fn2P5vJxNy96mtfghW8cDsWs22kUsA7uHkICrUICdMC2F6isuHTy9e-HTOl6L2tI5DNZHs2niD_-eq_om30NRlBN05AU33Biu6iVmBhH-AVLJfzvl6S5V7o8e61ppniuHJzGA-PVACTK2-9lYS1-MFxKaCPNH_5Dx5MAwvWPC1WYuD5yGA24G8eraMueUW0k0vwSEKt3OC7WDTo9vYLnRJYlFx4pIG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rzgwZ3c8zjbUrTbamkCOQvsxgogBe36ySbsY1R1wQUfXSeJOgkLqbteDlrMthf5QEstJGm3BYJHFBFEYW-nSzEbiea0CEMNwWzOjAUvetdg5lKBXwT_dIiVa_ZRxofe6-v7fbXiZ15TE73GYlldtyYcY9js32rKHCN47BoBKYATM-njnymmN8Vts0znsRM53WAHr-27tJYQC46YMyPCJoajIFYmlcX8og9hRhvgR_WUWt1QcTyG1DUCpUiferYYC5j5ifU9Gv35JIFpCfOFti-H4eSyPY8N_EIC3Yf-dbCPK9qSJUu0Sfo7PzCybcC3HgbucQI8k3rK_l_9758hYoZR2fZh3gMlOSmNqVhO0a7-YwSv_bxpKvHOIyiIlAVFIsrGLvdal4tJbLq8kGwyYS8X60qK_l-8G4uJ8F7LBkUO6zn-6kxTi10woXqwPGyo5MBYyMKH7HGG67jKRuADJRqSis8RHolHt7LEhlimh6fIqPxBKmorq__TF4IYTGKgnyl41NM_r_XjC6QSLMgTBszXYPDI6CnUZrAl5GI09WCEOC4bKp98I2Qa3ssS2AlBIwwP6Z7oRsUg0om2FUr9kW4HSsv0kNMTbGa7fqlgbCRn1bGttU7W8EVwmBlCJw9v5RklkHbj9qpaNA4iyTCRxfHWyjIQkOA6jUfOaNIRZLHywaUEG-1yZ4bNFdTLjEQ_gvzQgg.jM6UaCTq9P_i4tKbkxrLrg',
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
transform.fn(ctx, key, activity);
|
|
47
|
+
expect(transformStub.lastCall.args[0]).to.equal('decryptPropCardItem');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('decryptMicroappinstance()', () => {
|
|
52
|
+
it('decrypts the model prop inside of decryptMicroappinstance()', () => {
|
|
53
|
+
const transform = transforms.find((t) => t.name === 'decryptMicroappinstance');
|
|
54
|
+
const transformStub = sinon.stub();
|
|
55
|
+
|
|
56
|
+
const ctx = {
|
|
57
|
+
transform: transformStub,
|
|
58
|
+
};
|
|
59
|
+
const key = null;
|
|
60
|
+
const microappInstance = {
|
|
61
|
+
model: 'Longencryptedstring',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
transform.fn(ctx, key, microappInstance);
|
|
65
|
+
|
|
66
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptPropModel');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('previous', () => {
|
|
71
|
+
it('calls the correct method if a previous object is passed in', () => {
|
|
72
|
+
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
73
|
+
const transformStub = sinon.stub();
|
|
74
|
+
|
|
75
|
+
const ctx = {
|
|
76
|
+
transform: transformStub,
|
|
77
|
+
};
|
|
78
|
+
const key = null;
|
|
79
|
+
const activity = {
|
|
80
|
+
objectType: 'conversation',
|
|
81
|
+
previous: {},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
transform.fn(ctx, key, activity);
|
|
85
|
+
|
|
86
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptConversation');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('decrypts the activity object with a previous conversation', () => {
|
|
90
|
+
const transform = transforms.find((t) => t.name === 'decryptActivity');
|
|
91
|
+
const transformStub = sinon.spy();
|
|
92
|
+
|
|
93
|
+
const ctx = {
|
|
94
|
+
transform: transformStub,
|
|
95
|
+
};
|
|
96
|
+
const key = null;
|
|
97
|
+
const activity = {
|
|
98
|
+
objectType: 'activity',
|
|
99
|
+
verb: 'update',
|
|
100
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
101
|
+
object: {
|
|
102
|
+
objectType: 'conversation',
|
|
103
|
+
previous: {
|
|
104
|
+
displayName: 'test123',
|
|
105
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
111
|
+
assert.equal(transformStub.callCount, 1);
|
|
112
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('decrypts the activity object with a previousValue in the conversation', () => {
|
|
117
|
+
const transform = transforms.find((t) => t.name === 'decryptActivity');
|
|
118
|
+
const transformStub = sinon.spy();
|
|
119
|
+
|
|
120
|
+
const ctx = {
|
|
121
|
+
transform: transformStub,
|
|
122
|
+
};
|
|
123
|
+
const key = null;
|
|
124
|
+
const activity = {
|
|
125
|
+
objectType: 'activity',
|
|
126
|
+
verb: 'update',
|
|
127
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
128
|
+
object: {
|
|
129
|
+
objectType: 'conversation',
|
|
130
|
+
previousValue: {
|
|
131
|
+
displayName: 'test123',
|
|
132
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
138
|
+
assert.equal(transformStub.callCount, 1);
|
|
139
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('threads', () => {
|
|
145
|
+
it('decrypts childActivities if a thread object is passed in', () => {
|
|
146
|
+
const transform = transforms.find((t) => t.name === 'decryptThread');
|
|
147
|
+
const transformStub = sinon.stub();
|
|
148
|
+
|
|
149
|
+
const ctx = {
|
|
150
|
+
transform: transformStub,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const threadObject = {
|
|
154
|
+
childType: 'reply',
|
|
155
|
+
actorId: '123',
|
|
156
|
+
childActivities: [
|
|
157
|
+
{
|
|
158
|
+
objectType: 'activity',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
transform.fn(ctx, threadObject);
|
|
164
|
+
|
|
165
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptObject');
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
describe('reactions', () => {
|
|
170
|
+
it('calls the correct method if a reaction2Summary object is passed in', () => {
|
|
171
|
+
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
172
|
+
const transformStub = sinon.stub();
|
|
173
|
+
|
|
174
|
+
const ctx = {
|
|
175
|
+
transform: transformStub,
|
|
176
|
+
};
|
|
177
|
+
const key = null;
|
|
178
|
+
const activity = {
|
|
179
|
+
objectType: 'reaction2Summary',
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
transform.fn(ctx, key, activity);
|
|
183
|
+
|
|
184
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptReaction2summary');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('decrypts the activity object and its children and its reactions', () => {
|
|
188
|
+
const transform = transforms.find((t) => t.name === 'decryptActivity');
|
|
189
|
+
const transformStub = sinon.spy();
|
|
190
|
+
|
|
191
|
+
const ctx = {
|
|
192
|
+
transform: transformStub,
|
|
193
|
+
};
|
|
194
|
+
const key = null;
|
|
195
|
+
const activity = {
|
|
196
|
+
objectType: 'activity',
|
|
197
|
+
verb: 'post',
|
|
198
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
199
|
+
object: {
|
|
200
|
+
objectType: 'comment',
|
|
201
|
+
},
|
|
202
|
+
children: [
|
|
203
|
+
{
|
|
204
|
+
verb: 'add',
|
|
205
|
+
objectType: 'activity',
|
|
206
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
207
|
+
object: {
|
|
208
|
+
objectType: 'reaction2Summary',
|
|
209
|
+
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
verb: 'add',
|
|
214
|
+
objectType: 'activity',
|
|
215
|
+
encryptionKeyUrl: 'keyUrl1',
|
|
216
|
+
object: {
|
|
217
|
+
objectType: 'reaction2Summary',
|
|
218
|
+
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
225
|
+
assert.equal(transformStub.callCount, 3); // once for the parents object and then once for each child
|
|
226
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
227
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptObject');
|
|
228
|
+
assert.equal(transformStub.getCall(2).args[0], 'decryptObject');
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('decrypts the reaction2Summary object and the reactions', () => {
|
|
233
|
+
const transform = transforms.find((t) => t.name === 'decryptReaction2summary');
|
|
234
|
+
const transformStub = sinon.spy();
|
|
235
|
+
|
|
236
|
+
const ctx = {
|
|
237
|
+
transform: transformStub,
|
|
238
|
+
};
|
|
239
|
+
const key = null;
|
|
240
|
+
const activity = {
|
|
241
|
+
objectType: 'reaction2Summary',
|
|
242
|
+
reactions: [{displayName: 'reaction1'}, {displayName: 'reaction2'}],
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
246
|
+
assert.equal(transformStub.callCount, 2);
|
|
247
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
248
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptPropDisplayName');
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it('calls the correct method if a reaction2SelfSummary object is passed in', () => {
|
|
253
|
+
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
254
|
+
const transformStub = sinon.stub();
|
|
255
|
+
|
|
256
|
+
const ctx = {
|
|
257
|
+
transform: transformStub,
|
|
258
|
+
};
|
|
259
|
+
const key = null;
|
|
260
|
+
const activity = {
|
|
261
|
+
objectType: 'reaction2SelfSummary',
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
transform.fn(ctx, key, activity);
|
|
265
|
+
|
|
266
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptReaction2selfsummary');
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('calls the correct method if a reaction2 object is passed in', () => {
|
|
270
|
+
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
271
|
+
const transformStub = sinon.stub();
|
|
272
|
+
|
|
273
|
+
const ctx = {
|
|
274
|
+
transform: transformStub,
|
|
275
|
+
};
|
|
276
|
+
const key = null;
|
|
277
|
+
const activity = {
|
|
278
|
+
objectType: 'reaction2',
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
transform.fn(ctx, key, activity);
|
|
282
|
+
|
|
283
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptReaction2');
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('link activity', () => {
|
|
288
|
+
it('calls the correct method if a content object is passed in', () => {
|
|
289
|
+
const transform = transforms.find((t) => t.name === 'decryptObject');
|
|
290
|
+
const transformStub = sinon.stub();
|
|
291
|
+
|
|
292
|
+
const ctx = {
|
|
293
|
+
transform: transformStub,
|
|
294
|
+
};
|
|
295
|
+
const key = null;
|
|
296
|
+
const activity = {
|
|
297
|
+
objectType: 'content',
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
transform.fn(ctx, key, activity);
|
|
301
|
+
|
|
302
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptContent');
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('calls the correct method if a link content category is passed in', () => {
|
|
306
|
+
const transform = transforms.find((t) => t.name === 'decryptContent');
|
|
307
|
+
const transformStub = sinon.stub();
|
|
308
|
+
|
|
309
|
+
const ctx = {
|
|
310
|
+
transform: transformStub,
|
|
311
|
+
};
|
|
312
|
+
const key = null;
|
|
313
|
+
const activity = {
|
|
314
|
+
objectType: 'content',
|
|
315
|
+
contentCategory: 'links',
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
transform.fn(ctx, key, activity);
|
|
319
|
+
|
|
320
|
+
assert.equal(transformStub.lastCall.args[0], 'decryptContentLinks');
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it('decrypts the link and the comment', () => {
|
|
324
|
+
const transform = transforms.find((t) => t.name === 'decryptContentLinks');
|
|
325
|
+
const transformStub = sinon.spy();
|
|
326
|
+
|
|
327
|
+
const ctx = {
|
|
328
|
+
transform: transformStub,
|
|
329
|
+
};
|
|
330
|
+
const key = null;
|
|
331
|
+
const activity = {
|
|
332
|
+
objectType: 'content',
|
|
333
|
+
contentCategory: 'links',
|
|
334
|
+
links: {
|
|
335
|
+
items: [{item1: 'item1'}],
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
340
|
+
assert.equal(transformStub.callCount, 2);
|
|
341
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptObject');
|
|
342
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptComment');
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('decrypts a link object', () => {
|
|
347
|
+
const transform = transforms.find((t) => t.name === 'decryptLink');
|
|
348
|
+
const transformStub = sinon.spy();
|
|
349
|
+
|
|
350
|
+
const ctx = {
|
|
351
|
+
transform: transformStub,
|
|
352
|
+
};
|
|
353
|
+
const key = null;
|
|
354
|
+
const activity = {
|
|
355
|
+
objectType: 'content',
|
|
356
|
+
contentCategory: 'links',
|
|
357
|
+
links: {
|
|
358
|
+
items: [{item1: 'item1'}],
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
363
|
+
assert.equal(transformStub.callCount, 2);
|
|
364
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropSslr');
|
|
365
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptPropDisplayName');
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('decrypts an sslr', () => {
|
|
370
|
+
const transform = transforms.find((t) => t.name === 'decryptPropSslr');
|
|
371
|
+
|
|
372
|
+
const ORIG_SSLR = 'ORIG_SSLR';
|
|
373
|
+
const DECRYPTED_SSLR = 'DECRYPTED_SSLR';
|
|
374
|
+
const transformStub = sinon.spy(() => Promise.resolve(DECRYPTED_SSLR));
|
|
375
|
+
|
|
376
|
+
const ctx = {
|
|
377
|
+
webex: {
|
|
378
|
+
internal: {
|
|
379
|
+
encryption: {
|
|
380
|
+
decryptScr: transformStub,
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
const key = null;
|
|
386
|
+
const activity = {
|
|
387
|
+
objectType: 'content',
|
|
388
|
+
contentCategory: 'links',
|
|
389
|
+
links: {
|
|
390
|
+
items: [{item1: 'item1'}],
|
|
391
|
+
},
|
|
392
|
+
sslr: ORIG_SSLR,
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
return transform.fn(ctx, key, activity).then(() => {
|
|
396
|
+
assert.equal(transformStub.callCount, 1);
|
|
397
|
+
assert.equal(transformStub.getCall(0).args[1], ORIG_SSLR);
|
|
398
|
+
assert.equal(activity.sslr, DECRYPTED_SSLR);
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
describe('meeting containers', () => {
|
|
403
|
+
it('decrypts a meeting container activity with only display name', () => {
|
|
404
|
+
const transform = transforms.find((t) => t.name === 'decryptMeetingcontainer');
|
|
405
|
+
const transformStub = sinon.spy();
|
|
406
|
+
const ctx = {
|
|
407
|
+
transform: transformStub,
|
|
408
|
+
};
|
|
409
|
+
const key = null;
|
|
410
|
+
const meetingContainer = {
|
|
411
|
+
id: 'd5416be0-aeb9-11ec-bac4-ad7fbcfb8ba2',
|
|
412
|
+
objectType: 'meetingContainer',
|
|
413
|
+
displayName:
|
|
414
|
+
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvYjhjOTg1MTYtNmY0OS00Zjk2LThhMmEtZGIxOTc2ZTAwYTk5IiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..H-Ef6wjRGeolqSTJ.xZUwyy5VnKPGdsWDCg0T1A.3Vrx_z7Z0Z2NlnNr3vf43A',
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
return transform.fn(ctx, key, meetingContainer).then(() => {
|
|
418
|
+
assert.equal(transformStub.callCount, 1); // once for the parents object and then once for each child
|
|
419
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
it('decrypts a meeting container activity with display name and extension with recording', () => {
|
|
424
|
+
const transform = transforms.find((t) => t.name === 'decryptMeetingcontainer');
|
|
425
|
+
const transformStub = sinon.spy();
|
|
426
|
+
const ctx = {
|
|
427
|
+
transform: transformStub,
|
|
428
|
+
};
|
|
429
|
+
const key = null;
|
|
430
|
+
const meetingContainer = {
|
|
431
|
+
id: 'd5416be0-aeb9-11ec-bac4-ad7fbcfb8ba2',
|
|
432
|
+
objectType: 'meetingContainer',
|
|
433
|
+
displayName:
|
|
434
|
+
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvYjhjOTg1MTYtNmY0OS00Zjk2LThhMmEtZGIxOTc2ZTAwYTk5IiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..H-Ef6wjRGeolqSTJ.xZUwyy5VnKPGdsWDCg0T1A.3Vrx_z7Z0Z2NlnNr3vf43A',
|
|
435
|
+
extensions: {
|
|
436
|
+
items: [
|
|
437
|
+
{
|
|
438
|
+
data: {
|
|
439
|
+
id: '6a055bbe96aa103a9afd005056818248',
|
|
440
|
+
objectType: 'recording',
|
|
441
|
+
topic:
|
|
442
|
+
'eyJraWQiOiJrbXM6XC9cL2ttcy1jaXNjby53YngyLmNvbVwva2V5c1wvOTAwYjUwZmMtYzg0Yi00YTM4LTk0MGQtYWJjM2IyNjJiMWUyIiwiZW5jIjoiQTI1NkdDTSIsImFsZyI6ImRpciJ9..5LXICENQ0AvplBc4.yUlXzF86eyP9sZR75l6spOtAaEwYWIzRx2N-kWZQLVB2JwudN2U.-DWv7fce_Ac2K_l5QryDCQ',
|
|
443
|
+
},
|
|
444
|
+
encryptionKeyUrl:
|
|
445
|
+
'kms://kms-cisco.wbx2.com/keys/900b50fc-c84b-4a38-940d-abc3b262b1e2',
|
|
446
|
+
},
|
|
447
|
+
],
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
return transform.fn(ctx, key, meetingContainer).then(() => {
|
|
452
|
+
assert.equal(transformStub.callCount, 2); // once for the parents object and then once for each child
|
|
453
|
+
assert.equal(transformStub.getCall(0).args[0], 'decryptPropDisplayName');
|
|
454
|
+
assert.equal(transformStub.getCall(1).args[0], 'decryptPropTopic');
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
});
|