@webex/internal-plugin-ediscovery 2.37.0 → 2.37.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.
@@ -1,23 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
14
-
15
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
16
-
17
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
18
-
19
12
  var _retry = require("./retry");
20
-
21
13
  /**
22
14
  * This class is used to encrypt/decrypt various properties on ReportRequests, Activities and Spaces as they are sent/returned to/from the eDiscovery Service
23
15
  */
@@ -25,7 +17,6 @@ var Transforms = /*#__PURE__*/function () {
25
17
  function Transforms() {
26
18
  (0, _classCallCheck2.default)(this, Transforms);
27
19
  }
28
-
29
20
  (0, _createClass2.default)(Transforms, null, [{
30
21
  key: "encryptReportRequest",
31
22
  value:
@@ -39,7 +30,6 @@ var Transforms = /*#__PURE__*/function () {
39
30
  if (!object || !object.body) {
40
31
  return _promise.default.resolve(object);
41
32
  }
42
-
43
33
  var reportRequest = object.body;
44
34
  return ctx.webex.internal.encryption.kms.createUnboundKeys({
45
35
  count: 1
@@ -51,19 +41,16 @@ var Transforms = /*#__PURE__*/function () {
51
41
  keys: keys
52
42
  }).then(function () {
53
43
  var promises = [];
54
-
55
44
  if (reportRequest.name) {
56
45
  promises.push(ctx.webex.internal.encryption.encryptText(keys[0], reportRequest.name).then(function (encryptedName) {
57
46
  reportRequest.name = encryptedName;
58
47
  }));
59
48
  }
60
-
61
49
  if (reportRequest.description) {
62
50
  promises.push(ctx.webex.internal.encryption.encryptText(keys[0], reportRequest.description).then(function (encryptedDescription) {
63
51
  reportRequest.description = encryptedDescription;
64
52
  }));
65
53
  }
66
-
67
54
  if (reportRequest.spaceNames) {
68
55
  promises.push(_promise.default.all(reportRequest.spaceNames.map(function (spaceName) {
69
56
  return ctx.webex.internal.encryption.encryptText(keys[0], spaceName);
@@ -71,7 +58,6 @@ var Transforms = /*#__PURE__*/function () {
71
58
  reportRequest.spaceNames = encryptedSpaceNames;
72
59
  }));
73
60
  }
74
-
75
61
  if (reportRequest.keywords) {
76
62
  promises.push(_promise.default.all(reportRequest.keywords.map(function (keyword) {
77
63
  return ctx.webex.internal.encryption.encryptText(keys[0], keyword);
@@ -79,7 +65,6 @@ var Transforms = /*#__PURE__*/function () {
79
65
  reportRequest.keywords = encryptedKeywords;
80
66
  }));
81
67
  }
82
-
83
68
  if (reportRequest.emails) {
84
69
  // store unencrypted emails for ediscovery service to convert to user ids
85
70
  reportRequest.unencryptedEmails = reportRequest.emails;
@@ -89,34 +74,30 @@ var Transforms = /*#__PURE__*/function () {
89
74
  reportRequest.emails = encryptedEmails;
90
75
  }));
91
76
  }
92
-
93
77
  return _promise.default.all(promises);
94
78
  });
95
79
  }
96
-
97
80
  return _promise.default.resolve(object);
98
81
  }).catch(function (reason) {
99
82
  ctx.webex.logger.error("Error while encrypting report request: ".concat(reportRequest, " : ").concat(reason));
100
83
  return _promise.default.reject(reason);
101
84
  });
102
85
  }
86
+
103
87
  /**
104
88
  * This function is used to decrypt encrypted properties on the ReportRequest that is returned from the eDiscovery Service getReport(s) API
105
89
  * @param {Object} ctx - An object containing a webex instance and a transform
106
90
  * @param {Object} object - Generic object that you want to decrypt some property on based on the type
107
91
  * @returns {Promise} - Returns a transform promise
108
92
  */
109
-
110
93
  }, {
111
94
  key: "decryptReportRequest",
112
95
  value: function decryptReportRequest(ctx, object) {
113
96
  if (!object || !object.body || !object.body.reportRequest || !object.body.reportRequest.encryptionKeyUrl) {
114
97
  return _promise.default.resolve(object);
115
98
  }
116
-
117
99
  var reportRequest = object.body.reportRequest;
118
100
  var reportNamePromise;
119
-
120
101
  if (reportRequest.name) {
121
102
  reportNamePromise = ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, reportRequest.name).then(function (decryptedName) {
122
103
  reportRequest.name = decryptedName;
@@ -124,9 +105,7 @@ var Transforms = /*#__PURE__*/function () {
124
105
  ctx.webex.logger.error("Error decrypting report name for report ".concat(object.body.id, ": ").concat(reason));
125
106
  });
126
107
  }
127
-
128
108
  var reportDescriptionPromise;
129
-
130
109
  if (reportRequest.description) {
131
110
  reportDescriptionPromise = ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, reportRequest.description).then(function (decryptedDescription) {
132
111
  reportRequest.description = decryptedDescription;
@@ -134,9 +113,7 @@ var Transforms = /*#__PURE__*/function () {
134
113
  ctx.webex.logger.error("Error decrypting description for report ".concat(object.body.id, ": ").concat(reason));
135
114
  });
136
115
  }
137
-
138
116
  var spaceNamePromises = [];
139
-
140
117
  if (reportRequest.spaceNames) {
141
118
  spaceNamePromises = _promise.default.all(reportRequest.spaceNames.map(function (spaceName) {
142
119
  return ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, spaceName);
@@ -146,9 +123,7 @@ var Transforms = /*#__PURE__*/function () {
146
123
  ctx.webex.logger.error("Error decrypting space name for report ".concat(object.body.id, ": ").concat(reason));
147
124
  });
148
125
  }
149
-
150
126
  var keywordPromises = [];
151
-
152
127
  if (reportRequest.keywords) {
153
128
  keywordPromises = _promise.default.all(reportRequest.keywords.map(function (keyword) {
154
129
  return ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, keyword);
@@ -158,9 +133,7 @@ var Transforms = /*#__PURE__*/function () {
158
133
  ctx.webex.logger.error("Error decrypting keywords for report ".concat(object.body.id, ": ").concat(reason));
159
134
  });
160
135
  }
161
-
162
136
  var emailPromises = [];
163
-
164
137
  if (reportRequest.emails) {
165
138
  emailPromises = _promise.default.all(reportRequest.emails.map(function (email) {
166
139
  return ctx.webex.internal.encryption.decryptText(reportRequest.encryptionKeyUrl, email);
@@ -170,9 +143,9 @@ var Transforms = /*#__PURE__*/function () {
170
143
  ctx.webex.logger.error("Error decrypting emails for report ".concat(object.body.id, ": ").concat(reason));
171
144
  });
172
145
  }
173
-
174
146
  return _promise.default.all([reportNamePromise, reportDescriptionPromise].concat(spaceNamePromises, keywordPromises, emailPromises));
175
147
  }
148
+
176
149
  /**
177
150
  * This function is used to decrypt encrypted properties on the activities that are returned from the eDiscovery Service getContent API
178
151
  * @param {Object} ctx - An object containing a webex instance and a transform
@@ -180,89 +153,79 @@ var Transforms = /*#__PURE__*/function () {
180
153
  * @param {String} reportId - Id of the report for which content is being retrieved
181
154
  * @returns {Promise} - Returns a transform promise
182
155
  */
183
-
184
156
  }, {
185
157
  key: "decryptReportContent",
186
158
  value: function decryptReportContent(ctx, object, reportId) {
187
159
  if (!object || !object.body || !reportId) {
188
160
  return _promise.default.resolve();
189
161
  }
190
-
191
162
  var activity = object.body;
192
163
  var promises = [];
193
164
  return ctx.webex.internal.ediscovery.getContentContainerByContainerId(reportId, activity.targetId).then(function (res) {
194
165
  var _activity$spaceInfo, _activity$spaceInfo2, _activity$spaceInfo3, _activity$spaceInfo4, _activity$spaceInfo5, _activity$meeting, _activity$recording;
195
-
196
166
  var container = res.body;
197
-
198
167
  if (!container) {
199
168
  var reason = "Container ".concat(activity.targetId, " not found - unable to decrypt activity ").concat(activity.activityId);
200
169
  activity.error = reason;
201
170
  ctx.webex.logger.error(reason);
202
171
  return _promise.default.resolve(object);
203
- } // add warning properties to the activity - these will be recorded in the downloader
204
-
172
+ }
205
173
 
174
+ // add warning properties to the activity - these will be recorded in the downloader
206
175
  if (container.warning) {
207
176
  activity.spaceWarning = container.warning; // Remove this property once all clients are using the content container model
208
-
209
177
  activity.containerWarning = container.warning;
210
- } // set space name and participants on activity
211
-
178
+ }
212
179
 
180
+ // set space name and participants on activity
213
181
  if (container.containerName) {
214
182
  activity.spaceName = container.containerName; // Remove this property once all clients are using the content container model
215
-
216
183
  activity.containerName = container.containerName;
217
184
  } else if (container.isOneOnOne) {
218
185
  var displayNames = (container.participants || []).concat(container.formerParticipants || []).map(function (p) {
219
186
  return p.displayName;
220
- }).join(' & '); // One to One spaces have no space name, use participant names as 'Subject' instead
187
+ }).join(' & ');
221
188
 
189
+ // One to One spaces have no space name, use participant names as 'Subject' instead
222
190
  activity.spaceName = displayNames; // Remove this property once all clients are using the content container model
223
-
224
191
  activity.containerName = displayNames;
225
192
  } else {
226
193
  activity.spaceName = ''; // Remove this property once all clients are using the content container model
227
-
228
194
  activity.containerName = '';
229
- } // post and share activities have content which needs to be decrypted
230
- // as do meeting, recording activities, customApp extensions, and space information updates
231
-
195
+ }
232
196
 
197
+ // post and share activities have content which needs to be decrypted
198
+ // as do meeting, recording activities, customApp extensions, and space information updates
233
199
  if (!['post', 'share'].includes(activity.verb) && !activity.meeting && !activity.recording && !(activity.extension && activity.extension.extensionType === 'customApp') && !((_activity$spaceInfo = activity.spaceInfo) !== null && _activity$spaceInfo !== void 0 && _activity$spaceInfo.name) && !((_activity$spaceInfo2 = activity.spaceInfo) !== null && _activity$spaceInfo2 !== void 0 && _activity$spaceInfo2.description)) {
234
200
  return _promise.default.resolve(object);
235
201
  }
236
-
237
202
  if (!activity.encryptionKeyUrl) {
238
203
  // If the encryptionKeyUrl is empty we assume the activity is unencrypted
239
204
  ctx.webex.logger.info("Activity ".concat(activity.activityId, " cannot be decrypted due to a missing encryption key url"));
240
205
  return _promise.default.resolve(object);
241
206
  }
242
-
243
207
  if (!container.onBehalfOfUser) {
244
208
  var _reason = "No user available with which to decrypt activity ".concat(activity.activityId, " in container ").concat(activity.targetId);
245
-
246
209
  ctx.webex.logger.error(_reason);
247
210
  activity.error = _reason;
248
211
  return _promise.default.resolve(object);
249
- } // Decrypt activity message if present
250
-
212
+ }
251
213
 
214
+ // Decrypt activity message if present
252
215
  if (activity.objectDisplayName) {
253
216
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.objectDisplayName, {
254
217
  onBehalfOf: container.onBehalfOfUser
255
218
  }]).then(function (decryptedMessage) {
256
219
  activity.objectDisplayName = decryptedMessage;
257
220
  }).catch(function (reason) {
258
- ctx.webex.logger.error("Decrypt message error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason)); // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
259
-
221
+ ctx.webex.logger.error("Decrypt message error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
222
+ // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
260
223
  activity.error = reason;
261
224
  return _promise.default.resolve(object);
262
225
  }));
263
- } // If the activity is a space information update, decrypt the name and description if present
264
-
226
+ }
265
227
 
228
+ // If the activity is a space information update, decrypt the name and description if present
266
229
  if ((_activity$spaceInfo3 = activity.spaceInfo) !== null && _activity$spaceInfo3 !== void 0 && _activity$spaceInfo3.name) {
267
230
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.spaceInfo.name, {
268
231
  onBehalfOf: container.onBehalfOfUser
@@ -274,7 +237,6 @@ var Transforms = /*#__PURE__*/function () {
274
237
  return _promise.default.resolve(object);
275
238
  }));
276
239
  }
277
-
278
240
  if ((_activity$spaceInfo4 = activity.spaceInfo) !== null && _activity$spaceInfo4 !== void 0 && _activity$spaceInfo4.description) {
279
241
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.spaceInfo.description, {
280
242
  onBehalfOf: container.onBehalfOfUser
@@ -286,7 +248,6 @@ var Transforms = /*#__PURE__*/function () {
286
248
  return _promise.default.resolve(object);
287
249
  }));
288
250
  }
289
-
290
251
  if ((_activity$spaceInfo5 = activity.spaceInfo) !== null && _activity$spaceInfo5 !== void 0 && _activity$spaceInfo5.previousName && activity.spaceInfo.previousEncryptionKeyUrl) {
291
252
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.spaceInfo.previousEncryptionKeyUrl, activity.spaceInfo.previousName, {
292
253
  onBehalfOf: container.onBehalfOfUser
@@ -297,9 +258,9 @@ var Transforms = /*#__PURE__*/function () {
297
258
  activity.error = reason;
298
259
  return _promise.default.resolve(object);
299
260
  }));
300
- } // Decrypt content url and display name if extension is present
301
-
261
+ }
302
262
 
