@eluvio/elv-client-js 4.2.12 → 4.2.13

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.
Files changed (39) hide show
  1. package/dist/ElvClient-min.js +1 -1
  2. package/dist/ElvClient-node-min.js +1 -1
  3. package/dist/ElvFrameClient-min.js +1 -1
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +1 -1
  6. package/dist/ElvWalletClient-node-min.js +1 -1
  7. package/dist/src/AuthorizationClient.js +710 -723
  8. package/dist/src/ContentObjectAudit.js +56 -56
  9. package/dist/src/Crypto.js +85 -85
  10. package/dist/src/ElvClient.js +530 -500
  11. package/dist/src/ElvWallet.js +30 -28
  12. package/dist/src/EthClient.js +311 -311
  13. package/dist/src/FrameClient.js +63 -64
  14. package/dist/src/HttpClient.js +60 -60
  15. package/dist/src/Id.js +1 -2
  16. package/dist/src/PermissionsClient.js +499 -487
  17. package/dist/src/RemoteSigner.js +114 -163
  18. package/dist/src/UserProfileClient.js +392 -374
  19. package/dist/src/Utils.js +69 -66
  20. package/dist/src/Validation.js +10 -10
  21. package/dist/src/client/ABRPublishing.js +238 -238
  22. package/dist/src/client/AccessGroups.js +477 -474
  23. package/dist/src/client/ContentAccess.js +1707 -1711
  24. package/dist/src/client/ContentManagement.js +871 -871
  25. package/dist/src/client/Contracts.js +575 -578
  26. package/dist/src/client/Files.js +700 -684
  27. package/dist/src/client/LiveConf.js +1 -6
  28. package/dist/src/client/LiveStream.js +722 -686
  29. package/dist/src/client/NFT.js +14 -14
  30. package/dist/src/client/NTP.js +84 -84
  31. package/dist/src/client/Shares.js +53 -60
  32. package/dist/src/walletClient/ClientMethods.js +977 -951
  33. package/dist/src/walletClient/Notifications.js +14 -14
  34. package/dist/src/walletClient/Profile.js +66 -66
  35. package/dist/src/walletClient/Utils.js +15 -15
  36. package/dist/src/walletClient/index.js +579 -581
  37. package/package.json +1 -1
  38. package/src/client/ContentAccess.js +1 -1
  39. package/dist/src/ContentObjectVerification.js +0 -281
@@ -34,9 +34,9 @@ var _require = require("../Validation"),
34
34
  * @return Promise<Object> - An object containing the address for whom the NFT was minted and the transactionId of the minting request.
35
35
  */