263
+ // Decrypt content url and display name if extension is present
303
264
  if (activity.extension && activity.extension.objectType === 'extension' && activity.extension.extensionType === 'customApp') {
304
265
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.contentUrl, {
305
266
  onBehalfOf: container.onBehalfOfUser
@@ -318,8 +279,9 @@ var Transforms = /*#__PURE__*/function () {
318
279
  ctx.webex.logger.error("Decrypt activity.extension.displayName error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
319
280
  activity.error = reason;
320
281
  return _promise.default.resolve(object);
321
- })); // Decrypt webUrl.
282
+ }));
322
283
 
284
+ // Decrypt webUrl.
323
285
  if (activity.extension.webUrl) {
324
286
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.webUrl, {
325
287
  onBehalfOf: container.onBehalfOfUser
@@ -331,7 +293,6 @@ var Transforms = /*#__PURE__*/function () {
331
293
  return _promise.default.resolve(object);
332
294
  }));
333
295
  }
334
-
335
296
  if (activity.verb === 'update' && activity.extension.previous) {
336
297
  if (activity.extension.previous.contentUrl) {
337
298
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.previous.contentUrl, {
@@ -344,7 +305,6 @@ var Transforms = /*#__PURE__*/function () {
344
305
  return _promise.default.resolve(object);
345
306
  }));
346
307
  }
347
-
348
308
  if (activity.extension.previous.displayName) {
349
309
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.extension.previous.displayName, {
350
310
  onBehalfOf: container.onBehalfOfUser
@@ -357,9 +317,9 @@ var Transforms = /*#__PURE__*/function () {
357
317
  }));
358
318
  }
359
319
  }
360
- } // Decrypt meeting title if present
361
-
320
+ }
362
321
 
322
+ // Decrypt meeting title if present
363
323
  if (activity !== null && activity !== void 0 && (_activity$meeting = activity.meeting) !== null && _activity$meeting !== void 0 && _activity$meeting.title) {
364
324
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.meeting.title, {
365
325
  onBehalfOf: container.onBehalfOfUser
@@ -370,9 +330,9 @@ var Transforms = /*#__PURE__*/function () {
370
330
  activity.error = reason;
371
331
  return _promise.default.resolve(object);
372
332
  }));
373
- } // Decrypt meeting recording topic if present
374
-
333
+ }
375
334
 
335
+ // Decrypt meeting recording topic if present
376
336
  if (activity !== null && activity !== void 0 && (_activity$recording = activity.recording) !== null && _activity$recording !== void 0 && _activity$recording.topic) {
377
337
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, activity.recording.topic, {
378
338
  onBehalfOf: container.onBehalfOfUser
@@ -383,31 +343,31 @@ var Transforms = /*#__PURE__*/function () {
383
343
  activity.error = reason;
384
344
  return _promise.default.resolve(object);
385
345
  }));