36
36
  exports.MintNFT = /*#__PURE__*/function () {
37
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
37
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
38
38
  var tenantId, address, marketplaceId, items, _ref$extraData, extraData, requestBody, transactionId, mintSignature;
39
- return _regeneratorRuntime.wrap(function _callee$(_context) {
39
+ return _regeneratorRuntime.wrap(function (_context) {
40
40
  while (1) switch (_context.prev = _context.next) {
41
41
  case 0:
42
42
  tenantId = _ref.tenantId, address = _ref.address, marketplaceId = _ref.marketplaceId, items = _ref.items, _ref$extraData = _ref.extraData, extraData = _ref$extraData === void 0 ? {} : _ref$extraData;
@@ -66,11 +66,11 @@ exports.MintNFT = /*#__PURE__*/function () {
66
66
  transactionId = this.utils.B58(UUID.parse(UUID.v4()));
67
67
  requestBody.ts = Date.now();
68
68
  requestBody.trans_id = transactionId;
69
- _context.next = 13;
69
+ _context.next = 1;
70
70
  return this.Sign(JSON.stringify(requestBody));
71
- case 13:
71
+ case 1:
72
72
  mintSignature = _context.sent;
73
- _context.next = 16;
73
+ _context.next = 2;
74
74
  return this.authClient.MakeAuthServiceRequest({
75
75
  method: "POST",
76
76
  path: UrlJoin("/as/tnt/trans/base", tenantId, marketplaceId),
@@ -79,12 +79,12 @@ exports.MintNFT = /*#__PURE__*/function () {
79
79
  "Authorization": "Bearer ".concat(mintSignature)
80
80
  }
81
81
  });
82
- case 16:
82
+ case 2:
83
83
  return _context.abrupt("return", {
84
84
  address: address,
85
85
  transactionId: transactionId
86
86
  });
87
- case 17:
87
+ case 3:
88
88
  case "end":
89
89
  return _context.stop();
90
90
  }
@@ -112,9 +112,9 @@ exports.MintNFT = /*#__PURE__*/function () {
112
112
  * @return Promise<Array<Object>> - A list of transactions matching the specified filters.
113
113
  */
114
114
  exports.CollectionTransactions = /*#__PURE__*/function () {
115
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
115
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
116
116
  var tenantId, collectionId, _ref3$filterOptions, filterOptions, ts, queryParams, allowedOptions, path, signature;
117
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
117
+ return _regeneratorRuntime.wrap(function (_context2) {
118
118
  while (1) switch (_context2.prev = _context2.next) {
119
119
  case 0:
120
120
  tenantId = _ref3.tenantId, collectionId = _ref3.collectionId, _ref3$filterOptions = _ref3.filterOptions, filterOptions = _ref3$filterOptions === void 0 ? {} : _ref3$filterOptions;
@@ -135,11 +135,11 @@ exports.CollectionTransactions = /*#__PURE__*/function () {
135
135
  }
136
136
  });
137
137
  path = this.AuthHttpClient.BaseURI().path(UrlJoin("/tnt", "trans", tenantId, collectionId)).query(queryParams).hash("").resource();
138
- _context2.next = 8;
138
+ _context2.next = 1;
139
139
  return this.Sign(path);
140
- case 8:
140
+ case 1:
141
141
  signature = _context2.sent;
142
- _context2.next = 11;
142
+ _context2.next = 2;
143
143
  return this.utils.ResponseToJson(this.authClient.MakeAuthServiceRequest({
144
144
  method: "GET",
145
145
  path: UrlJoin("as", "tnt", "trans", tenantId, collectionId),
@@ -148,9 +148,9 @@ exports.CollectionTransactions = /*#__PURE__*/function () {
148
148
  "Authorization": "Bearer ".concat(signature)
149
149
  }
150
150
  }));
151
- case 11:
151
+ case 2:
152
152
  return _context2.abrupt("return", _context2.sent);
153
- case 12:
153
+ case 3:
154
154
  case "end":
155
155
  return _context2.stop();
156
156
  }
@@ -58,10 +58,10 @@ var FormatNTPInfo = function FormatNTPInfo(info) {
58
58
  * @return {Promise<string>} - The ID of the NTP instance. This ID can be used when issuing tickets (See IssueNTPCode)
59
59
  */
60
60
  exports.CreateNTPInstance = /*#__PURE__*/function () {
61
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
61
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
62
62
  var _this = this;
63
63
  var tenantId, objectId, groupAddresses, _ref$ntpClass, ntpClass, _ref$maxTickets, maxTickets, _ref$maxRedemptions, maxRedemptions, startTime, endTime, _ref$ticketLength, ticketLength, paramsJSON, groupIds;
64
- return _regeneratorRuntime.wrap(function _callee$(_context) {
64
+ return _regeneratorRuntime.wrap(function (_context) {
65
65
  while (1) switch (_context.prev = _context.next) {
66
66
  case 0:
67
67
  tenantId = _ref.tenantId, objectId = _ref.objectId, groupAddresses = _ref.groupAddresses, _ref$ntpClass = _ref.ntpClass, ntpClass = _ref$ntpClass === void 0 ? 4 : _ref$ntpClass, _ref$maxTickets = _ref.maxTickets, maxTickets = _ref$maxTickets === void 0 ? 0 : _ref$maxTickets, _ref$maxRedemptions = _ref.maxRedemptions, maxRedemptions = _ref$maxRedemptions === void 0 ? 100 : _ref$maxRedemptions, startTime = _ref.startTime, endTime = _ref.endTime, _ref$ticketLength = _ref.ticketLength, ticketLength = _ref$ticketLength === void 0 ? 6 : _ref$ticketLength;
@@ -92,16 +92,16 @@ exports.CreateNTPInstance = /*#__PURE__*/function () {
92
92
  if (endTime) {
93
93
  paramsJSON.push("exp:".concat(endTime));
94
94
  }
95
- _context.next = 13;
95
+ _context.next = 1;
96
96
  return this.authClient.MakeKMSCall({
97
97
  tenantId: tenantId,
98
98
  methodName: "elv_createOTPInstance",
99
99
  params: [tenantId, ntpClass, JSON.stringify(paramsJSON), parseInt(maxTickets), Date.now()],
100
100
  paramTypes: ["string", "int", "string", "int", "int"]
101
101
  });
102
- case 13:
102
+ case 1:
103
103
  return _context.abrupt("return", _context.sent);
104
- case 14:
104
+ case 2:
105
105
  case "end":
106
106
  return _context.stop();
107
107
  }
@@ -127,9 +127,9 @@ exports.CreateNTPInstance = /*#__PURE__*/function () {
127
127
  * @return {Object} - Info about the NTP Instance
128
128
  */
129
129
  exports.UpdateNTPInstance = /*#__PURE__*/function () {
130
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
130
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
131
131
  var tenantId, ntpId, _ref3$maxTickets, maxTickets, _ref3$maxRedemptions, maxRedemptions, startTime, endTime, paramsJSON, _yield$this$authClien, Ret;
132
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
132
+ return _regeneratorRuntime.wrap(function (_context2) {
133
133
  while (1) switch (_context2.prev = _context2.next) {
134
134
  case 0:
135
135
  tenantId = _ref3.tenantId, ntpId = _ref3.ntpId, _ref3$maxTickets = _ref3.maxTickets, maxTickets = _ref3$maxTickets === void 0 ? 0 : _ref3$maxTickets, _ref3$maxRedemptions = _ref3.maxRedemptions, maxRedemptions = _ref3$maxRedemptions === void 0 ? 100 : _ref3$maxRedemptions, startTime = _ref3.startTime, endTime = _ref3.endTime;
@@ -150,18 +150,18 @@ exports.UpdateNTPInstance = /*#__PURE__*/function () {
150
150
  if (maxTickets) {
151
151
  paramsJSON.push("max:".concat(parseInt(maxTickets)));
152
152
  }
153
- _context2.next = 12;
153
+ _context2.next = 1;
154
154
  return this.authClient.MakeKMSCall({
155
155
  tenantId: tenantId,
156
156
  methodName: "elv_updateOTPInstance",
157
157
  params: [tenantId, ntpId, "update", JSON.stringify(paramsJSON), Date.now()],
158
158
  paramTypes: ["string", "string", "string", "string", "int"]
159
159
  });
160
- case 12:
160
+ case 1:
161
161
  _yield$this$authClien = _context2.sent;
162
162
  Ret = _yield$this$authClien.Ret;
163
163
  return _context2.abrupt("return", FormatNTPInfo(JSON.parse(Ret)));
164
- case 15:
164
+ case 2:
165
165
  case "end":
166
166
  return _context2.stop();
167
167
  }
@@ -183,22 +183,22 @@ exports.UpdateNTPInstance = /*#__PURE__*/function () {
183
183
  * @param {string} ntpId - The ID of the NTP instance
184
184
  */
185
185
  exports.SuspendNTPInstance = /*#__PURE__*/function () {
186
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
186
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
187
187
  var tenantId, ntpId;
188
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
188
+ return _regeneratorRuntime.wrap(function (_context3) {
189
189
  while (1) switch (_context3.prev = _context3.next) {
190
190
  case 0:
191
191
  tenantId = _ref5.tenantId, ntpId = _ref5.ntpId;
192
192
  ValidatePresence("tenantId", tenantId);
193
193
  ValidatePresence("ntpId", ntpId);
194
- _context3.next = 5;
194
+ _context3.next = 1;
195
195
  return this.authClient.MakeKMSCall({
196
196
  tenantId: tenantId,
197
197
  methodName: "elv_updateOTPInstance",
198
198
  params: [tenantId, ntpId, "cancel", "[]", Date.now()],
199
199
  paramTypes: ["string", "string", "string", "string", "int"]
200
200
  });
201
- case 5:
201
+ case 1:
202
202
  case "end":
203
203
  return _context3.stop();
204
204
  }
@@ -218,22 +218,22 @@ exports.SuspendNTPInstance = /*#__PURE__*/function () {
218
218
  * @param {string} ntpId - The ID of the NTP instance
219
219
  */
220
220
  exports.DeleteNTPInstance = /*#__PURE__*/function () {
221
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
221
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
222
222
  var tenantId, ntpId;
223
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
223
+ return _regeneratorRuntime.wrap(function (_context4) {
224
224
  while (1) switch (_context4.prev = _context4.next) {
225
225
  case 0:
226
226
  tenantId = _ref7.tenantId, ntpId = _ref7.ntpId;
227
227
  ValidatePresence("tenantId", tenantId);
228
228
  ValidatePresence("ntpId", ntpId);
229
- _context4.next = 5;
229
+ _context4.next = 1;
230
230
  return this.authClient.MakeKMSCall({
231
231
  tenantId: tenantId,
232
232
  methodName: "elv_updateOTPInstance",
233
233
  params: [tenantId, ntpId, "delete", "[]", Date.now()],
234
234
  paramTypes: ["string", "string", "string", "string", "int"]
235
235
  });
236
- case 5:
236
+ case 1:
237
237
  case "end":
238
238
  return _context4.stop();
239
239
  }
@@ -256,14 +256,14 @@ exports.DeleteNTPInstance = /*#__PURE__*/function () {
256
256
  * @return {Object} - List of NTP instances along with pagination information
257
257
  */
258
258
  exports.ListNTPInstances = /*#__PURE__*/function () {
259
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref9) {
259
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref9) {
260
260
  var tenantId, _ref9$count, count, _ref9$offset, offset, _yield$this$authClien2, Defs, Total;
261
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
261
+ return _regeneratorRuntime.wrap(function (_context5) {
262
262
  while (1) switch (_context5.prev = _context5.next) {
263
263
  case 0:
264
264
  tenantId = _ref9.tenantId, _ref9$count = _ref9.count, count = _ref9$count === void 0 ? 10 : _ref9$count, _ref9$offset = _ref9.offset, offset = _ref9$offset === void 0 ? 0 : _ref9$offset;
265
265
  ValidatePresence("tenantId", tenantId);
266
- _context5.next = 4;
266
+ _context5.next = 1;
267
267
  return this.authClient.MakeKMSCall({
268
268
  tenantId: tenantId,
269
269
  methodName: "elv_listOTPInfo",
@@ -271,7 +271,7 @@ exports.ListNTPInstances = /*#__PURE__*/function () {
271
271
  paramTypes: ["string", "int", "int"],
272
272
  signature: false
273
273
  });
274
- case 4:
274
+ case 1:
275
275
  _yield$this$authClien2 = _context5.sent;
276
276
  Defs = _yield$this$authClien2.Defs;
277
277
  Total = _yield$this$authClien2.Total;
@@ -281,14 +281,14 @@ exports.ListNTPInstances = /*#__PURE__*/function () {
281
281
  end: Math.min(Total, offset + count),
282
282
  total: Total
283
283
  });
284
- case 8:
284
+ case 2:
285
285
  case "end":
286
286
  return _context5.stop();
287
287
  }
288
288
  }, _callee5, this);
289
289
  }));
290
290
  return function (_x5) {
291
- return _ref10.apply(this, arguments);
291
+ return _ref0.apply(this, arguments);
292
292
  };
293
293
  }();
294
294
 
@@ -303,16 +303,16 @@ exports.ListNTPInstances = /*#__PURE__*/function () {
303
303
  * @return {Object} - Info about the NTP instance
304
304
  */
305
305
  exports.NTPInstance = /*#__PURE__*/function () {
306
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref11) {
307
- var tenantId, ntpId;
308
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
306
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref1) {
307
+ var tenantId, ntpId, _t, _t2;
308
+ return _regeneratorRuntime.wrap(function (_context6) {
309
309
  while (1) switch (_context6.prev = _context6.next) {
310
310
  case 0:
311
- tenantId = _ref11.tenantId, ntpId = _ref11.ntpId;
311
+ tenantId = _ref1.tenantId, ntpId = _ref1.ntpId;
312
312
  ValidatePresence("tenantId", tenantId);
313
313
  ValidatePresence("ntpId", ntpId);
314
- _context6.t0 = FormatNTPInfo;
315
- _context6.next = 6;
314
+ _t = FormatNTPInfo;
315
+ _context6.next = 1;
316
316
  return this.authClient.MakeKMSCall({
317
317
  tenantId: tenantId,
318
318
  methodName: "elv_getOTPInfo",
@@ -320,17 +320,17 @@ exports.NTPInstance = /*#__PURE__*/function () {
320
320
  paramTypes: ["string", "string"],
321
321
  signature: false
322
322
  });
323
- case 6:
324
- _context6.t1 = _context6.sent;
325
- return _context6.abrupt("return", (0, _context6.t0)(_context6.t1));
326
- case 8:
323
+ case 1:
324
+ _t2 = _context6.sent;
325
+ return _context6.abrupt("return", _t(_t2));
326
+ case 2:
327
327
  case "end":
328
328
  return _context6.stop();
329
329
  }
330
330
  }, _callee6, this);
331
331
  }));
332
332
  return function (_x6) {
333
- return _ref12.apply(this, arguments);
333
+ return _ref10.apply(this, arguments);
334
334
  };
335
335
  }();
336
336
 
@@ -351,12 +351,12 @@ exports.NTPInstance = /*#__PURE__*/function () {
351
351
  * @return {Promise<Object>} - The generated ticket code and additional information about the ticket.
352
352
  */
353
353
  exports.IssueNTPCode = /*#__PURE__*/function () {
354
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref13) {
354
+ var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref11) {
355
355
  var tenantId, ntpId, email, maxRedemptions, options, params, paramTypes;
356
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
356
+ return _regeneratorRuntime.wrap(function (_context7) {
357
357
  while (1) switch (_context7.prev = _context7.next) {
358
358
  case 0:
359
- tenantId = _ref13.tenantId, ntpId = _ref13.ntpId, email = _ref13.email, maxRedemptions = _ref13.maxRedemptions;
359
+ tenantId = _ref11.tenantId, ntpId = _ref11.ntpId, email = _ref11.email, maxRedemptions = _ref11.maxRedemptions;
360
360
  ValidatePresence("tenantId", tenantId);
361
361
  ValidatePresence("ntpId", ntpId);
362
362
  options = [];
@@ -368,22 +368,22 @@ exports.IssueNTPCode = /*#__PURE__*/function () {
368
368
  }
369
369
  params = [tenantId, ntpId, JSON.stringify(options), Date.now()];
370
370
  paramTypes = ["string", "string", "string", "uint"];
371
- _context7.next = 10;
371
+ _context7.next = 1;
372
372
  return this.authClient.MakeKMSCall({
373
373
  methodName: "elv_issueOTPCode",
374
374
  params: params,
375
375
  paramTypes: paramTypes
376
376
  });
377
- case 10:
377
+ case 1:
378
378
  return _context7.abrupt("return", _context7.sent);
379
- case 11:
379
+ case 2:
380
380
  case "end":
381
381
  return _context7.stop();
382
382
  }
383
383
  }, _callee7, this);
384
384
  }));
385
385
  return function (_x7) {
386
- return _ref14.apply(this, arguments);
386
+ return _ref12.apply(this, arguments);
387
387
  };
388
388
  }();
389
389
 
@@ -404,41 +404,41 @@ exports.IssueNTPCode = /*#__PURE__*/function () {
404
404
  * @return {Promise<Object>} - The generated signed ticket code and additional information about the ticket.
405
405
  */
406
406
  exports.IssueSignedNTPCode = /*#__PURE__*/function () {
407
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref15) {
407
+ var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref13) {
408
408
  var tenantId, ntpId, email, maxRedemptions, result, signature, multiSig;
409
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
409
+ return _regeneratorRuntime.wrap(function (_context8) {
410
410
  while (1) switch (_context8.prev = _context8.next) {
411
411
  case 0:
412
- tenantId = _ref15.tenantId, ntpId = _ref15.ntpId, email = _ref15.email, maxRedemptions = _ref15.maxRedemptions;
413
- _context8.next = 3;
412
+ tenantId = _ref13.tenantId, ntpId = _ref13.ntpId, email = _ref13.email, maxRedemptions = _ref13.maxRedemptions;
413
+ _context8.next = 1;
414
414
  return this.IssueNTPCode({
415
415
  tenantId: tenantId,
416
416
  ntpId: ntpId,
417
417
  email: email,
418
418
  maxRedemptions: maxRedemptions
419
419
  });
420
- case 3:
420
+ case 1:
421
421
  result = _context8.sent;
422
422
  if (!result.token) {
423
- _context8.next = 10;
423
+ _context8.next = 3;
424
424
  break;
425
425
  }
426
- _context8.next = 7;
426
+ _context8.next = 2;
427
427
  return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(result.token)));
428
- case 7:
428
+ case 2:
429
429
  signature = _context8.sent;
430
430
  multiSig = this.utils.FormatSignature(signature);
431
431
  result.token = "".concat(result.token, ".").concat(this.utils.B64(multiSig));
432
- case 10:
432
+ case 3:
433
433
  return _context8.abrupt("return", result);
434
- case 11:
434
+ case 4:
435
435
  case "end":
436
436
  return _context8.stop();
437
437
  }
438
438
  }, _callee8, this);
439
439
  }));
440
440
  return function (_x8) {
441
- return _ref16.apply(this, arguments);
441
+ return _ref14.apply(this, arguments);
442
442
  };
443
443
  }();
444
444
 
@@ -457,12 +457,12 @@ exports.IssueSignedNTPCode = /*#__PURE__*/function () {
457
457
  * @return {Promise<string|Object>} - The object ID which the ticket is authorized to, or an object containing the object ID and NTP ID if `includeNTPId` is specified
458
458
  */
459
459
  exports.RedeemCode = /*#__PURE__*/function () {
460
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref17) {
461
- var issuer, tenantId, ntpId, code, email, _ref17$includeNTPId, includeNTPId, wallet, token, response, objectId, libraryId, Hash, codeHash, codeInfo, ak, sites, info, signer;
462
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
460
+ var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref15) {
461
+ var issuer, tenantId, ntpId, code, email, _ref15$includeNTPId, includeNTPId, wallet, token, response, objectId, libraryId, Hash, codeHash, codeInfo, ak, sites, info, signer, _t3;
462
+ return _regeneratorRuntime.wrap(function (_context9) {
463
463
  while (1) switch (_context9.prev = _context9.next) {
464
464
  case 0:
465
- issuer = _ref17.issuer, tenantId = _ref17.tenantId, ntpId = _ref17.ntpId, code = _ref17.code, email = _ref17.email, _ref17$includeNTPId = _ref17.includeNTPId, includeNTPId = _ref17$includeNTPId === void 0 ? false : _ref17$includeNTPId;
465
+ issuer = _ref15.issuer, tenantId = _ref15.tenantId, ntpId = _ref15.ntpId, code = _ref15.code, email = _ref15.email, _ref15$includeNTPId = _ref15.includeNTPId, includeNTPId = _ref15$includeNTPId === void 0 ? false : _ref15$includeNTPId;
466
466
  wallet = this.GenerateWallet();
467
467
  issuer = issuer || "";
468
468
  if (!this.signer) {
@@ -473,33 +473,33 @@ exports.RedeemCode = /*#__PURE__*/function () {
473
473
  });
474
474
  }
475
475
  if (!issuer.startsWith("iq__")) {
476
- _context9.next = 8;
476
+ _context9.next = 1;
477
477
  break;
478
478
  }
479
479
  ValidateObject(issuer);
480
- _context9.next = 28;
480
+ _context9.next = 6;
481
481
  break;
482
- case 8:
482
+ case 1:
483
483
  if (!(issuer && !issuer.replace(/^\//, "").startsWith("otp/ntp/iten"))) {
484
- _context9.next = 12;
484
+ _context9.next = 2;
485
485
  break;
486
486
  }
487
487
  throw Error("Invalid issuer: " + issuer);
488
- case 12:
488
+ case 2:
489
489
  // Ticket API
490
490
 
491
491
  ValidatePresence("issuer or tenantId", issuer || tenantId);
492
492
  if (!issuer) {
493
493
  issuer = UrlJoin("/otp", "ntp", tenantId, ntpId || "");
494
494
  }
495
- _context9.prev = 14;
496
- _context9.next = 17;
495
+ _context9.prev = 3;
496
+ _context9.next = 4;
497
497
  return this.authClient.GenerateChannelContentToken({
498
498
  issuer: issuer,
499
499
  code: code,
500
500
  email: email
501
501
  });
502
- case 17:
502
+ case 4:
503
503
  token = _context9.sent;
504
504
  this.SetStaticToken({
505
505
  token: token
@@ -509,20 +509,20 @@ exports.RedeemCode = /*#__PURE__*/function () {
509
509
  objectId: response.qid,
510
510
  ntpId: response.oid
511
511
  } : response.qid);
512
- case 23:
513
- _context9.prev = 23;
514
- _context9.t0 = _context9["catch"](14);
512
+ case 5:
513
+ _context9.prev = 5;
514
+ _t3 = _context9["catch"](3);
515
515
  this.Log("Failed to redeem code:", true);
516
- this.Log(_context9.t0, true);
517
- throw _context9.t0;
518
- case 28:
516
+ this.Log(_t3, true);
517
+ throw _t3;
518
+ case 6:
519
519
  // Site selector
520
520
  objectId = issuer;
521
- _context9.next = 31;
521
+ _context9.next = 7;
522
522
  return this.ContentObjectLibraryId({
523
523
  objectId: objectId
524
524
  });
525
- case 31:
525
+ case 7:
526
526
  libraryId = _context9.sent;
527
527
  Hash = function Hash(code) {
528
528
  var chars = code.split("").map(function (code) {
@@ -533,49 +533,49 @@ exports.RedeemCode = /*#__PURE__*/function () {
533
533
  }, 0).toString();
534
534
  };
535
535
  codeHash = Hash(code);
536
- _context9.next = 36;
536
+ _context9.next = 8;
537
537
  return this.ContentObjectMetadata({
538
538
  libraryId: libraryId,
539
539
  objectId: objectId,
540
540
  metadataSubtree: "public/codes/".concat(codeHash)
541
541
  });
542
- case 36:
542
+ case 8:
543
543
  codeInfo = _context9.sent;
544
544
  if (codeInfo) {
545
- _context9.next = 40;
545
+ _context9.next = 9;
546
546
  break;
547
547
  }
548
548
  this.Log("Code redemption failed:\n\t".concat(issuer, "\n\t").concat(code));
549
549
  throw Error("Invalid code: " + code);
550
- case 40:
550
+ case 9:
551
551
  ak = codeInfo.ak, sites = codeInfo.sites, info = codeInfo.info;
552
- _context9.next = 43;
552
+ _context9.next = 10;
553
553
  return wallet.AddAccountFromEncryptedPK({
554
554
  encryptedPrivateKey: this.utils.FromB64(ak),
555
555
  password: code
556
556
  });
557
- case 43:
557
+ case 10:
558
558
  signer = _context9.sent;
559
559
  this.SetSigner({
560
560
  signer: signer
561
561
  });
562
562
 
563
563
  // Ensure wallet is initialized
564
- _context9.next = 47;
564
+ _context9.next = 11;
565
565
  return this.userProfileClient.WalletAddress();
566
- case 47:
566
+ case 11:
567
567
  return _context9.abrupt("return", {
568
568
  addr: this.utils.FormatAddress(signer.address),
569
569
  sites: sites,
570
570
  info: info || {}
571
571
  });
572
- case 48:
572
+ case 12:
573
573
  case "end":
574
574
  return _context9.stop();
575
575
  }
576
- }, _callee9, this, [[14, 23]]);
576
+ }, _callee9, this, [[3, 5]]);
577
577
  }));
578
578
  return function (_x9) {
579
- return _ref18.apply(this, arguments);
579
+ return _ref16.apply(this, arguments);
580
580
  };
581
581
  }();