386
- } // Decrypt shares (files, whiteboards, shared links)
387
- // Array.prototype.concat.apply ignores undefined
388
-
346
+ }
389
347
 
348
+ // Decrypt shares (files, whiteboards, shared links)
349
+ // Array.prototype.concat.apply ignores undefined
390
350
  var shares = Array.prototype.concat.apply([], activity.files);
391
351
  shares = Array.prototype.concat.apply(shares, activity.whiteboards);
392
352
  shares = Array.prototype.concat.apply(shares, activity.links);
353
+ var _loop = function _loop() {
354
+ var share = shares[i];
393
355
 
394
- var _loop = function _loop(i) {
395
- var share = shares[i]; // Decrypt the share's display name
356
+ // Decrypt the share's display name
396
357
  // Ignore display names for whiteboards which are unencrypted
397
-
398
358
  if (share.displayName && (!activity.whiteboards || !activity.whiteboards.includes(share))) {
399
359
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, share.displayName, {
400
360
  onBehalfOf: container.onBehalfOfUser
401
361
  }]).then(function (decryptedDisplayName) {
402
362
  share.displayName = decryptedDisplayName;
403
363
  }).catch(function (reason) {
404
- ctx.webex.logger.warn("Decrypt DisplayName error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason)); // add warning property to activity - this will present an indication that there was data loss on the downloader
405
-
364
+ ctx.webex.logger.warn("Decrypt DisplayName error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
365
+ // add warning property to activity - this will present an indication that there was data loss on the downloader
406
366
  activity.warning = reason;
407
367
  }));
408
- } // Shared Links can have additional decryption fields
409
-
368
+ }
410
369
 
370
+ // Shared Links can have additional decryption fields
411
371
  if (share.microsoftSharedLinkInfo) {
412
372
  if (share.microsoftSharedLinkInfo.driveId) {
413
373
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, share.microsoftSharedLinkInfo.driveId, {
@@ -415,32 +375,32 @@ var Transforms = /*#__PURE__*/function () {
415
375
  }]).then(function (decryptedDriveId) {
416
376
  share.microsoftSharedLinkInfo.driveId = decryptedDriveId;
417
377
  }).catch(function (reason) {
418
- ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.driveId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason)); // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
419
-
378
+ ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.driveId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
379
+ // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
420
380
  activity.error = reason;
421
381
  return _promise.default.resolve(object);
422
382
  }));
423
383
  }
424
-
425
384
  if (share.microsoftSharedLinkInfo.itemId) {
426
385
  promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [activity.encryptionKeyUrl, share.microsoftSharedLinkInfo.itemId, {
427
386
  onBehalfOf: container.onBehalfOfUser
428
387
  }]).then(function (decryptedItemId) {
429
388
  share.microsoftSharedLinkInfo.itemId = decryptedItemId;
430
389
  }).catch(function (reason) {
431
- ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.itemId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason)); // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
432
-
390
+ ctx.webex.logger.error("Decrypt share.microsoftSharedLinkInfo.itemId error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
391
+ // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
433
392
  activity.error = reason;
434
393
  return _promise.default.resolve(object);
435
394
  }));
436
395
  }
437
- } // Decrypt the scr (Secure Content Reference) or sslr (Secure Shared Link Reference)
396
+ }
397
+
398
+ // Decrypt the scr (Secure Content Reference) or sslr (Secure Shared Link Reference)
438
399
  // Unlike a scr the sslr contains only a loc. But decryptScr(...) is flexible and
439
400
  // leaves the tag, auth, IV, etc fields on the SCR object as undefined.
440
-
441
-
442
401
  if (share.scr || share.sslr) {
443
- promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptScr, // A share will have an encryptionKeyUrl when it's activity uses a different encryptionKeyUrl. This can happen when old activities are edited
402
+ promises.push((0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptScr,
403
+ // A share will have an encryptionKeyUrl when it's activity uses a different encryptionKeyUrl. This can happen when old activities are edited
444
404
  // and key rotation is turn on.
445
405
  [share.encryptionKeyUrl || activity.encryptionKeyUrl, share.scr || share.sslr, {
446
406
  onBehalfOf: container.onBehalfOfUser
@@ -451,69 +411,64 @@ var Transforms = /*#__PURE__*/function () {
451
411
  share.sslr = decryptedSCR.loc;
452
412
  }
453
413
  }).catch(function (reason) {
454
- ctx.webex.logger.error("Decrypt file scr or sslr error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason)); // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
455
-
414
+ ctx.webex.logger.error("Decrypt file scr or sslr error for activity ".concat(activity.activityId, " in container ").concat(activity.targetId, " for share type: ").concat(share.mimeType, ", size: ").concat(share.fileSize, ", and url: ").concat(share.url, " due to error: ").concat(reason));
415
+ // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
456
416
  activity.error = reason;
457
417
  return _promise.default.resolve(object);
458
418
  }));
459
419
  }
460
420
  };
461
-
462
421
  for (var i = 0; i < shares.length; i += 1) {
463
- _loop(i);
422
+ _loop();
464
423
  }
465
-
466
424
  return _promise.default.all(promises);
467
425
  }).catch(function (reason) {
468
- ctx.webex.logger.error("Error retrieving content container for: ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason)); // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
469
-
426
+ ctx.webex.logger.error("Error retrieving content container for: ".concat(activity.activityId, " in container ").concat(activity.targetId, ": ").concat(reason));
427
+ // add error property to activity - this error will be recorded in the downloader and the activity omitted from the report
470
428
  activity.error = reason;
471
429
  return _promise.default.resolve(object);
472
430
  });
473
431
  }
432
+
474
433
  /**
475
434
  * This function is used to decrypt encrypted properties on the containers that are returned from the eDiscovery Service getContentContainer API
476
435
  * @param {Object} ctx - An object containing a webex instance and a transform
477
436
  * @param {Object} object - Generic object that you want to decrypt some property on based on the type
478
437
  * @returns {Promise} - Returns a transform promise
479
438
  */
480
-
481
439
  }, {
482
440
  key: "decryptReportContentContainer",
483
441
  value: function decryptReportContentContainer(ctx, object) {
484
442
  if (!object || !object.body) {
485
443
  return _promise.default.resolve();
486
444
  }
487
-
488
445
  var container = object.body;
489
-
490
446
  if (!container.containerName) {
491
447
  return _promise.default.resolve(object);
492
448
  }
493
-
494
449
  if (!container.encryptionKeyUrl) {
495
450
  // If the encryptionKeyUrl is empty we assume the container name is unencrypted
496
451
  ctx.webex.logger.info("".concat(container.containerType, " container ").concat(container.containerId, " cannot be decrypted due to a missing encryption key url"));
497
452
  return _promise.default.resolve(object);
498
453
  }
499
-
500
454
  if (!container.onBehalfOfUser) {
501
455
  var reason = "No user available with which to decrypt ".concat(container.containerType, " container ").concat(container.containerId);
502
456
  ctx.webex.logger.error(reason);
503
457
  container.error = reason;
504
458
  return _promise.default.resolve(object);
505
- } // decrypt description if present with a descriptionEncryptionKeyUrl
506
-
459
+ }
507
460
 
461
+ // decrypt description if present with a descriptionEncryptionKeyUrl
508
462
  if (container.description && container.descriptionEncryptionKeyUrl) {
509
463
  (0, _retry.requestWithRetries)(ctx.webex.internal.encryption, ctx.webex.internal.encryption.decryptText, [container.descriptionEncryptionKeyUrl, container.description, {
510
464
  onBehalfOf: container.onBehalfOfUser
511
465
  }]).then(function (decryptedContainerDescription) {
512
466
  container.description = decryptedContainerDescription;
513
467
  }).catch(function (reason) {
514
- ctx.webex.logger.error("Decrypt container description error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason)); // add warn property to container info - this warning will be recorded in the downloader
515
-
516
- container.warning = reason; // don't return, attempt to decrypt the name first
468
+ ctx.webex.logger.error("Decrypt container description error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason));
469
+ // add warn property to container info - this warning will be recorded in the downloader
470
+ container.warning = reason;
471
+ // don't return, attempt to decrypt the name first
517
472
  });
518
473
  }
519
474
 
@@ -522,8 +477,8 @@ var Transforms = /*#__PURE__*/function () {
522
477
  }]).then(function (decryptedContainerName) {
523
478
  container.containerName = decryptedContainerName;
524
479
  }).catch(function (reason) {
525
- ctx.webex.logger.error("Decrypt container name error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason)); // add warn property to container info - this warning will be recorded in the downloader
526
-
480
+ ctx.webex.logger.error("Decrypt container name error for ".concat(container.containerType, " container ").concat(container.containerId, ": ").concat(reason));
481
+ // add warn property to container info - this warning will be recorded in the downloader
527
482
  container.warning = reason;
528
483
  return _promise.default.resolve(object);
529
484
  });
@@ -531,7 +486,6 @@ var Transforms = /*#__PURE__*/function () {
531
486
  }]);
532
487
  return Transforms;
533
488
  }();
534
-
535
489
  var _default = Transforms;
536
490
  exports.default = _default;
537
491
  //# sourceMappingURL=transforms.js.map