@eluvio/elv-client-js 4.0.147 → 4.2.0

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 (47) hide show
  1. package/dist/ElvClient-min.js +2 -67
  2. package/dist/ElvClient-min.js.LICENSE.txt +72 -0
  3. package/dist/ElvClient-node-min.js +2 -66
  4. package/dist/ElvClient-node-min.js.LICENSE.txt +72 -0
  5. package/dist/ElvFrameClient-min.js +2 -60
  6. package/dist/ElvFrameClient-min.js.LICENSE.txt +72 -0
  7. package/dist/ElvPermissionsClient-min.js +2 -60
  8. package/dist/ElvPermissionsClient-min.js.LICENSE.txt +72 -0
  9. package/dist/ElvWalletClient-min.js +2 -67
  10. package/dist/ElvWalletClient-min.js.LICENSE.txt +72 -0
  11. package/dist/ElvWalletClient-node-min.js +2 -66
  12. package/dist/ElvWalletClient-node-min.js.LICENSE.txt +72 -0
  13. package/dist/src/AuthorizationClient.js +713 -715
  14. package/dist/src/ContentObjectAudit.js +59 -59
  15. package/dist/src/Crypto.js +85 -86
  16. package/dist/src/ElvClient.js +532 -501
  17. package/dist/src/ElvWallet.js +30 -28
  18. package/dist/src/EthClient.js +316 -316
  19. package/dist/src/FrameClient.js +70 -71
  20. package/dist/src/HttpClient.js +60 -60
  21. package/dist/src/Id.js +1 -2
  22. package/dist/src/PermissionsClient.js +501 -489
  23. package/dist/src/RemoteSigner.js +83 -84
  24. package/dist/src/UserProfileClient.js +392 -374
  25. package/dist/src/Utils.js +67 -67
  26. package/dist/src/Validation.js +20 -12
  27. package/dist/src/client/ABRPublishing.js +412 -356
  28. package/dist/src/client/AccessGroups.js +479 -476
  29. package/dist/src/client/ContentAccess.js +1750 -1804
  30. package/dist/src/client/ContentManagement.js +874 -874
  31. package/dist/src/client/Contracts.js +586 -590
  32. package/dist/src/client/Files.js +702 -686
  33. package/dist/src/client/LiveConf.js +3 -5
  34. package/dist/src/client/LiveStream.js +659 -652
  35. package/dist/src/client/NFT.js +16 -16
  36. package/dist/src/client/NTP.js +84 -84
  37. package/dist/src/client/Shares.js +51 -51
  38. package/dist/src/walletClient/ClientMethods.js +979 -953
  39. package/dist/src/walletClient/Notifications.js +14 -14
  40. package/dist/src/walletClient/Profile.js +68 -68
  41. package/dist/src/walletClient/Utils.js +17 -17
  42. package/dist/src/walletClient/index.js +574 -564
  43. package/package.json +17 -16
  44. package/src/client/AccessGroups.js +1 -1
  45. package/testScripts/Test.js +5 -1
  46. package/webpack.config.js +10 -13
  47. package/dist/src/ContentObjectVerification.js +0 -281
@@ -3,9 +3,8 @@ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
3
3
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
4
4
  var _createClass = require("@babel/runtime/helpers/createClass");
5
5
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
6
- var _v, _v2;
7
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
8
  var HttpClient = require("./HttpClient");
10
9
  var Ethers = require("ethers");
11
10
  var Utils = require("./Utils");
@@ -38,8 +37,8 @@ var ACCESS_TYPES = {
38
37
  OTHER: "other"
39
38
  };
40
39
  var CONTRACTS = {
41
- v2: (_v = {}, _defineProperty(_v, ACCESS_TYPES.SPACE, require("./contracts/v2/BaseContentSpace")), _defineProperty(_v, ACCESS_TYPES.LIBRARY, require("./contracts/v2/BaseLibrary")), _defineProperty(_v, ACCESS_TYPES.TYPE, require("./contracts/v2/BaseContentType")), _defineProperty(_v, ACCESS_TYPES.OBJECT, require("./contracts/v2/BaseContent")), _defineProperty(_v, ACCESS_TYPES.WALLET, require("./contracts/v2/BaseAccessWallet")), _defineProperty(_v, ACCESS_TYPES.GROUP, require("./contracts/v2/BaseAccessControlGroup")), _defineProperty(_v, ACCESS_TYPES.ACCESSIBLE, require("./contracts/v2/Accessible")), _defineProperty(_v, ACCESS_TYPES.EDITABLE, require("./contracts/v2/Editable")), _v),
42
- v3: (_v2 = {}, _defineProperty(_v2, ACCESS_TYPES.SPACE, require("./contracts/v3/BaseContentSpace")), _defineProperty(_v2, ACCESS_TYPES.LIBRARY, require("./contracts/v3/BaseLibrary")), _defineProperty(_v2, ACCESS_TYPES.TYPE, require("./contracts/v3/BaseContentType")), _defineProperty(_v2, ACCESS_TYPES.OBJECT, require("./contracts/v3/BaseContent")), _defineProperty(_v2, ACCESS_TYPES.WALLET, require("./contracts/v3/BaseAccessWallet")), _defineProperty(_v2, ACCESS_TYPES.GROUP, require("./contracts/v3/BaseAccessControlGroup")), _defineProperty(_v2, ACCESS_TYPES.ACCESSIBLE, require("./contracts/v3/Accessible")), _defineProperty(_v2, ACCESS_TYPES.EDITABLE, require("./contracts/v3/Editable")), _defineProperty(_v2, ACCESS_TYPES.TENANT, require("./contracts/v3/BaseTenantSpace")), _v2),
40
+ v2: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ACCESS_TYPES.SPACE, require("./contracts/v2/BaseContentSpace")), ACCESS_TYPES.LIBRARY, require("./contracts/v2/BaseLibrary")), ACCESS_TYPES.TYPE, require("./contracts/v2/BaseContentType")), ACCESS_TYPES.OBJECT, require("./contracts/v2/BaseContent")), ACCESS_TYPES.WALLET, require("./contracts/v2/BaseAccessWallet")), ACCESS_TYPES.GROUP, require("./contracts/v2/BaseAccessControlGroup")), ACCESS_TYPES.ACCESSIBLE, require("./contracts/v2/Accessible")), ACCESS_TYPES.EDITABLE, require("./contracts/v2/Editable")),
41
+ v3: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ACCESS_TYPES.SPACE, require("./contracts/v3/BaseContentSpace")), ACCESS_TYPES.LIBRARY, require("./contracts/v3/BaseLibrary")), ACCESS_TYPES.TYPE, require("./contracts/v3/BaseContentType")), ACCESS_TYPES.OBJECT, require("./contracts/v3/BaseContent")), ACCESS_TYPES.WALLET, require("./contracts/v3/BaseAccessWallet")), ACCESS_TYPES.GROUP, require("./contracts/v3/BaseAccessControlGroup")), ACCESS_TYPES.ACCESSIBLE, require("./contracts/v3/Accessible")), ACCESS_TYPES.EDITABLE, require("./contracts/v3/Editable")), ACCESS_TYPES.TENANT, require("./contracts/v3/BaseTenantSpace")),
43
42
  v3b: _defineProperty({}, ACCESS_TYPES.GROUP, require("./contracts/v3b/BaseAccessControlGroup"))
44
43
  };
45
44
  var AuthorizationClient = /*#__PURE__*/function () {
@@ -77,7 +76,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
77
76
  }
78
77
 
79
78
  // Return authorization token in appropriate headers
80
- _createClass(AuthorizationClient, [{
79
+ return _createClass(AuthorizationClient, [{
81
80
  key: "Log",
82
81
  value: function Log(message) {
83
82
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -86,14 +85,14 @@ var AuthorizationClient = /*#__PURE__*/function () {
86
85
  }, {
87
86
  key: "AuthorizationHeader",
88
87
  value: function () {
89
- var _AuthorizationHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
88
+ var _AuthorizationHeader = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
90
89
  var authorizationToken, headers;
91
- return _regeneratorRuntime.wrap(function _callee$(_context) {
90
+ return _regeneratorRuntime.wrap(function (_context) {
92
91
  while (1) switch (_context.prev = _context.next) {
93
92
  case 0:
94
- _context.next = 2;
93
+ _context.next = 1;
95
94
  return this.AuthorizationToken(params);
96
- case 2:
95
+ case 1:
97
96
  authorizationToken = _context.sent;
98
97
  headers = {
99
98
  Authorization: "Bearer " + authorizationToken
@@ -102,7 +101,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
102
101
  headers["X-Content-Fabric-Encryption-Scheme"] = params.encryption;
103
102
  }
104
103
  return _context.abrupt("return", headers);
105
- case 6:
104
+ case 2:
106
105
  case "end":
107
106
  return _context.stop();
108
107
  }
@@ -116,60 +115,60 @@ var AuthorizationClient = /*#__PURE__*/function () {
116
115
  }, {
117
116
  key: "AuthorizationToken",
118
117
  value: function () {
119
- var _AuthorizationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
120
- var libraryId, objectId, versionHash, partHash, encryption, audienceData, context, _ref2$update, update, _ref2$makeAccessReque, makeAccessRequest, _ref2$channelAuth, channelAuth, oauthToken, _ref2$noCache, noCache, _ref2$noAuth, noAuth, isWalletRequest, initialNoCache, authorizationToken;
121
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
118
+ var _AuthorizationToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
119
+ var libraryId, objectId, versionHash, partHash, encryption, audienceData, context, _ref2$update, update, _ref2$makeAccessReque, makeAccessRequest, _ref2$channelAuth, channelAuth, oauthToken, _ref2$noCache, noCache, _ref2$noAuth, noAuth, isWalletRequest, initialNoCache, authorizationToken, _t, _t2, _t3, _t4, _t5;
120
+ return _regeneratorRuntime.wrap(function (_context2) {
122
121
  while (1) switch (_context2.prev = _context2.next) {
123
122
  case 0:
124
123
  libraryId = _ref2.libraryId, objectId = _ref2.objectId, versionHash = _ref2.versionHash, partHash = _ref2.partHash, encryption = _ref2.encryption, audienceData = _ref2.audienceData, context = _ref2.context, _ref2$update = _ref2.update, update = _ref2$update === void 0 ? false : _ref2$update, _ref2$makeAccessReque = _ref2.makeAccessRequest, makeAccessRequest = _ref2$makeAccessReque === void 0 ? false : _ref2$makeAccessReque, _ref2$channelAuth = _ref2.channelAuth, channelAuth = _ref2$channelAuth === void 0 ? false : _ref2$channelAuth, oauthToken = _ref2.oauthToken, _ref2$noCache = _ref2.noCache, noCache = _ref2$noCache === void 0 ? false : _ref2$noCache, _ref2$noAuth = _ref2.noAuth, noAuth = _ref2$noAuth === void 0 ? false : _ref2$noAuth;
125
124
  if (versionHash) {
126
125
  objectId = this.client.utils.DecodeVersionHash(versionHash).objectId;
127
126
  }
128
- _context2.t0 = objectId && this.client.signer && !this.client.signer.anonymous;
129
- if (!_context2.t0) {
130
- _context2.next = 10;
127
+ _t = objectId && this.client.signer && !this.client.signer.anonymous;
128
+ if (!_t) {
129
+ _context2.next = 2;
131
130
  break;
132
131
  }
133
- _context2.t1 = this.client.utils;
134
- _context2.next = 7;
132
+ _t2 = this.client.utils;
133
+ _context2.next = 1;
135
134
  return this.client.userProfileClient.WalletAddress(false);
136
- case 7:
137
- _context2.t2 = _context2.sent;
138
- _context2.t3 = this.client.utils.HashToAddress(objectId);
139
- _context2.t0 = _context2.t1.EqualAddress.call(_context2.t1, _context2.t2, _context2.t3);
140
- case 10:
141
- isWalletRequest = _context2.t0;
135
+ case 1:
136
+ _t3 = _context2.sent;
137
+ _t4 = this.client.utils.HashToAddress(objectId);
138
+ _t = _t2.EqualAddress.call(_t2, _t3, _t4);
139
+ case 2:
140
+ isWalletRequest = _t;
142
141
  if (!(this.client.staticToken && !isWalletRequest && !update)) {
143
- _context2.next = 15;
142
+ _context2.next = 3;
144
143
  break;
145
144
  }
146
145
  return _context2.abrupt("return", this.client.staticToken);
147
- case 15:
146
+ case 3:
148
147
  if (!(this.client.staticUpdateToken && !isWalletRequest)) {
149
- _context2.next = 17;
148
+ _context2.next = 4;
150
149
  break;
151
150
  }
152
151
  return _context2.abrupt("return", this.client.staticUpdateToken);
153
- case 17:
152
+ case 4:
154
153
  initialNoCache = this.noCache;
155
- _context2.prev = 18;
154
+ _context2.prev = 5;
156
155
  // noCache enabled for this call
157
156
  if (noCache && !this.noCache) {
158
157
  this.noCache = true;
159
158
  }
160
159
  if (!(channelAuth && this.client.signer && this.client.signer.remoteSigner)) {
161
- _context2.next = 22;
160
+ _context2.next = 6;
162
161
  break;
163
162
  }
164
163
  return _context2.abrupt("return", this.client.CreateFabricToken({
165
164
  context: context
166
165
  }));
167
- case 22:
166
+ case 6:
168
167
  if (!channelAuth) {
169
- _context2.next = 28;
168
+ _context2.next = 8;
170
169
  break;
171
170
  }
172
- _context2.next = 25;
171
+ _context2.next = 7;
173
172
  return this.GenerateChannelContentToken({
174
173
  objectId: objectId,
175
174
  versionHash: versionHash,
@@ -177,20 +176,20 @@ var AuthorizationClient = /*#__PURE__*/function () {
177
176
  context: context,
178
177
  oauthToken: oauthToken
179
178
  });
180
- case 25:
179
+ case 7:
181
180
  authorizationToken = _context2.sent;
182
- _context2.next = 33;
181
+ _context2.next = 11;
183
182
  break;
184
- case 28:
183
+ case 8:
185
184
  if (!(noAuth && this.client.signer && this.client.signer.remoteSigner && this.client.signer.unsignedPublicAuth)) {
186
- _context2.next = 30;
185
+ _context2.next = 9;
187
186
  break;
188
187
  }
189
188
  return _context2.abrupt("return", this.client.CreateStaticToken({
190
189
  libraryId: libraryId
191
190
  }));
192
- case 30:
193
- _context2.next = 32;
191
+ case 9:
192
+ _context2.next = 10;
194
193
  return this.GenerateAuthorizationToken({
195
194
  libraryId: libraryId,
196
195
  objectId: objectId,
@@ -200,23 +199,23 @@ var AuthorizationClient = /*#__PURE__*/function () {
200
199
  update: update,
201
200
  makeAccessRequest: makeAccessRequest
202
201
  });
203
- case 32:
202
+ case 10:
204
203
  authorizationToken = _context2.sent;
205
- case 33:
204
+ case 11:
206
205
  return _context2.abrupt("return", authorizationToken);
207
- case 36:
208
- _context2.prev = 36;
209
- _context2.t4 = _context2["catch"](18);
210
- throw _context2.t4;
211
- case 39:
212
- _context2.prev = 39;
206
+ case 12:
207
+ _context2.prev = 12;
208
+ _t5 = _context2["catch"](5);
209
+ throw _t5;
210
+ case 13:
211
+ _context2.prev = 13;
213
212
  this.noCache = initialNoCache;
214
- return _context2.finish(39);
215
- case 42:
213
+ return _context2.finish(13);
214
+ case 14:
216
215
  case "end":
217
216
  return _context2.stop();
218
217
  }
219
- }, _callee2, this, [[18, 36, 39, 42]]);
218
+ }, _callee2, this, [[5, 12, 13, 14]]);
220
219
  }));
221
220
  function AuthorizationToken(_x2) {
222
221
  return _AuthorizationToken.apply(this, arguments);
@@ -226,9 +225,9 @@ var AuthorizationClient = /*#__PURE__*/function () {
226
225
  }, {
227
226
  key: "GenerateAuthorizationToken",
228
227
  value: function () {
229
- var _GenerateAuthorizationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
230
- var libraryId, objectId, versionHash, partHash, encryption, _ref3$update, update, _ref3$makeAccessReque, makeAccessRequest, publicKey, owner, ownerCapKey, ownerCap, cap, token, _yield$this$MakeAcces, transactionHash, signature, multiSig;
231
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
228
+ var _GenerateAuthorizationToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
229
+ var libraryId, objectId, versionHash, partHash, encryption, _ref3$update, update, _ref3$makeAccessReque, makeAccessRequest, publicKey, owner, ownerCapKey, ownerCap, cap, token, _yield$this$MakeAcces, transactionHash, signature, multiSig, _t6, _t7, _t8;
230
+ return _regeneratorRuntime.wrap(function (_context3) {
232
231
  while (1) switch (_context3.prev = _context3.next) {
233
232
  case 0:
234
233
  libraryId = _ref3.libraryId, objectId = _ref3.objectId, versionHash = _ref3.versionHash, partHash = _ref3.partHash, encryption = _ref3.encryption, _ref3$update = _ref3.update, update = _ref3$update === void 0 ? false : _ref3$update, _ref3$makeAccessReque = _ref3.makeAccessRequest, makeAccessRequest = _ref3$makeAccessReque === void 0 ? false : _ref3$makeAccessReque;
@@ -237,60 +236,60 @@ var AuthorizationClient = /*#__PURE__*/function () {
237
236
  }
238
237
 
239
238
  // Generate AFGH public key if encryption is specified
240
- _context3.t0 = encryption && encryption !== "none" && objectId;
241
- if (!_context3.t0) {
242
- _context3.next = 9;
239
+ _t6 = encryption && encryption !== "none" && objectId;
240
+ if (!_t6) {
241
+ _context3.next = 2;
243
242
  break;
244
243
  }
245
- _context3.next = 6;
244
+ _context3.next = 1;
246
245
  return this.AccessType(objectId);
247
- case 6:
248
- _context3.t1 = _context3.sent;
249
- _context3.t2 = ACCESS_TYPES.OBJECT;
250
- _context3.t0 = _context3.t1 === _context3.t2;
251
- case 9:
252
- if (!_context3.t0) {
253
- _context3.next = 22;
246
+ case 1:
247
+ _t7 = _context3.sent;
248
+ _t8 = ACCESS_TYPES.OBJECT;
249
+ _t6 = _t7 === _t8;
250
+ case 2:
251
+ if (!_t6) {
252
+ _context3.next = 6;
254
253
  break;
255
254
  }
256
- _context3.next = 12;
255
+ _context3.next = 3;
257
256
  return this.Owner({
258
257
  id: objectId
259
258
  });
260
- case 12:
259
+ case 3:
261
260
  owner = _context3.sent;
262
261
  ownerCapKey = "eluv.caps.iusr".concat(Utils.AddressToHash(this.client.signer.address));
263
- _context3.next = 16;
262
+ _context3.next = 4;
264
263
  return this.client.ContentObjectMetadata({
265
264
  libraryId: libraryId,
266
265
  objectId: objectId,
267
266
  versionHash: versionHash,
268
267
  metadataSubtree: ownerCapKey
269
268
  });
270
- case 16:
269
+ case 4:
271
270
  ownerCap = _context3.sent;
272
271
  if (!(!Utils.EqualAddress(owner, this.client.signer.address) && !ownerCap)) {
273
- _context3.next = 22;
272
+ _context3.next = 6;
274
273
  break;
275
274
  }
276
- _context3.next = 20;
275
+ _context3.next = 5;
277
276
  return this.ReEncryptionConk({
278
277
  libraryId: libraryId,
279
278
  objectId: objectId
280
279
  });
281
- case 20:
280
+ case 5:
282
281
  cap = _context3.sent;
283
282
  publicKey = cap.public_key;
284
- case 22:
283
+ case 6:
285
284
  token = {
286
285
  qspace_id: this.contentSpaceId,
287
286
  addr: Utils.FormatAddress(this.client.signer && this.client.signer.address || "")
288
287
  };
289
288
  if (!(update || makeAccessRequest)) {
290
- _context3.next = 29;
289
+ _context3.next = 8;
291
290
  break;
292
291
  }
293
- _context3.next = 26;
292
+ _context3.next = 7;
294
293
  return this.MakeAccessRequest({
295
294
  libraryId: libraryId,
296
295
  objectId: objectId,
@@ -299,13 +298,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
299
298
  publicKey: publicKey,
300
299
  noCache: this.noCache
301
300
  });
302
- case 26:
301
+ case 7:
303
302
  _yield$this$MakeAcces = _context3.sent;
304
303
  transactionHash = _yield$this$MakeAcces.transactionHash;
305
304
  if (transactionHash) {
306
305
  token.tx_id = transactionHash;
307
306
  }
308
- case 29:
307
+ case 8:
309
308
  if (libraryId) {
310
309
  token.qlib_id = libraryId;
311
310
  }
@@ -316,13 +315,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
316
315
  token.afgh_pk = publicKey;
317
316
  }
318
317
  token = Utils.B64(JSON.stringify(token));
319
- _context3.next = 35;
318
+ _context3.next = 9;
320
319
  return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(token)));
321
- case 35:
320
+ case 9:
322
321
  signature = _context3.sent;
323
322
  multiSig = Utils.FormatSignature(signature);
324
323
  return _context3.abrupt("return", "".concat(token, ".").concat(Utils.B64(multiSig)));
325
- case 38:
324
+ case 10:
326
325
  case "end":
327
326
  return _context3.stop();
328
327
  }
@@ -336,61 +335,61 @@ var AuthorizationClient = /*#__PURE__*/function () {
336
335
  }, {
337
336
  key: "MakeAccessRequest",
338
337
  value: function () {
339
- var _MakeAccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
338
+ var _MakeAccessRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
340
339
  var _this = this;
341
- var libraryId, objectId, versionHash, _ref4$args, args, _ref4$publicKey, publicKey, _ref4$update, update, _ref4$skipCache, skipCache, _ref4$noCache, noCache, cacheOnly, walletContractAddress, walletCreated, id, _yield$this$ContractI, isV3, accessType, abi, _yield$this$AccessInf, accessArgs, checkAccessCharge, address, elapsed, _cache, accessRequest, cache;
342
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
340
+ var libraryId, objectId, versionHash, _ref4$args, args, _ref4$publicKey, publicKey, _ref4$update, update, _ref4$skipCache, skipCache, _ref4$noCache, noCache, cacheOnly, walletContractAddress, walletCreated, id, _yield$this$ContractI, isV3, accessType, abi, _yield$this$AccessInf, accessArgs, checkAccessCharge, address, elapsed, _cache, accessRequest, cache, _t9, _t0;
341
+ return _regeneratorRuntime.wrap(function (_context4) {
343
342
  while (1) switch (_context4.prev = _context4.next) {
344
343
  case 0:
345
344
  libraryId = _ref4.libraryId, objectId = _ref4.objectId, versionHash = _ref4.versionHash, _ref4$args = _ref4.args, args = _ref4$args === void 0 ? [] : _ref4$args, _ref4$publicKey = _ref4.publicKey, publicKey = _ref4$publicKey === void 0 ? "" : _ref4$publicKey, _ref4$update = _ref4.update, update = _ref4$update === void 0 ? false : _ref4$update, _ref4$skipCache = _ref4.skipCache, skipCache = _ref4$skipCache === void 0 ? false : _ref4$skipCache, _ref4$noCache = _ref4.noCache, noCache = _ref4$noCache === void 0 ? false : _ref4$noCache, cacheOnly = _ref4.cacheOnly;
346
345
  if (this.client.signer) {
347
- _context4.next = 3;
346
+ _context4.next = 1;
348
347
  break;
349
348
  }
350
349
  return _context4.abrupt("return", {
351
350
  transactionHash: ""
352
351
  });
353
- case 3:
354
- _context4.next = 5;
352
+ case 1:
353
+ _context4.next = 2;
355
354
  return this.client.userProfileClient.UserWalletAddress({
356
355
  address: this.client.signer.address
357
356
  });
358
- case 5:
357
+ case 2:
359
358
  walletContractAddress = _context4.sent;
360
359
  if (walletContractAddress) {
361
- _context4.next = 12;
360
+ _context4.next = 4;
362
361
  break;
363
362
  }
364
- _context4.next = 9;
363
+ _context4.next = 3;
365
364
  return this.client.userProfileClient.WalletAddress();
366
- case 9:
365
+ case 3:
367
366
  walletCreated = _context4.sent;
368
367
  if (walletCreated) {
369
- _context4.next = 12;
368
+ _context4.next = 4;
370
369
  break;
371
370
  }
372
371
  throw Error("User wallet contract is required to make access requests");
373
- case 12:
372
+ case 4:
374
373
  if (versionHash) {
375
374
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
376
375
  }
377
376
  id = objectId || libraryId || this.contentSpaceId;
378
- _context4.next = 16;
377
+ _context4.next = 5;
379
378
  return this.ContractInfo({
380
379
  id: id
381
380
  });
382
- case 16:
381
+ case 5:
383
382
  _yield$this$ContractI = _context4.sent;
384
383
  isV3 = _yield$this$ContractI.isV3;
385
384
  accessType = _yield$this$ContractI.accessType;
386
385
  abi = _yield$this$ContractI.abi;
387
386
  if (!(typeof accessType === "undefined")) {
388
- _context4.next = 22;
387
+ _context4.next = 6;
389
388
  break;
390
389
  }
391
390
  throw Error("Unable to determine contract info for ".concat(id, " (").concat(this.client.utils.HashToAddress(id), ") - Wrong network?"));
392
- case 22:
393
- _context4.next = 24;
391
+ case 6:
392
+ _context4.next = 7;
394
393
  return this.AccessInfo({
395
394
  accessType: accessType,
396
395
  publicKey: publicKey,
@@ -398,102 +397,102 @@ var AuthorizationClient = /*#__PURE__*/function () {
398
397
  args: args,
399
398
  isV3: isV3
400
399
  });
401
- case 24:
400
+ case 7:
402
401
  _yield$this$AccessInf = _context4.sent;
403
402
  accessArgs = _yield$this$AccessInf.accessArgs;
404
403
  checkAccessCharge = _yield$this$AccessInf.checkAccessCharge;
405
404
  address = Utils.HashToAddress(id);
406
405
  elapsed = 0;
407
- case 29:
406
+ case 8:
408
407
  if (!this.transactionLocks[id]) {
409
- _context4.next = 36;
408
+ _context4.next = 10;
410
409
  break;
411
410
  }
412
- _context4.next = 32;
411
+ _context4.next = 9;
413
412
  return new Promise(function (resolve) {
414
413
  return setTimeout(resolve, 100);
415
414
  });
416
- case 32:
415
+ case 9:
417
416
  elapsed += 100;
418
417
  if (elapsed > 15000) {
419
418
  this.Log("Lock never released for ".concat(id, " - releasing lock"));
420
419
  delete this.transactionLocks[id];
421
420
  }
422
- _context4.next = 29;
421
+ _context4.next = 8;
423
422
  break;
424
- case 36:
425
- _context4.prev = 36;
423
+ case 10:
424
+ _context4.prev = 10;
426
425
  this.transactionLocks[id] = true;
427
426
 
428
427
  // Check cache for existing transaction
429
428
  if (!(!noCache && !skipCache)) {
430
- _context4.next = 46;
429
+ _context4.next = 12;
431
430
  break;
432
431
  }
433
432
  _cache = update ? this.modifyTransactions : this.accessTransactions;
434
433
  if (!_cache[address]) {
435
- _context4.next = 46;
434
+ _context4.next = 12;
436
435
  break;
437
436
  }
438
437
  if (!(_cache[address].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
439
- _context4.next = 45;
438
+ _context4.next = 11;
440
439
  break;
441
440
  }
442
441
  return _context4.abrupt("return", _cache[address]);
443
- case 45:
442
+ case 11:
444
443
  // Token expired
445
444
  delete _cache[address];
446
- case 46:
445
+ case 12:
447
446
  if (!cacheOnly) {
448
- _context4.next = 48;
447
+ _context4.next = 13;
449
448
  break;
450
449
  }
451
450
  return _context4.abrupt("return");
452
- case 48:
453
- _context4.prev = 48;
451
+ case 13:
452
+ _context4.prev = 13;
454
453
  if (!update) {
455
- _context4.next = 56;
454
+ _context4.next = 15;
456
455
  break;
457
456
  }
458
457
  this.Log("Making update request on ".concat(accessType, " ").concat(id));
459
- _context4.next = 53;
458
+ _context4.next = 14;
460
459
  return this.UpdateRequest({
461
460
  id: id,
462
461
  abi: abi
463
462
  });
464
- case 53:
463
+ case 14:
465
464
  accessRequest = _context4.sent;
466
- _context4.next = 60;
465
+ _context4.next = 17;
467
466
  break;
468
- case 56:
467
+ case 15:
469
468
  this.Log("Making access request on ".concat(accessType, " ").concat(id));
470
- _context4.next = 59;
469
+ _context4.next = 16;
471
470
  return this.AccessRequest({
472
471
  id: id,
473
472
  args: accessArgs,
474
473
  checkAccessCharge: checkAccessCharge
475
474
  });
476
- case 59:
475
+ case 16:
477
476
  accessRequest = _context4.sent;
478
- case 60:
479
- _context4.next = 69;
477
+ case 17:
478
+ _context4.next = 20;
480
479
  break;
481
- case 62:
482
- _context4.prev = 62;
483
- _context4.t0 = _context4["catch"](48);
484
- if (!_context4.t0.message.includes("UNPREDICTABLE_GAS_LIMIT")) {
485
- _context4.next = 67;
480
+ case 18:
481
+ _context4.prev = 18;
482
+ _t9 = _context4["catch"](13);
483
+ if (!_t9.message.includes("UNPREDICTABLE_GAS_LIMIT")) {
484
+ _context4.next = 19;
486
485
  break;
487
486
  }
488
- this.Log("Permission denied for ".concat(id, ": ").concat(_context4.t0.message));
487
+ this.Log("Permission denied for ".concat(id, ": ").concat(_t9.message));
489
488
  throw Error("Permission denied for ".concat(Utils.FormatAddress(this.client.signer.address), " on ").concat(id, " or \n ").concat(Utils.FormatAddress(this.client.signer.address), " have insufficient funds"));
490
- case 67:
489
+ case 19:
491
490
  // Handle other unexpected errors
492
- this.Log("Error during request for ".concat(id, ": ").concat(_context4.t0.message));
493
- throw _context4.t0;
494
- case 69:
491
+ this.Log("Error during request for ".concat(id, ": ").concat(_t9.message));
492
+ throw _t9;
493
+ case 20:
495
494
  cache = update ? this.modifyTransactions : this.accessTransactions;
496
- _context4.prev = 70;
495
+ _context4.prev = 21;
497
496
  if (!noCache) {
498
497
  cache[address] = {
499
498
  issuedAt: Date.now(),
@@ -509,22 +508,22 @@ var AuthorizationClient = /*#__PURE__*/function () {
509
508
  });
510
509
  }
511
510
  return _context4.abrupt("return", accessRequest);
512
- case 75:
513
- _context4.prev = 75;
514
- _context4.t1 = _context4["catch"](70);
511
+ case 22:
512
+ _context4.prev = 22;
513
+ _t0 = _context4["catch"](21);
515
514
  if (!noCache) {
516
515
  delete cache[address];
517
516
  }
518
- throw _context4.t1;
519
- case 79:
520
- _context4.prev = 79;
517
+ throw _t0;
518
+ case 23:
519
+ _context4.prev = 23;
521
520
  delete this.transactionLocks[id];
522
- return _context4.finish(79);
523
- case 82:
521
+ return _context4.finish(23);
522
+ case 24:
524
523
  case "end":
525
524
  return _context4.stop();
526
525
  }
527
- }, _callee4, this, [[36,, 79, 82], [48, 62], [70, 75]]);
526
+ }, _callee4, this, [[10,, 23, 24], [13, 18], [21, 22]]);
528
527
  }));
529
528
  function MakeAccessRequest(_x4) {
530
529
  return _MakeAccessRequest.apply(this, arguments);
@@ -534,17 +533,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
534
533
  }, {
535
534
  key: "AccessRequest",
536
535
  value: function () {
537
- var _AccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
538
- var id, _ref5$args, args, _ref5$checkAccessChar, checkAccessCharge, _yield$this$ContractI2, isV3, accessType, abi, accessCharge, owner, accessChargeArgs, event, methodName, contractAddress;
539
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
536
+ var _AccessRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
537
+ var id, _ref5$args, args, _ref5$checkAccessChar, checkAccessCharge, _yield$this$ContractI2, isV3, accessType, abi, accessCharge, owner, accessChargeArgs, event, methodName, contractAddress, _t1, _t10, _t11;
538
+ return _regeneratorRuntime.wrap(function (_context5) {
540
539
  while (1) switch (_context5.prev = _context5.next) {
541
540
  case 0:
542
541
  id = _ref5.id, _ref5$args = _ref5.args, args = _ref5$args === void 0 ? [] : _ref5$args, _ref5$checkAccessChar = _ref5.checkAccessCharge, checkAccessCharge = _ref5$checkAccessChar === void 0 ? false : _ref5$checkAccessChar;
543
- _context5.next = 3;
542
+ _context5.next = 1;
544
543
  return this.ContractInfo({
545
544
  id: id
546
545
  });
547
- case 3:
546
+ case 1:
548
547
  _yield$this$ContractI2 = _context5.sent;
549
548
  isV3 = _yield$this$ContractI2.isV3;
550
549
  accessType = _yield$this$ContractI2.accessType;
@@ -552,43 +551,43 @@ var AuthorizationClient = /*#__PURE__*/function () {
552
551
  // Send some bux if access charge is required
553
552
  accessCharge = 0;
554
553
  if (!(checkAccessCharge && accessType === ACCESS_TYPES.OBJECT)) {
555
- _context5.next = 27;
554
+ _context5.next = 6;
556
555
  break;
557
556
  }
558
- _context5.next = 11;
557
+ _context5.next = 2;
559
558
  return this.Owner({
560
559
  id: id,
561
560
  abi: abi
562
561
  });
563
- case 11:
562
+ case 2:
564
563
  owner = _context5.sent;
565
564
  if (Utils.EqualAddress(this.client.signer.address, owner)) {
566
- _context5.next = 27;
565
+ _context5.next = 6;
567
566
  break;
568
567
  }
569
- _context5.prev = 13;
568
+ _context5.prev = 3;
570
569
  // Extract level, custom values and stakeholders from accessRequest arguments
571
570
  accessChargeArgs = isV3 ? [0, [], []] : [args[0], args[3], args[4]]; // Access charge is in wei, but methods take ether - convert to charge to ether
572
- _context5.t0 = Utils;
573
- _context5.next = 18;
571
+ _t1 = Utils;
572
+ _context5.next = 4;
574
573
  return this.GetAccessCharge({
575
574
  objectId: id,
576
575
  args: accessChargeArgs
577
576
  });
578
- case 18:
579
- _context5.t1 = _context5.sent;
580
- accessCharge = _context5.t0.WeiToEther.call(_context5.t0, _context5.t1);
577
+ case 4:
578
+ _t10 = _context5.sent;
579
+ accessCharge = _t1.WeiToEther.call(_t1, _t10);
581
580
  if (isNaN(accessCharge) || !accessCharge) {
582
581
  accessCharge = 0;
583
582
  }
584
- _context5.next = 27;
583
+ _context5.next = 6;
585
584
  break;
586
- case 23:
587
- _context5.prev = 23;
588
- _context5.t2 = _context5["catch"](13);
585
+ case 5:
586
+ _context5.prev = 5;
587
+ _t11 = _context5["catch"](3);
589
588
  this.Log("Failed to get access charge for", id);
590
- this.Log(_context5.t2);
591
- case 27:
589
+ this.Log(_t11);
590
+ case 6:
592
591
  if (accessCharge > 0) {
593
592
  this.Log("Access charge: ".concat(accessCharge));
594
593
  }
@@ -598,15 +597,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
598
597
  } else {
599
598
  methodName = "accessRequest";
600
599
  }
601
- _context5.next = 32;
600
+ _context5.next = 7;
602
601
  return this.ContractHasMethod({
603
602
  contractAddress: contractAddress,
604
603
  abi: abi,
605
604
  methodName: methodName
606
605
  });
607
- case 32:
606
+ case 7:
608
607
  if (_context5.sent) {
609
- _context5.next = 35;
608
+ _context5.next = 8;
610
609
  break;
611
610
  }
612
611
  this.Log("".concat(accessType, " ").concat(id, " has no ").concat(methodName, " method. Skipping"));
@@ -614,8 +613,8 @@ var AuthorizationClient = /*#__PURE__*/function () {
614
613
  transactionHash: "",
615
614
  logs: []
616
615
  });
617
- case 35:
618
- _context5.next = 37;
616
+ case 8:
617
+ _context5.next = 9;
619
618
  return this.client.CallContractMethodAndWait({
620
619
  contractAddress: contractAddress,
621
620
  abi: abi,
@@ -623,20 +622,20 @@ var AuthorizationClient = /*#__PURE__*/function () {
623
622
  methodArgs: args,
624
623
  value: accessCharge
625
624
  });
626
- case 37:
625
+ case 9:
627
626
  event = _context5.sent;
628
627
  if (!(event.logs.length === 0)) {
629
- _context5.next = 40;
628
+ _context5.next = 10;
630
629
  break;
631
630
  }
632
631
  throw Error("Access denied (".concat(id, ")"));
633
- case 40:
632
+ case 10:
634
633
  return _context5.abrupt("return", event);
635
- case 41:
634
+ case 11:
636
635
  case "end":
637
636
  return _context5.stop();
638
637
  }
639
- }, _callee5, this, [[13, 23]]);
638
+ }, _callee5, this, [[3, 5]]);
640
639
  }));
641
640
  function AccessRequest(_x5) {
642
641
  return _AccessRequest.apply(this, arguments);
@@ -646,20 +645,20 @@ var AuthorizationClient = /*#__PURE__*/function () {
646
645
  }, {
647
646
  key: "UpdateRequest",
648
647
  value: function () {
649
- var _UpdateRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
648
+ var _UpdateRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
650
649
  var id, abi, event, updateRequestEvent;
651
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
650
+ return _regeneratorRuntime.wrap(function (_context6) {
652
651
  while (1) switch (_context6.prev = _context6.next) {
653
652
  case 0:
654
653
  id = _ref6.id, abi = _ref6.abi;
655
- _context6.next = 3;
654
+ _context6.next = 1;
656
655
  return this.client.CallContractMethodAndWait({
657
656
  contractAddress: Utils.HashToAddress(id),
658
657
  abi: abi,
659
658
  methodName: "updateRequest",
660
659
  methodArgs: []
661
660
  });
662
- case 3:
661
+ case 1:
663
662
  event = _context6.sent;
664
663
  updateRequestEvent = this.client.ExtractEventFromLogs({
665
664
  abi: abi,
@@ -667,13 +666,13 @@ var AuthorizationClient = /*#__PURE__*/function () {
667
666
  eventName: "UpdateRequest"
668
667
  });
669
668
  if (!(event.logs.length === 0 || !updateRequestEvent)) {
670
- _context6.next = 7;
669
+ _context6.next = 2;
671
670
  break;
672
671
  }
673
672
  throw Error("Update request denied for ".concat(id));
674
- case 7:
673
+ case 2:
675
674
  return _context6.abrupt("return", event);
676
- case 8:
675
+ case 3:
677
676
  case "end":
678
677
  return _context6.stop();
679
678
  }
@@ -720,70 +719,70 @@ var AuthorizationClient = /*#__PURE__*/function () {
720
719
  }, {
721
720
  key: "GenerateChannelContentToken",
722
721
  value: function () {
723
- var _GenerateChannelContentToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref8) {
724
- var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken, _ref8$value, value, token, tenantId, kmsAddress, stateChannelApi, additionalParams, payload, signature, multiSig;
725
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
722
+ var _GenerateChannelContentToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref8) {
723
+ var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken, _ref8$value, value, token, tenantId, kmsAddress, stateChannelApi, additionalParams, payload, signature, multiSig, _t12, _t13;
724
+ return _regeneratorRuntime.wrap(function (_context7) {
726
725
  while (1) switch (_context7.prev = _context7.next) {
727
726
  case 0:
728
727
  objectId = _ref8.objectId, versionHash = _ref8.versionHash, issuer = _ref8.issuer, code = _ref8.code, email = _ref8.email, audienceData = _ref8.audienceData, context = _ref8.context, oauthToken = _ref8.oauthToken, _ref8$value = _ref8.value, value = _ref8$value === void 0 ? 0 : _ref8$value;
729
728
  if (!oauthToken) {
730
- _context7.next = 5;
729
+ _context7.next = 2;
731
730
  break;
732
731
  }
733
- _context7.next = 4;
732
+ _context7.next = 1;
734
733
  return this.GenerateOauthChannelToken({
735
734
  objectId: objectId,
736
735
  token: oauthToken
737
736
  });
738
- case 4:
737
+ case 1:
739
738
  return _context7.abrupt("return", _context7.sent);
740
- case 5:
739
+ case 2:
741
740
  if (!(!this.noCache && this.channelContentTokens[objectId])) {
742
- _context7.next = 11;
741
+ _context7.next = 4;
743
742
  break;
744
743
  }
745
744
  if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
746
- _context7.next = 10;
745
+ _context7.next = 3;
747
746
  break;
748
747
  }
749
748
  return _context7.abrupt("return", this.channelContentTokens[objectId].token);
750
- case 10:
749
+ case 3:
751
750
  // Token expired
752
751
  delete this.channelContentTokens[objectId];
753
- case 11:
752
+ case 4:
754
753
  this.Log("Making state channel access request: ".concat(objectId));
755
754
  if (!issuer) {
756
- _context7.next = 43;
755
+ _context7.next = 15;
757
756
  break;
758
757
  }
759
758
  // Ticket API
760
759
  tenantId = issuer.replace(/^\//, "").split("/")[2];
761
- _context7.prev = 14;
762
- _context7.next = 17;
760
+ _context7.prev = 5;
761
+ _context7.next = 6;
763
762
  return this.client.CallContractMethod({
764
763
  contractAddress: Utils.HashToAddress(tenantId),
765
764
  methodName: "addressKMS"
766
765
  });
767
- case 17:
766
+ case 6:
768
767
  kmsAddress = _context7.sent;
769
768
  if (kmsAddress) {
770
- _context7.next = 20;
769
+ _context7.next = 7;
771
770
  break;
772
771
  }
773
772
  throw "";
774
- case 20:
775
- _context7.next = 27;
773
+ case 7:
774
+ _context7.next = 10;
776
775
  break;
777
- case 22:
778
- _context7.prev = 22;
779
- _context7.t0 = _context7["catch"](14);
780
- _context7.next = 26;
776
+ case 8:
777
+ _context7.prev = 8;
778
+ _t12 = _context7["catch"](5);
779
+ _context7.next = 9;
781
780
  return this.client.DefaultKMSAddress();
782
- case 26:
781
+ case 9:
783
782
  kmsAddress = _context7.sent;
784
- case 27:
785
- _context7.prev = 27;
786
- _context7.next = 30;
783
+ case 10:
784
+ _context7.prev = 10;
785
+ _context7.next = 11;
787
786
  return Utils.ResponseToFormat("text", this.MakeAuthServiceRequest({
788
787
  kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
789
788
  method: "POST",
@@ -793,16 +792,16 @@ var AuthorizationClient = /*#__PURE__*/function () {
793
792
  "_EMAIL": email
794
793
  }
795
794
  }));
796
- case 30:
795
+ case 11:
797
796
  token = _context7.sent;
798
- _context7.next = 40;
797
+ _context7.next = 14;
799
798
  break;
800
- case 33:
801
- _context7.prev = 33;
802
- _context7.t1 = _context7["catch"](27);
799
+ case 12:
800
+ _context7.prev = 12;
801
+ _t13 = _context7["catch"](10);
803
802
  this.Log("/as token redemption failed:", true);
804
- this.Log(_context7.t1, true);
805
- _context7.next = 39;
803
+ this.Log(_t13, true);
804
+ _context7.next = 13;
806
805
  return Utils.ResponseToFormat("text", this.MakeKMSRequest({
807
806
  kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
808
807
  method: "POST",
@@ -812,14 +811,14 @@ var AuthorizationClient = /*#__PURE__*/function () {
812
811
  "_EMAIL": email
813
812
  }
814
813
  }));
815
- case 39:
814
+ case 13:
816
815
  token = _context7.sent;
817
- case 40:
816
+ case 14:
818
817
  // Pull target object from token so token can be cached
819
818
  objectId = JSON.parse(Utils.FromB64(token)).qid;
820
- _context7.next = 54;
819
+ _context7.next = 18;
821
820
  break;
822
- case 43:
821
+ case 15:
823
822
  // State channel API
824
823
  if (!audienceData) {
825
824
  audienceData = this.AudienceData({
@@ -830,7 +829,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
830
829
  }
831
830
  stateChannelApi = "elv_channelContentRequestContext";
832
831
  additionalParams = [JSON.stringify(audienceData)];
833
- _context7.next = 48;
832
+ _context7.next = 16;
834
833
  return this.MakeKMSCall({
835
834
  objectId: objectId,
836
835
  methodName: stateChannelApi,
@@ -838,15 +837,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
838
837
  params: [this.client.signer.address, Utils.HashToAddress(objectId), value, Date.now()],
839
838
  additionalParams: additionalParams
840
839
  });
841
- case 48:
840
+ case 16:
842
841
  payload = _context7.sent;
843
- _context7.next = 51;
842
+ _context7.next = 17;
844
843
  return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(payload)));
845
- case 51:
844
+ case 17:
846
845
  signature = _context7.sent;
847
846
  multiSig = Utils.FormatSignature(signature);
848
847
  token = "".concat(payload, ".").concat(Utils.B64(multiSig));
849
- case 54:
848
+ case 18:
850
849
  if (!this.noCache) {
851
850
  this.channelContentTokens[objectId] = {
852
851
  token: token,
@@ -854,11 +853,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
854
853
  };
855
854
  }
856
855
  return _context7.abrupt("return", token);
857
- case 56:
856
+ case 19:
858
857
  case "end":
859
858
  return _context7.stop();
860
859
  }
861
- }, _callee7, this, [[14, 22], [27, 33]]);
860
+ }, _callee7, this, [[5, 8], [10, 12]]);
862
861
  }));
863
862
  function GenerateChannelContentToken(_x7) {
864
863
  return _GenerateChannelContentToken.apply(this, arguments);
@@ -868,14 +867,14 @@ var AuthorizationClient = /*#__PURE__*/function () {
868
867
  }, {
869
868
  key: "ChannelContentFinalize",
870
869
  value: function () {
871
- var _ChannelContentFinalize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref9) {
870
+ var _ChannelContentFinalize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref9) {
872
871
  var objectId, versionHash, _ref9$percent, percent, result;
873
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
872
+ return _regeneratorRuntime.wrap(function (_context8) {
874
873
  while (1) switch (_context8.prev = _context8.next) {
875
874
  case 0:
876
875
  objectId = _ref9.objectId, versionHash = _ref9.versionHash, _ref9$percent = _ref9.percent, percent = _ref9$percent === void 0 ? 0 : _ref9$percent;
877
876
  this.Log("Making state channel finalize request: ".concat(objectId));
878
- _context8.next = 4;
877
+ _context8.next = 1;
879
878
  return this.MakeKMSCall({
880
879
  objectId: objectId,
881
880
  methodName: "elv_channelContentFinalizeContext",
@@ -886,11 +885,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
886
885
  versionHash: versionHash
887
886
  }))]
888
887
  });
889
- case 4:
888
+ case 1:
890
889
  result = _context8.sent;
891
890
  this.channelContentTokens[objectId] = undefined;
892
891
  return _context8.abrupt("return", result);
893
- case 7:
892
+ case 2:
894
893
  case "end":
895
894
  return _context8.stop();
896
895
  }
@@ -904,29 +903,29 @@ var AuthorizationClient = /*#__PURE__*/function () {
904
903
  }, {
905
904
  key: "GenerateOauthChannelToken",
906
905
  value: function () {
907
- var _GenerateOauthChannelToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref10) {
906
+ var _GenerateOauthChannelToken = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref0) {
908
907
  var objectId, versionHash, token, fabricToken;
909
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
908
+ return _regeneratorRuntime.wrap(function (_context9) {
910
909
  while (1) switch (_context9.prev = _context9.next) {
911
910
  case 0:
912
- objectId = _ref10.objectId, versionHash = _ref10.versionHash, token = _ref10.token;
911
+ objectId = _ref0.objectId, versionHash = _ref0.versionHash, token = _ref0.token;
913
912
  if (versionHash) {
914
913
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
915
914
  }
916
915
  if (!(!this.noCache && this.channelContentTokens[objectId])) {
917
- _context9.next = 6;
916
+ _context9.next = 2;
918
917
  break;
919
918
  }
920
919
  if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
921
- _context9.next = 5;
920
+ _context9.next = 1;
922
921
  break;
923
922
  }
924
923
  return _context9.abrupt("return", this.channelContentTokens[objectId].token);
925
- case 5:
924
+ case 1:
926
925
  // Token expired
927
926
  this.channelContentTokens[objectId] = undefined;
928
- case 6:
929
- _context9.next = 8;
927
+ case 2:
928
+ _context9.next = 3;
930
929
  return this.MakeKMSRequest({
931
930
  objectId: objectId,
932
931
  versionHash: versionHash,
@@ -937,10 +936,10 @@ var AuthorizationClient = /*#__PURE__*/function () {
937
936
  Authorization: "Bearer ".concat(token)
938
937
  }
939
938
  });
940
- case 8:
941
- _context9.next = 10;
939
+ case 3:
940
+ _context9.next = 4;
942
941
  return _context9.sent.text();
943
- case 10:
942
+ case 4:
944
943
  fabricToken = _context9.sent;
945
944
  if (!this.noCache) {
946
945
  this.channelContentTokens[objectId] = {
@@ -949,7 +948,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
949
948
  };
950
949
  }
951
950
  return _context9.abrupt("return", fabricToken);
952
- case 13:
951
+ case 5:
953
952
  case "end":
954
953
  return _context9.stop();
955
954
  }
@@ -963,22 +962,22 @@ var AuthorizationClient = /*#__PURE__*/function () {
963
962
  }, {
964
963
  key: "IsV3",
965
964
  value: function () {
966
- var _IsV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref11) {
965
+ var _IsV = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref1) {
967
966
  var id, contractName;
968
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
969
- while (1) switch (_context10.prev = _context10.next) {
967
+ return _regeneratorRuntime.wrap(function (_context0) {
968
+ while (1) switch (_context0.prev = _context0.next) {
970
969
  case 0:
971
- id = _ref11.id;
970
+ id = _ref1.id;
972
971
  if (!this.client.assumeV3) {
973
- _context10.next = 3;
972
+ _context0.next = 1;
974
973
  break;
975
974
  }
976
- return _context10.abrupt("return", true);
977
- case 3:
978
- _context10.next = 5;
975
+ return _context0.abrupt("return", true);
976
+ case 1:
977
+ _context0.next = 2;
979
978
  return this.client.ethClient.ContractName(Utils.HashToAddress(id), true);
980
- case 5:
981
- contractName = _context10.sent;
979
+ case 2:
980
+ contractName = _context0.sent;
982
981
  if (!this.accessVersions[contractName]) {
983
982
  this.accessVersions[contractName] = this.ContractHasMethod({
984
983
  contractAddress: this.client.utils.HashToAddress(id),
@@ -986,17 +985,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
986
985
  methodName: "accessRequestV3"
987
986
  });
988
987
  }
989
- _context10.next = 9;
988
+ _context0.next = 3;
990
989
  return this.accessVersions[contractName];
991
- case 9:
992
- return _context10.abrupt("return", _context10.sent);
993
- case 10:
990
+ case 3:
991
+ return _context0.abrupt("return", _context0.sent);
992
+ case 4:
994
993
  case "end":
995
- return _context10.stop();
994
+ return _context0.stop();
996
995
  }
997
- }, _callee10, this);
996
+ }, _callee0, this);
998
997
  }));
999
- function IsV3(_x10) {
998
+ function IsV3(_x0) {
1000
999
  return _IsV.apply(this, arguments);
1001
1000
  }
1002
1001
  return IsV3;
@@ -1004,12 +1003,12 @@ var AuthorizationClient = /*#__PURE__*/function () {
1004
1003
  }, {
1005
1004
  key: "AccessInfo",
1006
1005
  value: function () {
1007
- var _AccessInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref12) {
1006
+ var _AccessInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(_ref10) {
1008
1007
  var accessType, publicKey, args, isV3, checkAccessCharge;
1009
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1010
- while (1) switch (_context11.prev = _context11.next) {
1008
+ return _regeneratorRuntime.wrap(function (_context1) {
1009
+ while (1) switch (_context1.prev = _context1.next) {
1011
1010
  case 0:
1012
- accessType = _ref12.accessType, publicKey = _ref12.publicKey, args = _ref12.args, isV3 = _ref12.isV3;
1011
+ accessType = _ref10.accessType, publicKey = _ref10.publicKey, args = _ref10.args, isV3 = _ref10.isV3;
1013
1012
  checkAccessCharge = false;
1014
1013
  if (accessType === ACCESS_TYPES.OBJECT) {
1015
1014
  checkAccessCharge = true;
@@ -1032,24 +1031,23 @@ var AuthorizationClient = /*#__PURE__*/function () {
1032
1031
  }
1033
1032
  }
1034
1033
  }
1035
-
1036
1034
  if (isV3 && (!args || args.length === 0)) {
1037
1035
  args = [[],
1038
1036
  // customValues
1039
1037
  [] // stakeholders
1040
1038
  ];
1041
1039
  }
1042
- return _context11.abrupt("return", {
1040
+ return _context1.abrupt("return", {
1043
1041
  accessArgs: args,
1044
1042
  checkAccessCharge: checkAccessCharge
1045
1043
  });
1046
- case 5:
1044
+ case 1:
1047
1045
  case "end":
1048
- return _context11.stop();
1046
+ return _context1.stop();
1049
1047
  }
1050
- }, _callee11, this);
1048
+ }, _callee1, this);
1051
1049
  }));
1052
- function AccessInfo(_x11) {
1050
+ function AccessInfo(_x1) {
1053
1051
  return _AccessInfo.apply(this, arguments);
1054
1052
  }
1055
1053
  return AccessInfo;
@@ -1057,56 +1055,56 @@ var AuthorizationClient = /*#__PURE__*/function () {
1057
1055
  }, {
1058
1056
  key: "AccessType",
1059
1057
  value: function () {
1060
- var _AccessType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id) {
1061
- var contractName, accessType;
1062
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1063
- while (1) switch (_context12.prev = _context12.next) {
1058
+ var _AccessType = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id) {
1059
+ var contractName, accessType, _t14;
1060
+ return _regeneratorRuntime.wrap(function (_context10) {
1061
+ while (1) switch (_context10.prev = _context10.next) {
1064
1062
  case 0:
1065
- _context12.next = 2;
1063
+ _context10.next = 1;
1066
1064
  return this.client.ethClient.ContractName(Utils.HashToAddress(id));
1067
- case 2:
1068
- contractName = _context12.sent;
1065
+ case 1:
1066
+ contractName = _context10.sent;
1069
1067
  if (this.accessTypes[id]) {
1070
- _context12.next = 23;
1068
+ _context10.next = 11;
1071
1069
  break;
1072
1070
  }
1073
- _context12.t0 = contractName;
1074
- _context12.next = _context12.t0 === "BaseContentSpace" ? 7 : _context12.t0 === "BaseLibrary" ? 9 : _context12.t0 === "BaseContentType" ? 11 : _context12.t0 === "BsAccessWallet" ? 13 : _context12.t0 === "BsAccessCtrlGrp" ? 15 : _context12.t0 === "BaseContent" ? 17 : _context12.t0 === "BaseTenantSpace" ? 19 : 21;
1071
+ _t14 = contractName;
1072
+ _context10.next = _t14 === "BaseContentSpace" ? 2 : _t14 === "BaseLibrary" ? 3 : _t14 === "BaseContentType" ? 4 : _t14 === "BsAccessWallet" ? 5 : _t14 === "BsAccessCtrlGrp" ? 6 : _t14 === "BaseContent" ? 7 : _t14 === "BaseTenantSpace" ? 8 : 9;
1075
1073
  break;
1076
- case 7:
1074
+ case 2:
1077
1075
  accessType = ACCESS_TYPES.SPACE;
1078
- return _context12.abrupt("break", 22);
1079
- case 9:
1076
+ return _context10.abrupt("continue", 10);
1077
+ case 3:
1080
1078
  accessType = ACCESS_TYPES.LIBRARY;
1081
- return _context12.abrupt("break", 22);
1082
- case 11:
1079
+ return _context10.abrupt("continue", 10);
1080
+ case 4:
1083
1081
  accessType = ACCESS_TYPES.TYPE;
1084
- return _context12.abrupt("break", 22);
1085
- case 13:
1082
+ return _context10.abrupt("continue", 10);
1083
+ case 5:
1086
1084
  accessType = ACCESS_TYPES.WALLET;
1087
- return _context12.abrupt("break", 22);
1088
- case 15:
1085
+ return _context10.abrupt("continue", 10);
1086
+ case 6:
1089
1087
  accessType = ACCESS_TYPES.GROUP;
1090
- return _context12.abrupt("break", 22);
1091
- case 17:
1088
+ return _context10.abrupt("continue", 10);
1089
+ case 7:
1092
1090
  accessType = ACCESS_TYPES.OBJECT;
1093
- return _context12.abrupt("break", 22);
1094
- case 19:
1091
+ return _context10.abrupt("continue", 10);
1092
+ case 8:
1095
1093
  accessType = ACCESS_TYPES.TENANT;
1096
- return _context12.abrupt("break", 22);
1097
- case 21:
1094
+ return _context10.abrupt("continue", 10);
1095
+ case 9:
1098
1096
  accessType = ACCESS_TYPES.OTHER;
1099
- case 22:
1097
+ case 10:
1100
1098
  this.accessTypes[id] = accessType;
1101
- case 23:
1102
- return _context12.abrupt("return", this.accessTypes[id]);
1103
- case 24:
1099
+ case 11:
1100
+ return _context10.abrupt("return", this.accessTypes[id]);
1101
+ case 12:
1104
1102
  case "end":
1105
- return _context12.stop();
1103
+ return _context10.stop();
1106
1104
  }
1107
- }, _callee12, this);
1105
+ }, _callee10, this);
1108
1106
  }));
1109
- function AccessType(_x12) {
1107
+ function AccessType(_x10) {
1110
1108
  return _AccessType.apply(this, arguments);
1111
1109
  }
1112
1110
  return AccessType;
@@ -1114,156 +1112,156 @@ var AuthorizationClient = /*#__PURE__*/function () {
1114
1112
  }, {
1115
1113
  key: "AccessComplete",
1116
1114
  value: function () {
1117
- var _AccessComplete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref13) {
1115
+ var _AccessComplete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref11) {
1118
1116
  var id, score, _yield$this$ContractI3, abi, isV3, address, requestId, event;
1119
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1120
- while (1) switch (_context13.prev = _context13.next) {
1117
+ return _regeneratorRuntime.wrap(function (_context11) {
1118
+ while (1) switch (_context11.prev = _context11.next) {
1121
1119
  case 0:
1122
- id = _ref13.id, score = _ref13.score;
1120
+ id = _ref11.id, score = _ref11.score;
1123
1121
  this.Log("Calling access complete on ".concat(id, " with score ").concat(score));
1124
- _context13.next = 4;
1122
+ _context11.next = 1;
1125
1123
  return this.ContractInfo({
1126
1124
  id: id
1127
1125
  });
1128
- case 4:
1129
- _yield$this$ContractI3 = _context13.sent;
1126
+ case 1:
1127
+ _yield$this$ContractI3 = _context11.sent;
1130
1128
  abi = _yield$this$ContractI3.abi;
1131
1129
  isV3 = _yield$this$ContractI3.isV3;
1132
1130
  address = Utils.HashToAddress(id);
1133
1131
  requestId = this.requestIds[address];
1134
1132
  if (requestId) {
1135
- _context13.next = 11;
1133
+ _context11.next = 2;
1136
1134
  break;
1137
1135
  }
1138
1136
  throw Error("Unknown request ID for " + id);
1139
- case 11:
1137
+ case 2:
1140
1138
  if (!isV3) {
1141
- _context13.next = 17;
1139
+ _context11.next = 4;
1142
1140
  break;
1143
1141
  }
1144
- _context13.next = 14;
1142
+ _context11.next = 3;
1145
1143
  return this.client.CallContractMethodAndWait({
1146
1144
  contractAddress: address,
1147
1145
  abi: abi,
1148
1146
  methodName: "accessCompleteV3",
1149
1147
  methodArgs: [requestId, [], []]
1150
1148
  });
1151
- case 14:
1152
- event = _context13.sent;
1153
- _context13.next = 20;
1149
+ case 3:
1150
+ event = _context11.sent;
1151
+ _context11.next = 6;
1154
1152
  break;
1155
- case 17:
1156
- _context13.next = 19;
1153
+ case 4:
1154
+ _context11.next = 5;
1157
1155
  return this.client.CallContractMethodAndWait({
1158
1156
  contractAddress: address,
1159
1157
  abi: abi,
1160
1158
  methodName: isV3 ? "accessCompleteV3" : "accessComplete",
1161
1159
  methodArgs: [requestId, score, ""]
1162
1160
  });
1163
- case 19:
1164
- event = _context13.sent;
1165
- case 20:
1161
+ case 5:
1162
+ event = _context11.sent;
1163
+ case 6:
1166
1164
  delete this.requestIds[address];
1167
1165
  delete this.accessTransactions[address];
1168
- return _context13.abrupt("return", event);
1169
- case 23:
1166
+ return _context11.abrupt("return", event);
1167
+ case 7:
1170
1168
  case "end":
1171
- return _context13.stop();
1169
+ return _context11.stop();
1172
1170
  }
1173
- }, _callee13, this);
1171
+ }, _callee11, this);
1174
1172
  }));
1175
- function AccessComplete(_x13) {
1173
+ function AccessComplete(_x11) {
1176
1174
  return _AccessComplete.apply(this, arguments);
1177
1175
  }
1178
1176
  return AccessComplete;
1179
1177
  }() /* Utility methods */
1180
1178
  }, {
1181
1179
  key: "ContractInfo",
1182
- value: function () {
1183
- var _ContractInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref14) {
1180
+ value: (function () {
1181
+ var _ContractInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref12) {
1184
1182
  var id, address, isV3, contractName, accessType, v3Version, version;
1185
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1186
- while (1) switch (_context14.prev = _context14.next) {
1183
+ return _regeneratorRuntime.wrap(function (_context12) {
1184
+ while (1) switch (_context12.prev = _context12.next) {
1187
1185
  case 0:
1188
- id = _ref14.id, address = _ref14.address;
1186
+ id = _ref12.id, address = _ref12.address;
1189
1187
  if (!address) {
1190
1188
  address = Utils.HashToAddress(id);
1191
1189
  }
1192
1190
  if (!id) {
1193
1191
  id = Utils.AddressToObjectId(address);
1194
1192
  }
1195
- _context14.next = 5;
1193
+ _context12.next = 1;
1196
1194
  return this.IsV3({
1197
1195
  id: id
1198
1196
  });
1199
- case 5:
1200
- isV3 = _context14.sent;
1201
- _context14.next = 8;
1197
+ case 1:
1198
+ isV3 = _context12.sent;
1199
+ _context12.next = 2;
1202
1200
  return this.client.ethClient.ContractName(Utils.HashToAddress(id), true);
1203
- case 8:
1204
- contractName = _context14.sent;
1205
- _context14.next = 11;
1201
+ case 2:
1202
+ contractName = _context12.sent;
1203
+ _context12.next = 3;
1206
1204
  return this.AccessType(id);
1207
- case 11:
1208
- accessType = _context14.sent;
1205
+ case 3:
1206
+ accessType = _context12.sent;
1209
1207
  // Contract BsAccessCtrlGrp20210809150000PO has an outdated isAdmin method that checks a managersList array instead of managersMap
1210
1208
  v3Version = contractName === "BsAccessCtrlGrp20210809150000PO" && accessType === this.ACCESS_TYPES.GROUP ? "v3b" : "v3";
1211
1209
  version = isV3 ? v3Version : "v2";
1212
1210
  if (!(accessType === this.ACCESS_TYPES.OTHER)) {
1213
- _context14.next = 16;
1211
+ _context12.next = 4;
1214
1212
  break;
1215
1213
  }
1216
- return _context14.abrupt("return", {});
1217
- case 16:
1218
- return _context14.abrupt("return", {
1214
+ return _context12.abrupt("return", {});
1215
+ case 4:
1216
+ return _context12.abrupt("return", {
1219
1217
  isV3: isV3,
1220
1218
  accessType: accessType,
1221
1219
  abi: this.CONTRACTS[version][accessType].abi
1222
1220
  });
1223
- case 17:
1221
+ case 5:
1224
1222
  case "end":
1225
- return _context14.stop();
1223
+ return _context12.stop();
1226
1224
  }
1227
- }, _callee14, this);
1225
+ }, _callee12, this);
1228
1226
  }));
1229
- function ContractInfo(_x14) {
1227
+ function ContractInfo(_x12) {
1230
1228
  return _ContractInfo.apply(this, arguments);
1231
1229
  }
1232
1230
  return ContractInfo;
1233
- }()
1231
+ }())
1234
1232
  }, {
1235
1233
  key: "GetAccessCharge",
1236
1234
  value: function () {
1237
- var _GetAccessCharge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref15) {
1235
+ var _GetAccessCharge = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref13) {
1238
1236
  var objectId, args, _yield$this$ContractI4, abi, info;
1239
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1240
- while (1) switch (_context15.prev = _context15.next) {
1237
+ return _regeneratorRuntime.wrap(function (_context13) {
1238
+ while (1) switch (_context13.prev = _context13.next) {
1241
1239
  case 0:
1242
- objectId = _ref15.objectId, args = _ref15.args;
1243
- _context15.next = 3;
1240
+ objectId = _ref13.objectId, args = _ref13.args;
1241
+ _context13.next = 1;
1244
1242
  return this.ContractInfo({
1245
1243
  id: objectId
1246
1244
  });
1247
- case 3:
1248
- _yield$this$ContractI4 = _context15.sent;
1245
+ case 1:
1246
+ _yield$this$ContractI4 = _context13.sent;
1249
1247
  abi = _yield$this$ContractI4.abi;
1250
- _context15.next = 7;
1248
+ _context13.next = 2;
1251
1249
  return this.client.CallContractMethod({
1252
1250
  contractAddress: Utils.HashToAddress(objectId),
1253
1251
  abi: abi,
1254
1252
  methodName: "getAccessInfo",
1255
1253
  methodArgs: args
1256
1254
  });
1257
- case 7:
1258
- info = _context15.sent;
1259
- return _context15.abrupt("return", info[1] === 0 ? 0 : info[2]);
1260
- case 9:
1255
+ case 2:
1256
+ info = _context13.sent;
1257
+ return _context13.abrupt("return", info[1] === 0 ? 0 : info[2]);
1258
+ case 3:
1261
1259
  case "end":
1262
- return _context15.stop();
1260
+ return _context13.stop();
1263
1261
  }
1264
- }, _callee15, this);
1262
+ }, _callee13, this);
1265
1263
  }));
1266
- function GetAccessCharge(_x15) {
1264
+ function GetAccessCharge(_x13) {
1267
1265
  return _GetAccessCharge.apply(this, arguments);
1268
1266
  }
1269
1267
  return GetAccessCharge;
@@ -1271,37 +1269,37 @@ var AuthorizationClient = /*#__PURE__*/function () {
1271
1269
  }, {
1272
1270
  key: "Owner",
1273
1271
  value: function () {
1274
- var _Owner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref16) {
1272
+ var _Owner = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref14) {
1275
1273
  var id, address, ownerAddress;
1276
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1277
- while (1) switch (_context16.prev = _context16.next) {
1274
+ return _regeneratorRuntime.wrap(function (_context14) {
1275
+ while (1) switch (_context14.prev = _context14.next) {
1278
1276
  case 0:
1279
- id = _ref16.id, address = _ref16.address;
1277
+ id = _ref14.id, address = _ref14.address;
1280
1278
  if (this.client.signer) {
1281
- _context16.next = 3;
1279
+ _context14.next = 1;
1282
1280
  break;
1283
1281
  }
1284
- return _context16.abrupt("return", false);
1285
- case 3:
1282
+ return _context14.abrupt("return", false);
1283
+ case 1:
1286
1284
  if (id) {
1287
1285
  address = Utils.HashToAddress(id);
1288
1286
  }
1289
- _context16.next = 6;
1287
+ _context14.next = 2;
1290
1288
  return this.client.CallContractMethod({
1291
1289
  contractAddress: address,
1292
1290
  methodName: "owner",
1293
1291
  methodArgs: []
1294
1292
  });
1295
- case 6:
1296
- ownerAddress = _context16.sent;
1297
- return _context16.abrupt("return", Utils.FormatAddress(ownerAddress));
1298
- case 8:
1293
+ case 2:
1294
+ ownerAddress = _context14.sent;
1295
+ return _context14.abrupt("return", Utils.FormatAddress(ownerAddress));
1296
+ case 3:
1299
1297
  case "end":
1300
- return _context16.stop();
1298
+ return _context14.stop();
1301
1299
  }
1302
- }, _callee16, this);
1300
+ }, _callee14, this);
1303
1301
  }));
1304
- function Owner(_x16) {
1302
+ function Owner(_x14) {
1305
1303
  return _Owner.apply(this, arguments);
1306
1304
  }
1307
1305
  return Owner;
@@ -1309,39 +1307,40 @@ var AuthorizationClient = /*#__PURE__*/function () {
1309
1307
  }, {
1310
1308
  key: "Sign",
1311
1309
  value: function () {
1312
- var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(message) {
1313
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1314
- while (1) switch (_context17.prev = _context17.next) {
1310
+ var _Sign = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(message) {
1311
+ var _t15, _t16, _t17;
1312
+ return _regeneratorRuntime.wrap(function (_context15) {
1313
+ while (1) switch (_context15.prev = _context15.next) {
1315
1314
  case 0:
1316
- _context17.t0 = Ethers.utils;
1315
+ _t15 = Ethers.utils;
1317
1316
  if (!this.client.signer.signDigest) {
1318
- _context17.next = 7;
1317
+ _context15.next = 2;
1319
1318
  break;
1320
1319
  }
1321
- _context17.next = 4;
1320
+ _context15.next = 1;
1322
1321
  return this.client.signer.signDigest(message);
1323
- case 4:
1324
- _context17.t1 = _context17.sent;
1325
- _context17.next = 10;
1322
+ case 1:
1323
+ _t16 = _context15.sent;
1324
+ _context15.next = 4;
1326
1325
  break;
1327
- case 7:
1328
- _context17.next = 9;
1326
+ case 2:
1327
+ _context15.next = 3;
1329
1328
  return this.client.signer._signingKey().signDigest(message);
1330
- case 9:
1331
- _context17.t1 = _context17.sent;
1332
- case 10:
1333
- _context17.t2 = _context17.t1;
1334
- _context17.next = 13;
1335
- return _context17.t0.joinSignature.call(_context17.t0, _context17.t2);
1336
- case 13:
1337
- return _context17.abrupt("return", _context17.sent);
1338
- case 14:
1329
+ case 3:
1330
+ _t16 = _context15.sent;
1331
+ case 4:
1332
+ _t17 = _t16;
1333
+ _context15.next = 5;
1334
+ return _t15.joinSignature.call(_t15, _t17);
1335
+ case 5:
1336
+ return _context15.abrupt("return", _context15.sent);
1337
+ case 6:
1339
1338
  case "end":
1340
- return _context17.stop();
1339
+ return _context15.stop();
1341
1340
  }
1342
- }, _callee17, this);
1341
+ }, _callee15, this);
1343
1342
  }));
1344
- function Sign(_x17) {
1343
+ function Sign(_x15) {
1345
1344
  return _Sign.apply(this, arguments);
1346
1345
  }
1347
1346
  return Sign;
@@ -1349,43 +1348,43 @@ var AuthorizationClient = /*#__PURE__*/function () {
1349
1348
  }, {
1350
1349
  key: "KMSAddress",
1351
1350
  value: function () {
1352
- var _KMSAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref17) {
1351
+ var _KMSAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref15) {
1353
1352
  var objectId, versionHash, _yield$this$ContractI5, abi;
1354
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1355
- while (1) switch (_context18.prev = _context18.next) {
1353
+ return _regeneratorRuntime.wrap(function (_context16) {
1354
+ while (1) switch (_context16.prev = _context16.next) {
1356
1355
  case 0:
1357
- objectId = _ref17.objectId, versionHash = _ref17.versionHash;
1356
+ objectId = _ref15.objectId, versionHash = _ref15.versionHash;
1358
1357
  if (versionHash) {
1359
1358
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
1360
1359
  }
1361
- _context18.next = 4;
1360
+ _context16.next = 1;
1362
1361
  return this.ContractInfo({
1363
1362
  id: objectId
1364
1363
  });
1365
- case 4:
1366
- _yield$this$ContractI5 = _context18.sent;
1364
+ case 1:
1365
+ _yield$this$ContractI5 = _context16.sent;
1367
1366
  abi = _yield$this$ContractI5.abi;
1368
1367
  if (abi) {
1369
- _context18.next = 8;
1368
+ _context16.next = 2;
1370
1369
  break;
1371
1370
  }
1372
1371
  throw Error("Unable to determine contract info for ".concat(objectId, " - wrong network?"));
1373
- case 8:
1374
- _context18.next = 10;
1372
+ case 2:
1373
+ _context16.next = 3;
1375
1374
  return this.client.CallContractMethod({
1376
1375
  contractAddress: Utils.HashToAddress(objectId),
1377
1376
  abi: abi,
1378
1377
  methodName: "addressKMS"
1379
1378
  });
1380
- case 10:
1381
- return _context18.abrupt("return", _context18.sent);
1382
- case 11:
1379
+ case 3:
1380
+ return _context16.abrupt("return", _context16.sent);
1381
+ case 4:
1383
1382
  case "end":
1384
- return _context18.stop();
1383
+ return _context16.stop();
1385
1384
  }
1386
- }, _callee18, this);
1385
+ }, _callee16, this);
1387
1386
  }));
1388
- function KMSAddress(_x18) {
1387
+ function KMSAddress(_x16) {
1389
1388
  return _KMSAddress.apply(this, arguments);
1390
1389
  }
1391
1390
  return KMSAddress;
@@ -1393,24 +1392,24 @@ var AuthorizationClient = /*#__PURE__*/function () {
1393
1392
  }, {
1394
1393
  key: "KMSInfo",
1395
1394
  value: function () {
1396
- var _KMSInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref18) {
1395
+ var _KMSInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref16) {
1397
1396
  var objectId, versionHash, kmsId, KMSInfo, _yield$this$ContractI6, abi, _yield$this$ContractI7, _abi, publicKey;
1398
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1399
- while (1) switch (_context19.prev = _context19.next) {
1397
+ return _regeneratorRuntime.wrap(function (_context17) {
1398
+ while (1) switch (_context17.prev = _context17.next) {
1400
1399
  case 0:
1401
- objectId = _ref18.objectId, versionHash = _ref18.versionHash, kmsId = _ref18.kmsId;
1400
+ objectId = _ref16.objectId, versionHash = _ref16.versionHash, kmsId = _ref16.kmsId;
1402
1401
  if (!kmsId) {
1403
- _context19.next = 11;
1402
+ _context17.next = 3;
1404
1403
  break;
1405
1404
  }
1406
- _context19.next = 4;
1405
+ _context17.next = 1;
1407
1406
  return this.ContractInfo({
1408
1407
  address: this.client.contentSpaceAddress
1409
1408
  });
1410
- case 4:
1411
- _yield$this$ContractI6 = _context19.sent;
1409
+ case 1:
1410
+ _yield$this$ContractI6 = _context17.sent;
1412
1411
  abi = _yield$this$ContractI6.abi;
1413
- _context19.next = 8;
1412
+ _context17.next = 2;
1414
1413
  return this.client.CallContractMethod({
1415
1414
  contractAddress: this.client.contentSpaceAddress,
1416
1415
  abi: abi,
@@ -1418,22 +1417,22 @@ var AuthorizationClient = /*#__PURE__*/function () {
1418
1417
  methodArgs: [kmsId, []],
1419
1418
  formatArguments: false
1420
1419
  });
1421
- case 8:
1422
- KMSInfo = _context19.sent;
1423
- _context19.next = 19;
1420
+ case 2:
1421
+ KMSInfo = _context17.sent;
1422
+ _context17.next = 6;
1424
1423
  break;
1425
- case 11:
1424
+ case 3:
1426
1425
  if (versionHash) {
1427
1426
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
1428
1427
  }
1429
- _context19.next = 14;
1428
+ _context17.next = 4;
1430
1429
  return this.ContractInfo({
1431
1430
  id: objectId
1432
1431
  });
1433
- case 14:
1434
- _yield$this$ContractI7 = _context19.sent;
1432
+ case 4:
1433
+ _yield$this$ContractI7 = _context17.sent;
1435
1434
  _abi = _yield$this$ContractI7.abi;
1436
- _context19.next = 18;
1435
+ _context17.next = 5;
1437
1436
  return this.client.CallContractMethod({
1438
1437
  contractAddress: Utils.HashToAddress(objectId),
1439
1438
  abi: _abi,
@@ -1441,22 +1440,22 @@ var AuthorizationClient = /*#__PURE__*/function () {
1441
1440
  methodArgs: [[]],
1442
1441
  formatArguments: false
1443
1442
  });
1444
- case 18:
1445
- KMSInfo = _context19.sent;
1446
- case 19:
1443
+ case 5:
1444
+ KMSInfo = _context17.sent;
1445
+ case 6:
1447
1446
  // Public key is compressed and hashed
1448
1447
  publicKey = Ethers.utils.computePublicKey(Utils.HashToAddress(KMSInfo[1]), false);
1449
- return _context19.abrupt("return", {
1448
+ return _context17.abrupt("return", {
1450
1449
  urls: KMSInfo[0].split(","),
1451
1450
  publicKey: publicKey
1452
1451
  });
1453
- case 21:
1452
+ case 7:
1454
1453
  case "end":
1455
- return _context19.stop();
1454
+ return _context17.stop();
1456
1455
  }
1457
- }, _callee19, this);
1456
+ }, _callee17, this);
1458
1457
  }));
1459
- function KMSInfo(_x19) {
1458
+ function KMSInfo(_x17) {
1460
1459
  return _KMSInfo.apply(this, arguments);
1461
1460
  }
1462
1461
  return KMSInfo;
@@ -1464,61 +1463,61 @@ var AuthorizationClient = /*#__PURE__*/function () {
1464
1463
  }, {
1465
1464
  key: "RetrieveConk",
1466
1465
  value: function () {
1467
- var _RetrieveConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref19) {
1466
+ var _RetrieveConk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref17) {
1468
1467
  var libraryId, objectId, kmsAddress, kmsCapId, kmsCap, cap;
1469
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1470
- while (1) switch (_context20.prev = _context20.next) {
1468
+ return _regeneratorRuntime.wrap(function (_context18) {
1469
+ while (1) switch (_context18.prev = _context18.next) {
1471
1470
  case 0:
1472
- libraryId = _ref19.libraryId, objectId = _ref19.objectId;
1471
+ libraryId = _ref17.libraryId, objectId = _ref17.objectId;
1473
1472
  if (libraryId) {
1474
- _context20.next = 5;
1473
+ _context18.next = 2;
1475
1474
  break;
1476
1475
  }
1477
- _context20.next = 4;
1476
+ _context18.next = 1;
1478
1477
  return this.client.ContentObjectLibraryId({
1479
1478
  objectId: objectId
1480
1479
  });
1481
- case 4:
1482
- libraryId = _context20.sent;
1483
- case 5:
1484
- _context20.next = 7;
1480
+ case 1:
1481
+ libraryId = _context18.sent;
1482
+ case 2:
1483
+ _context18.next = 3;
1485
1484
  return this.KMSAddress({
1486
1485
  objectId: objectId
1487
1486
  });
1488
- case 7:
1489
- kmsAddress = _context20.sent;
1487
+ case 3:
1488
+ kmsAddress = _context18.sent;
1490
1489
  kmsCapId = "eluv.caps.ikms".concat(Utils.AddressToHash(kmsAddress));
1491
- _context20.next = 11;
1490
+ _context18.next = 4;
1492
1491
  return this.client.ContentObjectMetadata({
1493
1492
  libraryId: libraryId,
1494
1493
  objectId: objectId,
1495
1494
  metadataSubtree: kmsCapId
1496
1495
  });
1497
- case 11:
1498
- kmsCap = _context20.sent;
1496
+ case 4:
1497
+ kmsCap = _context18.sent;
1499
1498
  if (kmsCap) {
1500
- _context20.next = 14;
1499
+ _context18.next = 5;
1501
1500
  break;
1502
1501
  }
1503
1502
  throw Error("No KMS key set for this object");
1504
- case 14:
1505
- _context20.next = 16;
1503
+ case 5:
1504
+ _context18.next = 6;
1506
1505
  return this.MakeKMSCall({
1507
1506
  objectId: objectId,
1508
1507
  methodName: "elv_getEncryptionKey",
1509
1508
  paramTypes: ["string", "string", "string", "string", "string"],
1510
1509
  params: [this.client.contentSpaceId, libraryId, objectId, kmsCap || "", ""]
1511
1510
  });
1512
- case 16:
1513
- cap = _context20.sent;
1514
- return _context20.abrupt("return", JSON.parse(Utils.FromB58(cap.replace(/^kp__/, "")).toString("utf-8")));
1515
- case 18:
1511
+ case 6:
1512
+ cap = _context18.sent;
1513
+ return _context18.abrupt("return", JSON.parse(Utils.FromB58(cap.replace(/^kp__/, "")).toString("utf-8")));
1514
+ case 7:
1516
1515
  case "end":
1517
- return _context20.stop();
1516
+ return _context18.stop();
1518
1517
  }
1519
- }, _callee20, this);
1518
+ }, _callee18, this);
1520
1519
  }));
1521
- function RetrieveConk(_x20) {
1520
+ function RetrieveConk(_x18) {
1522
1521
  return _RetrieveConk.apply(this, arguments);
1523
1522
  }
1524
1523
  return RetrieveConk;
@@ -1526,60 +1525,60 @@ var AuthorizationClient = /*#__PURE__*/function () {
1526
1525
  }, {
1527
1526
  key: "RetrieveReencryptionSymmetricKey",
1528
1527
  value: function () {
1529
- var _RetrieveReencryptionSymmetricKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref20) {
1528
+ var _RetrieveReencryptionSymmetricKey = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref18) {
1530
1529
  var libraryId, objectId, kmsAddress, kmsCapId, kmsCap;
1531
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1532
- while (1) switch (_context21.prev = _context21.next) {
1530
+ return _regeneratorRuntime.wrap(function (_context19) {
1531
+ while (1) switch (_context19.prev = _context19.next) {
1533
1532
  case 0:
1534
- libraryId = _ref20.libraryId, objectId = _ref20.objectId;
1533
+ libraryId = _ref18.libraryId, objectId = _ref18.objectId;
1535
1534
  if (libraryId) {
1536
- _context21.next = 5;
1535
+ _context19.next = 2;
1537
1536
  break;
1538
1537
  }
1539
- _context21.next = 4;
1538
+ _context19.next = 1;
1540
1539
  return this.client.ContentObjectLibraryId({
1541
1540
  objectId: objectId
1542
1541
  });
1543
- case 4:
1544
- libraryId = _context21.sent;
1545
- case 5:
1546
- _context21.next = 7;
1542
+ case 1:
1543
+ libraryId = _context19.sent;
1544
+ case 2:
1545
+ _context19.next = 3;
1547
1546
  return this.KMSAddress({
1548
1547
  objectId: objectId
1549
1548
  });
1550
- case 7:
1551
- kmsAddress = _context21.sent;
1549
+ case 3:
1550
+ kmsAddress = _context19.sent;
1552
1551
  kmsCapId = "eluv.caps.ikms".concat(Utils.AddressToHash(kmsAddress));
1553
- _context21.next = 11;
1552
+ _context19.next = 4;
1554
1553
  return this.client.ContentObjectMetadata({
1555
1554
  libraryId: libraryId,
1556
1555
  objectId: objectId,
1557
1556
  metadataSubtree: kmsCapId
1558
1557
  });
1559
- case 11:
1560
- kmsCap = _context21.sent;
1558
+ case 4:
1559
+ kmsCap = _context19.sent;
1561
1560
  if (kmsCap) {
1562
- _context21.next = 14;
1561
+ _context19.next = 5;
1563
1562
  break;
1564
1563
  }
1565
1564
  throw Error("No KMS key set for this object");
1566
- case 14:
1567
- _context21.next = 16;
1565
+ case 5:
1566
+ _context19.next = 6;
1568
1567
  return this.MakeKMSCall({
1569
1568
  objectId: objectId,
1570
1569
  methodName: "elv_getSymmetricKeyAuth",
1571
1570
  paramTypes: ["string", "string", "string", "string", "string"],
1572
1571
  params: [this.client.contentSpaceId, libraryId, objectId, kmsCap || "", ""]
1573
1572
  });
1574
- case 16:
1575
- return _context21.abrupt("return", _context21.sent);
1576
- case 17:
1573
+ case 6:
1574
+ return _context19.abrupt("return", _context19.sent);
1575
+ case 7:
1577
1576
  case "end":
1578
- return _context21.stop();
1577
+ return _context19.stop();
1579
1578
  }
1580
- }, _callee21, this);
1579
+ }, _callee19, this);
1581
1580
  }));
1582
- function RetrieveReencryptionSymmetricKey(_x21) {
1581
+ function RetrieveReencryptionSymmetricKey(_x19) {
1583
1582
  return _RetrieveReencryptionSymmetricKey.apply(this, arguments);
1584
1583
  }
1585
1584
  return RetrieveReencryptionSymmetricKey;
@@ -1587,89 +1586,89 @@ var AuthorizationClient = /*#__PURE__*/function () {
1587
1586
  }, {
1588
1587
  key: "MakeKMSCall",
1589
1588
  value: function () {
1590
- var _MakeKMSCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref21) {
1591
- var kmsId, tenantId, objectId, versionHash, methodName, params, paramTypes, _ref21$additionalPara, additionalParams, _ref21$signature, signature, packedHash, KMSUrls, i, kmsUrl;
1592
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1593
- while (1) switch (_context22.prev = _context22.next) {
1589
+ var _MakeKMSCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref19) {
1590
+ var kmsId, tenantId, objectId, versionHash, methodName, params, paramTypes, _ref19$additionalPara, additionalParams, _ref19$signature, signature, packedHash, KMSUrls, i, kmsUrl, _t18, _t19, _t20, _t21, _t22, _t23, _t24;
1591
+ return _regeneratorRuntime.wrap(function (_context20) {
1592
+ while (1) switch (_context20.prev = _context20.next) {
1594
1593
  case 0:
1595
- kmsId = _ref21.kmsId, tenantId = _ref21.tenantId, objectId = _ref21.objectId, versionHash = _ref21.versionHash, methodName = _ref21.methodName, params = _ref21.params, paramTypes = _ref21.paramTypes, _ref21$additionalPara = _ref21.additionalParams, additionalParams = _ref21$additionalPara === void 0 ? [] : _ref21$additionalPara, _ref21$signature = _ref21.signature, signature = _ref21$signature === void 0 ? true : _ref21$signature;
1594
+ kmsId = _ref19.kmsId, tenantId = _ref19.tenantId, objectId = _ref19.objectId, versionHash = _ref19.versionHash, methodName = _ref19.methodName, params = _ref19.params, paramTypes = _ref19.paramTypes, _ref19$additionalPara = _ref19.additionalParams, additionalParams = _ref19$additionalPara === void 0 ? [] : _ref19$additionalPara, _ref19$signature = _ref19.signature, signature = _ref19$signature === void 0 ? true : _ref19$signature;
1596
1595
  if (versionHash) {
1597
1596
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
1598
1597
  }
1599
1598
  if (objectId) {
1600
- _context22.next = 10;
1599
+ _context20.next = 2;
1601
1600
  break;
1602
1601
  }
1603
- _context22.t0 = "ikms";
1604
- _context22.t1 = Utils;
1605
- _context22.next = 7;
1602
+ _t18 = "ikms";
1603
+ _t19 = Utils;
1604
+ _context20.next = 1;
1606
1605
  return this.client.DefaultKMSAddress({
1607
1606
  tenantId: tenantId
1608
1607
  });
1609
- case 7:
1610
- _context22.t2 = _context22.sent;
1611
- _context22.t3 = _context22.t1.AddressToHash.call(_context22.t1, _context22.t2);
1612
- kmsId = _context22.t0.concat.call(_context22.t0, _context22.t3);
1613
- case 10:
1608
+ case 1:
1609
+ _t20 = _context20.sent;
1610
+ _t21 = _t19.AddressToHash.call(_t19, _t20);
1611
+ kmsId = _t18.concat.call(_t18, _t21);
1612
+ case 2:
1614
1613
  if (!signature) {
1615
- _context22.next = 17;
1614
+ _context20.next = 4;
1616
1615
  break;
1617
1616
  }
1618
1617
  packedHash = Ethers.utils.solidityKeccak256(paramTypes, params);
1619
- _context22.t4 = params;
1620
- _context22.next = 15;
1618
+ _t22 = params;
1619
+ _context20.next = 3;
1621
1620
  return this.Sign(packedHash);
1622
- case 15:
1623
- _context22.t5 = _context22.sent;
1624
- _context22.t4.push.call(_context22.t4, _context22.t5);
1625
- case 17:
1621
+ case 3:
1622
+ _t23 = _context20.sent;
1623
+ _t22.push.call(_t22, _t23);
1624
+ case 4:
1626
1625
  params = params.concat(additionalParams);
1627
- _context22.next = 20;
1626
+ _context20.next = 5;
1628
1627
  return this.KMSInfo({
1629
1628
  kmsId: kmsId,
1630
1629
  objectId: objectId,
1631
1630
  versionHash: versionHash
1632
1631
  });
1633
- case 20:
1634
- KMSUrls = _context22.sent.urls;
1632
+ case 5:
1633
+ KMSUrls = _context20.sent.urls;
1635
1634
  i = 0;
1636
- case 22:
1635
+ case 6:
1637
1636
  if (!(i < KMSUrls.length)) {
1638
- _context22.next = 40;
1637
+ _context20.next = 11;
1639
1638
  break;
1640
1639
  }
1641
- _context22.prev = 23;
1640
+ _context20.prev = 7;
1642
1641
  this.Log("Making KMS request:\n URL: ".concat(KMSUrls[i], "\n Method: ").concat(methodName, "\n Params: ").concat(params.join(", ")));
1643
1642
  kmsUrl = KMSUrls[i];
1644
1643
  if (!this.providers[kmsUrl]) {
1645
1644
  this.providers[kmsUrl] = new Ethers.providers.StaticJsonRpcProvider(kmsUrl, this.client.networkId);
1646
1645
  }
1647
- _context22.next = 29;
1646
+ _context20.next = 8;
1648
1647
  return this.providers[kmsUrl].send(methodName, params);
1649
- case 29:
1650
- return _context22.abrupt("return", _context22.sent);
1651
- case 32:
1652
- _context22.prev = 32;
1653
- _context22.t6 = _context22["catch"](23);
1654
- this.Log("KMS Call Error: ".concat(_context22.t6), true);
1648
+ case 8:
1649
+ return _context20.abrupt("return", _context20.sent);
1650
+ case 9:
1651
+ _context20.prev = 9;
1652
+ _t24 = _context20["catch"](7);
1653
+ this.Log("KMS Call Error: ".concat(_t24), true);
1655
1654
 
1656
1655
  // If the request has been attempted on all KMS urls, throw the error
1657
1656
  if (!(i === KMSUrls.length - 1)) {
1658
- _context22.next = 37;
1657
+ _context20.next = 10;
1659
1658
  break;
1660
1659
  }
1661
- throw _context22.t6;
1662
- case 37:
1660
+ throw _t24;
1661
+ case 10:
1663
1662
  i++;
1664
- _context22.next = 22;
1663
+ _context20.next = 6;
1665
1664
  break;
1666
- case 40:
1665
+ case 11:
1667
1666
  case "end":
1668
- return _context22.stop();
1667
+ return _context20.stop();
1669
1668
  }
1670
- }, _callee22, this, [[23, 32]]);
1669
+ }, _callee20, this, [[7, 9]]);
1671
1670
  }));
1672
- function MakeKMSCall(_x22) {
1671
+ function MakeKMSCall(_x20) {
1673
1672
  return _MakeKMSCall.apply(this, arguments);
1674
1673
  }
1675
1674
  return MakeKMSCall;
@@ -1677,17 +1676,17 @@ var AuthorizationClient = /*#__PURE__*/function () {
1677
1676
  }, {
1678
1677
  key: "MakeAuthServiceRequest",
1679
1678
  value: function () {
1680
- var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref22) {
1681
- var kmsId, objectId, versionHash, _ref22$method, method, path, bodyType, _ref22$body, body, _ref22$queryParams, queryParams, headers;
1682
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1683
- while (1) switch (_context23.prev = _context23.next) {
1679
+ var _MakeAuthServiceRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref20) {
1680
+ var kmsId, objectId, versionHash, _ref20$method, method, path, bodyType, _ref20$body, body, _ref20$queryParams, queryParams, headers;
1681
+ return _regeneratorRuntime.wrap(function (_context21) {
1682
+ while (1) switch (_context21.prev = _context21.next) {
1684
1683
  case 0:
1685
- kmsId = _ref22.kmsId, objectId = _ref22.objectId, versionHash = _ref22.versionHash, _ref22$method = _ref22.method, method = _ref22$method === void 0 ? "GET" : _ref22$method, path = _ref22.path, bodyType = _ref22.bodyType, _ref22$body = _ref22.body, body = _ref22$body === void 0 ? {} : _ref22$body, _ref22$queryParams = _ref22.queryParams, queryParams = _ref22$queryParams === void 0 ? {} : _ref22$queryParams, headers = _ref22.headers;
1684
+ kmsId = _ref20.kmsId, objectId = _ref20.objectId, versionHash = _ref20.versionHash, _ref20$method = _ref20.method, method = _ref20$method === void 0 ? "GET" : _ref20$method, path = _ref20.path, bodyType = _ref20.bodyType, _ref20$body = _ref20.body, body = _ref20$body === void 0 ? {} : _ref20$body, _ref20$queryParams = _ref20.queryParams, queryParams = _ref20$queryParams === void 0 ? {} : _ref20$queryParams, headers = _ref20.headers;
1686
1685
  if (!(this.client.authServiceURIs.length === 0)) {
1687
- _context23.next = 5;
1686
+ _context21.next = 2;
1688
1687
  break;
1689
1688
  }
1690
- _context23.next = 4;
1689
+ _context21.next = 1;
1691
1690
  return this.MakeKMSRequest({
1692
1691
  kmsId: kmsId,
1693
1692
  objectId: objectId,
@@ -1699,10 +1698,10 @@ var AuthorizationClient = /*#__PURE__*/function () {
1699
1698
  queryParams: queryParams,
1700
1699
  headers: headers
1701
1700
  });
1702
- case 4:
1703
- return _context23.abrupt("return", _context23.sent);
1704
- case 5:
1705
- _context23.next = 7;
1701
+ case 1:
1702
+ return _context21.abrupt("return", _context21.sent);
1703
+ case 2:
1704
+ _context21.next = 3;
1706
1705
  return this.client.AuthHttpClient.Request({
1707
1706
  method: method,
1708
1707
  path: path,
@@ -1711,15 +1710,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
1711
1710
  headers: headers,
1712
1711
  queryParams: queryParams
1713
1712
  });
1714
- case 7:
1715
- return _context23.abrupt("return", _context23.sent);
1716
- case 8:
1713
+ case 3:
1714
+ return _context21.abrupt("return", _context21.sent);
1715
+ case 4:
1717
1716
  case "end":
1718
- return _context23.stop();
1717
+ return _context21.stop();
1719
1718
  }
1720
- }, _callee23, this);
1719
+ }, _callee21, this);
1721
1720
  }));
1722
- function MakeAuthServiceRequest(_x23) {
1721
+ function MakeAuthServiceRequest(_x21) {
1723
1722
  return _MakeAuthServiceRequest.apply(this, arguments);
1724
1723
  }
1725
1724
  return MakeAuthServiceRequest;
@@ -1727,46 +1726,46 @@ var AuthorizationClient = /*#__PURE__*/function () {
1727
1726
  }, {
1728
1727
  key: "MakeKMSRequest",
1729
1728
  value: function () {
1730
- var _MakeKMSRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref23) {
1731
- var kmsId, objectId, versionHash, _ref23$method, method, path, bodyType, _ref23$body, body, _ref23$queryParams, queryParams, headers, kmsUrls, kmsHttpClient;
1732
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1733
- while (1) switch (_context24.prev = _context24.next) {
1729
+ var _MakeKMSRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref21) {
1730
+ var kmsId, objectId, versionHash, _ref21$method, method, path, bodyType, _ref21$body, body, _ref21$queryParams, queryParams, headers, kmsUrls, kmsHttpClient, _t25, _t26, _t27, _t28;
1731
+ return _regeneratorRuntime.wrap(function (_context22) {
1732
+ while (1) switch (_context22.prev = _context22.next) {
1734
1733
  case 0:
1735
- kmsId = _ref23.kmsId, objectId = _ref23.objectId, versionHash = _ref23.versionHash, _ref23$method = _ref23.method, method = _ref23$method === void 0 ? "GET" : _ref23$method, path = _ref23.path, bodyType = _ref23.bodyType, _ref23$body = _ref23.body, body = _ref23$body === void 0 ? {} : _ref23$body, _ref23$queryParams = _ref23.queryParams, queryParams = _ref23$queryParams === void 0 ? {} : _ref23$queryParams, headers = _ref23.headers;
1734
+ kmsId = _ref21.kmsId, objectId = _ref21.objectId, versionHash = _ref21.versionHash, _ref21$method = _ref21.method, method = _ref21$method === void 0 ? "GET" : _ref21$method, path = _ref21.path, bodyType = _ref21.bodyType, _ref21$body = _ref21.body, body = _ref21$body === void 0 ? {} : _ref21$body, _ref21$queryParams = _ref21.queryParams, queryParams = _ref21$queryParams === void 0 ? {} : _ref21$queryParams, headers = _ref21.headers;
1736
1735
  if (versionHash) {
1737
1736
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
1738
1737
  }
1739
1738
  if (!(!objectId && !kmsId)) {
1740
- _context24.next = 10;
1739
+ _context22.next = 2;
1741
1740
  break;
1742
1741
  }
1743
- _context24.t0 = "ikms";
1744
- _context24.t1 = Utils;
1745
- _context24.next = 7;
1742
+ _t25 = "ikms";
1743
+ _t26 = Utils;
1744
+ _context22.next = 1;
1746
1745
  return this.client.DefaultKMSAddress();
1747
- case 7:
1748
- _context24.t2 = _context24.sent;
1749
- _context24.t3 = _context24.t1.AddressToHash.call(_context24.t1, _context24.t2);
1750
- kmsId = _context24.t0.concat.call(_context24.t0, _context24.t3);
1751
- case 10:
1752
- _context24.next = 12;
1746
+ case 1:
1747
+ _t27 = _context22.sent;
1748
+ _t28 = _t26.AddressToHash.call(_t26, _t27);
1749
+ kmsId = _t25.concat.call(_t25, _t28);
1750
+ case 2:
1751
+ _context22.next = 3;
1753
1752
  return this.KMSInfo({
1754
1753
  kmsId: kmsId,
1755
1754
  objectId: objectId,
1756
1755
  versionHash: versionHash
1757
1756
  });
1758
- case 12:
1759
- kmsUrls = _context24.sent.urls;
1757
+ case 3:
1758
+ kmsUrls = _context22.sent.urls;
1760
1759
  if (!(!kmsUrls || !kmsUrls[0])) {
1761
- _context24.next = 15;
1760
+ _context22.next = 4;
1762
1761
  break;
1763
1762
  }
1764
1763
  throw Error("No KMS info set for ".concat(versionHash || objectId || "default KMS"));
1765
- case 15:
1764
+ case 4:
1766
1765
  kmsHttpClient = new HttpClient({
1767
1766
  uris: kmsUrls
1768
1767
  });
1769
- _context24.next = 18;
1768
+ _context22.next = 5;
1770
1769
  return kmsHttpClient.Request({
1771
1770
  method: method,
1772
1771
  path: path,
@@ -1775,15 +1774,15 @@ var AuthorizationClient = /*#__PURE__*/function () {
1775
1774
  headers: headers,
1776
1775
  queryParams: queryParams
1777
1776
  });
1778
- case 18:
1779
- return _context24.abrupt("return", _context24.sent);
1780
- case 19:
1777
+ case 5:
1778
+ return _context22.abrupt("return", _context22.sent);
1779
+ case 6:
1781
1780
  case "end":
1782
- return _context24.stop();
1781
+ return _context22.stop();
1783
1782
  }
1784
- }, _callee24, this);
1783
+ }, _callee22, this);
1785
1784
  }));
1786
- function MakeKMSRequest(_x24) {
1785
+ function MakeKMSRequest(_x22) {
1787
1786
  return _MakeKMSRequest.apply(this, arguments);
1788
1787
  }
1789
1788
  return MakeKMSRequest;
@@ -1791,65 +1790,65 @@ var AuthorizationClient = /*#__PURE__*/function () {
1791
1790
  }, {
1792
1791
  key: "ContractHasMethod",
1793
1792
  value: function () {
1794
- var _ContractHasMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
1793
+ var _ContractHasMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref22) {
1795
1794
  var contractAddress, abi, methodName, key, method, methodSignature, methodId;
1796
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1797
- while (1) switch (_context25.prev = _context25.next) {
1795
+ return _regeneratorRuntime.wrap(function (_context23) {
1796
+ while (1) switch (_context23.prev = _context23.next) {
1798
1797
  case 0:
1799
- contractAddress = _ref24.contractAddress, abi = _ref24.abi, methodName = _ref24.methodName;
1798
+ contractAddress = _ref22.contractAddress, abi = _ref22.abi, methodName = _ref22.methodName;
1800
1799
  contractAddress = Utils.FormatAddress(contractAddress);
1801
1800
  key = "".concat(contractAddress, "-").concat(methodName);
1802
1801
  if (!(this.methodAvailability[key] === undefined)) {
1803
- _context25.next = 19;
1802
+ _context23.next = 6;
1804
1803
  break;
1805
1804
  }
1806
1805
  this.Log("Checking method availability: ".concat(contractAddress, " ").concat(methodName));
1807
1806
  if (abi) {
1808
- _context25.next = 9;
1807
+ _context23.next = 2;
1809
1808
  break;
1810
1809
  }
1811
- _context25.next = 8;
1810
+ _context23.next = 1;
1812
1811
  return this.ContractInfo({
1813
1812
  address: contractAddress
1814
1813
  });
1815
- case 8:
1816
- abi = _context25.sent.abi;
1817
- case 9:
1814
+ case 1:
1815
+ abi = _context23.sent.abi;
1816
+ case 2:
1818
1817
  if (abi) {
1819
- _context25.next = 11;
1818
+ _context23.next = 3;
1820
1819
  break;
1821
1820
  }
1822
1821
  throw Error("No ABI for contract ".concat(contractAddress, " - Wrong network or deleted item?"));
1823
- case 11:
1822
+ case 3:
1824
1823
  method = abi.find(function (method) {
1825
1824
  return method.name === methodName;
1826
1825
  });
1827
1826
  if (method) {
1828
- _context25.next = 14;
1827
+ _context23.next = 4;
1829
1828
  break;
1830
1829
  }
1831
- return _context25.abrupt("return", false);
1832
- case 14:
1830
+ return _context23.abrupt("return", false);
1831
+ case 4:
1833
1832
  methodSignature = "".concat(method.name, "(").concat(method.inputs.map(function (i) {
1834
1833
  return i.type;
1835
1834
  }).join(","), ")");
1836
1835
  methodId = Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(methodSignature)).replace("0x", "").slice(0, 8);
1837
- _context25.next = 18;
1836
+ _context23.next = 5;
1838
1837
  return this.MakeElvMasterCall({
1839
1838
  methodName: "elv_deployedContractHasMethod",
1840
1839
  params: [contractAddress, methodId]
1841
1840
  });
1842
- case 18:
1843
- this.methodAvailability[key] = _context25.sent;
1844
- case 19:
1845
- return _context25.abrupt("return", this.methodAvailability[key]);
1846
- case 20:
1841
+ case 5:
1842
+ this.methodAvailability[key] = _context23.sent;
1843
+ case 6:
1844
+ return _context23.abrupt("return", this.methodAvailability[key]);
1845
+ case 7:
1847
1846
  case "end":
1848
- return _context25.stop();
1847
+ return _context23.stop();
1849
1848
  }
1850
- }, _callee25, this);
1849
+ }, _callee23, this);
1851
1850
  }));
1852
- function ContractHasMethod(_x25) {
1851
+ function ContractHasMethod(_x23) {
1853
1852
  return _ContractHasMethod.apply(this, arguments);
1854
1853
  }
1855
1854
  return ContractHasMethod;
@@ -1857,26 +1856,26 @@ var AuthorizationClient = /*#__PURE__*/function () {
1857
1856
  }, {
1858
1857
  key: "MakeElvMasterCall",
1859
1858
  value: function () {
1860
- var _MakeElvMasterCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref25) {
1859
+ var _MakeElvMasterCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref23) {
1861
1860
  var methodName, params;
1862
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1863
- while (1) switch (_context26.prev = _context26.next) {
1861
+ return _regeneratorRuntime.wrap(function (_context24) {
1862
+ while (1) switch (_context24.prev = _context24.next) {
1864
1863
  case 0:
1865
- methodName = _ref25.methodName, params = _ref25.params;
1866
- _context26.next = 3;
1864
+ methodName = _ref23.methodName, params = _ref23.params;
1865
+ _context24.next = 1;
1867
1866
  return this.client.ethClient.MakeProviderCall({
1868
1867
  methodName: "send",
1869
1868
  args: [methodName, params]
1870
1869
  });
1871
- case 3:
1872
- return _context26.abrupt("return", _context26.sent);
1873
- case 4:
1870
+ case 1:
1871
+ return _context24.abrupt("return", _context24.sent);
1872
+ case 2:
1874
1873
  case "end":
1875
- return _context26.stop();
1874
+ return _context24.stop();
1876
1875
  }
1877
- }, _callee26, this);
1876
+ }, _callee24, this);
1878
1877
  }));
1879
- function MakeElvMasterCall(_x26) {
1878
+ function MakeElvMasterCall(_x24) {
1880
1879
  return _MakeElvMasterCall.apply(this, arguments);
1881
1880
  }
1882
1881
  return MakeElvMasterCall;
@@ -1884,40 +1883,40 @@ var AuthorizationClient = /*#__PURE__*/function () {
1884
1883
  }, {
1885
1884
  key: "ReEncryptionConk",
1886
1885
  value: function () {
1887
- var _ReEncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref26) {
1886
+ var _ReEncryptionConk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
1888
1887
  var libraryId, objectId, versionHash, cap;
1889
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1890
- while (1) switch (_context27.prev = _context27.next) {
1888
+ return _regeneratorRuntime.wrap(function (_context25) {
1889
+ while (1) switch (_context25.prev = _context25.next) {
1891
1890
  case 0:
1892
- libraryId = _ref26.libraryId, objectId = _ref26.objectId, versionHash = _ref26.versionHash;
1891
+ libraryId = _ref24.libraryId, objectId = _ref24.objectId, versionHash = _ref24.versionHash;
1893
1892
  if (versionHash) {
1894
1893
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
1895
1894
  }
1896
1895
  if (this.reencryptionKeys[objectId]) {
1897
- _context27.next = 10;
1896
+ _context25.next = 3;
1898
1897
  break;
1899
1898
  }
1900
- _context27.next = 5;
1899
+ _context25.next = 1;
1901
1900
  return this.client.Crypto.GenerateTargetConk();
1902
- case 5:
1903
- cap = _context27.sent;
1904
- _context27.next = 8;
1901
+ case 1:
1902
+ cap = _context25.sent;
1903
+ _context25.next = 2;
1905
1904
  return this.RetrieveReencryptionSymmetricKey({
1906
1905
  libraryId: libraryId,
1907
1906
  objectId: objectId
1908
1907
  });
1909
- case 8:
1910
- cap.symm_key = _context27.sent;
1908
+ case 2:
1909
+ cap.symm_key = _context25.sent;
1911
1910
  this.reencryptionKeys[objectId] = cap;
1912
- case 10:
1913
- return _context27.abrupt("return", this.reencryptionKeys[objectId]);
1914
- case 11:
1911
+ case 3:
1912
+ return _context25.abrupt("return", this.reencryptionKeys[objectId]);
1913
+ case 4:
1915
1914
  case "end":
1916
- return _context27.stop();
1915
+ return _context25.stop();
1917
1916
  }
1918
- }, _callee27, this);
1917
+ }, _callee25, this);
1919
1918
  }));
1920
- function ReEncryptionConk(_x27) {
1919
+ function ReEncryptionConk(_x25) {
1921
1920
  return _ReEncryptionConk.apply(this, arguments);
1922
1921
  }
1923
1922
  return ReEncryptionConk;
@@ -1925,57 +1924,57 @@ var AuthorizationClient = /*#__PURE__*/function () {
1925
1924
  }, {
1926
1925
  key: "EncryptionConk",
1927
1926
  value: function () {
1928
- var _EncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref27) {
1927
+ var _EncryptionConk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref25) {
1929
1928
  var libraryId, objectId, versionHash, conk, _yield$this$client$Cr, secret_key;
1930
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
1931
- while (1) switch (_context28.prev = _context28.next) {
1929
+ return _regeneratorRuntime.wrap(function (_context26) {
1930
+ while (1) switch (_context26.prev = _context26.next) {
1932
1931
  case 0:
1933
- libraryId = _ref27.libraryId, objectId = _ref27.objectId, versionHash = _ref27.versionHash;
1932
+ libraryId = _ref25.libraryId, objectId = _ref25.objectId, versionHash = _ref25.versionHash;
1934
1933
  if (versionHash) {
1935
1934
  objectId = Utils.DecodeVersionHash(versionHash).objectId;
1936
1935
  }
1937
1936
  if (libraryId) {
1938
- _context28.next = 6;
1937
+ _context26.next = 2;
1939
1938
  break;
1940
1939
  }
1941
- _context28.next = 5;
1940
+ _context26.next = 1;
1942
1941
  return this.client.ContentObjectLibraryId({
1943
1942
  objectId: objectId
1944
1943
  });
1945
- case 5:
1946
- libraryId = _context28.sent;
1947
- case 6:
1944
+ case 1:
1945
+ libraryId = _context26.sent;
1946
+ case 2:
1948
1947
  if (this.encryptionKeys[objectId]) {
1949
- _context28.next = 16;
1948
+ _context26.next = 5;
1950
1949
  break;
1951
1950
  }
1952
- _context28.next = 9;
1951
+ _context26.next = 3;
1953
1952
  return this.RetrieveConk({
1954
1953
  libraryId: libraryId,
1955
1954
  objectId: objectId
1956
1955
  });
1957
- case 9:
1958
- conk = _context28.sent;
1959
- _context28.next = 12;
1956
+ case 3:
1957
+ conk = _context26.sent;
1958
+ _context26.next = 4;
1960
1959
  return this.client.Crypto.GeneratePrimaryConk({
1961
1960
  objectId: objectId
1962
1961
  });
1963
- case 12:
1964
- _yield$this$client$Cr = _context28.sent;
1962
+ case 4:
1963
+ _yield$this$client$Cr = _context26.sent;
1965
1964
  secret_key = _yield$this$client$Cr.secret_key;
1966
1965
  conk.secret_key = secret_key;
1967
1966
 
1968
1967
  // { secret_key, public_key, symm_key, block_size }
1969
1968
  this.encryptionKeys[objectId] = conk;
1970
- case 16:
1971
- return _context28.abrupt("return", this.encryptionKeys[objectId]);
1972
- case 17:
1969
+ case 5:
1970
+ return _context26.abrupt("return", this.encryptionKeys[objectId]);
1971
+ case 6:
1973
1972
  case "end":
1974
- return _context28.stop();
1973
+ return _context26.stop();
1975
1974
  }
1976
- }, _callee28, this);
1975
+ }, _callee26, this);
1977
1976
  }));
1978
- function EncryptionConk(_x28) {
1977
+ function EncryptionConk(_x26) {
1979
1978
  return _EncryptionConk.apply(this, arguments);
1980
1979
  }
1981
1980
  return EncryptionConk;
@@ -1983,111 +1982,111 @@ var AuthorizationClient = /*#__PURE__*/function () {
1983
1982
  }, {
1984
1983
  key: "RecordTags",
1985
1984
  value: function () {
1986
- var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref28) {
1985
+ var _RecordTags = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref26) {
1987
1986
  var accessType, libraryId, objectId, versionHash, _yield$this$ContractI8, abi, owner;
1988
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
1989
- while (1) switch (_context29.prev = _context29.next) {
1987
+ return _regeneratorRuntime.wrap(function (_context27) {
1988
+ while (1) switch (_context27.prev = _context27.next) {
1990
1989
  case 0:
1991
- accessType = _ref28.accessType, libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash;
1990
+ accessType = _ref26.accessType, libraryId = _ref26.libraryId, objectId = _ref26.objectId, versionHash = _ref26.versionHash;
1992
1991
  if (!(accessType !== ACCESS_TYPES.OBJECT)) {
1993
- _context29.next = 3;
1992
+ _context27.next = 1;
1994
1993
  break;
1995
1994
  }
1996
- return _context29.abrupt("return");
1997
- case 3:
1998
- _context29.next = 5;
1995
+ return _context27.abrupt("return");
1996
+ case 1:
1997
+ _context27.next = 2;
1999
1998
  return this.ContractInfo({
2000
1999
  id: objectId
2001
2000
  });
2002
- case 5:
2003
- _yield$this$ContractI8 = _context29.sent;
2001
+ case 2:
2002
+ _yield$this$ContractI8 = _context27.sent;
2004
2003
  abi = _yield$this$ContractI8.abi;
2005
- _context29.next = 9;
2004
+ _context27.next = 3;
2006
2005
  return this.Owner({
2007
2006
  id: objectId,
2008
2007
  abi: abi
2009
2008
  });
2010
- case 9:
2011
- owner = _context29.sent;
2009
+ case 3:
2010
+ owner = _context27.sent;
2012
2011
  if (Utils.EqualAddress(owner, this.client.signer.address)) {
2013
- _context29.next = 13;
2012
+ _context27.next = 4;
2014
2013
  break;
2015
2014
  }
2016
- _context29.next = 13;
2015
+ _context27.next = 4;
2017
2016
  return this.client.userProfileClient.RecordTags({
2018
2017
  libraryId: libraryId,
2019
2018
  objectId: objectId,
2020
2019
  versionHash: versionHash
2021
2020
  });
2022
- case 13:
2021
+ case 4:
2023
2022
  case "end":
2024
- return _context29.stop();
2023
+ return _context27.stop();
2025
2024
  }
2026
- }, _callee29, this);
2025
+ }, _callee27, this);
2027
2026
  }));
2028
- function RecordTags(_x29) {
2027
+ function RecordTags(_x27) {
2029
2028
  return _RecordTags.apply(this, arguments);
2030
2029
  }
2031
2030
  return RecordTags;
2032
2031
  }() /* Creation methods */
2033
2032
  }, {
2034
2033
  key: "CreateAccessGroup",
2035
- value: function () {
2036
- var _CreateAccessGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30() {
2034
+ value: (function () {
2035
+ var _CreateAccessGroup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
2037
2036
  var _yield$this$client$et, contractAddress, transactionHash;
2038
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
2039
- while (1) switch (_context30.prev = _context30.next) {
2037
+ return _regeneratorRuntime.wrap(function (_context28) {
2038
+ while (1) switch (_context28.prev = _context28.next) {
2040
2039
  case 0:
2041
- _context30.next = 2;
2040
+ _context28.next = 1;
2042
2041
  return this.client.ethClient.DeployAccessGroupContract({
2043
2042
  contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
2044
2043
  signer: this.client.signer
2045
2044
  });
2046
- case 2:
2047
- _yield$this$client$et = _context30.sent;
2045
+ case 1:
2046
+ _yield$this$client$et = _context28.sent;
2048
2047
  contractAddress = _yield$this$client$et.contractAddress;
2049
2048
  transactionHash = _yield$this$client$et.transactionHash;
2050
- return _context30.abrupt("return", {
2049
+ return _context28.abrupt("return", {
2051
2050
  contractAddress: contractAddress,
2052
2051
  transactionHash: transactionHash
2053
2052
  });
2054
- case 6:
2053
+ case 2:
2055
2054
  case "end":
2056
- return _context30.stop();
2055
+ return _context28.stop();
2057
2056
  }
2058
- }, _callee30, this);
2057
+ }, _callee28, this);
2059
2058
  }));
2060
2059
  function CreateAccessGroup() {
2061
2060
  return _CreateAccessGroup.apply(this, arguments);
2062
2061
  }
2063
2062
  return CreateAccessGroup;
2064
- }()
2063
+ }())
2065
2064
  }, {
2066
2065
  key: "CreateContentType",
2067
2066
  value: function () {
2068
- var _CreateContentType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
2067
+ var _CreateContentType = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
2069
2068
  var _yield$this$client$et2, contractAddress, transactionHash;
2070
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
2071
- while (1) switch (_context31.prev = _context31.next) {
2069
+ return _regeneratorRuntime.wrap(function (_context29) {
2070
+ while (1) switch (_context29.prev = _context29.next) {
2072
2071
  case 0:
2073
- _context31.next = 2;
2072
+ _context29.next = 1;
2074
2073
  return this.client.ethClient.DeployTypeContract({
2075
2074
  contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
2076
2075
  signer: this.client.signer
2077
2076
  });
2078
- case 2:
2079
- _yield$this$client$et2 = _context31.sent;
2077
+ case 1:
2078
+ _yield$this$client$et2 = _context29.sent;
2080
2079
  contractAddress = _yield$this$client$et2.contractAddress;
2081
2080
  transactionHash = _yield$this$client$et2.transactionHash;
2082
- return _context31.abrupt("return", {
2081
+ return _context29.abrupt("return", {
2083
2082
  contractAddress: contractAddress,
2084
2083
  transactionHash: transactionHash
2085
2084
  });
2086
- case 6:
2085
+ case 2:
2087
2086
  case "end":
2088
- return _context31.stop();
2087
+ return _context29.stop();
2089
2088
  }
2090
- }, _callee31, this);
2089
+ }, _callee29, this);
2091
2090
  }));
2092
2091
  function CreateContentType() {
2093
2092
  return _CreateContentType.apply(this, arguments);
@@ -2097,33 +2096,33 @@ var AuthorizationClient = /*#__PURE__*/function () {
2097
2096
  }, {
2098
2097
  key: "CreateContentLibrary",
2099
2098
  value: function () {
2100
- var _CreateContentLibrary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(_ref29) {
2099
+ var _CreateContentLibrary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref27) {
2101
2100
  var kmsId, _yield$this$client$et3, contractAddress, transactionHash;
2102
- return _regeneratorRuntime.wrap(function _callee32$(_context32) {
2103
- while (1) switch (_context32.prev = _context32.next) {
2101
+ return _regeneratorRuntime.wrap(function (_context30) {
2102
+ while (1) switch (_context30.prev = _context30.next) {
2104
2103
  case 0:
2105
- kmsId = _ref29.kmsId;
2106
- _context32.next = 3;
2104
+ kmsId = _ref27.kmsId;
2105
+ _context30.next = 1;
2107
2106
  return this.client.ethClient.DeployLibraryContract({
2108
2107
  contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
2109
2108
  kmsId: kmsId,
2110
2109
  signer: this.client.signer
2111
2110
  });
2112
- case 3:
2113
- _yield$this$client$et3 = _context32.sent;
2111
+ case 1:
2112
+ _yield$this$client$et3 = _context30.sent;
2114
2113
  contractAddress = _yield$this$client$et3.contractAddress;
2115
2114
  transactionHash = _yield$this$client$et3.transactionHash;
2116
- return _context32.abrupt("return", {
2115
+ return _context30.abrupt("return", {
2117
2116
  contractAddress: contractAddress,
2118
2117
  transactionHash: transactionHash
2119
2118
  });
2120
- case 7:
2119
+ case 2:
2121
2120
  case "end":
2122
- return _context32.stop();
2121
+ return _context30.stop();
2123
2122
  }
2124
- }, _callee32, this);
2123
+ }, _callee30, this);
2125
2124
  }));
2126
- function CreateContentLibrary(_x30) {
2125
+ function CreateContentLibrary(_x28) {
2127
2126
  return _CreateContentLibrary.apply(this, arguments);
2128
2127
  }
2129
2128
  return CreateContentLibrary;
@@ -2131,33 +2130,33 @@ var AuthorizationClient = /*#__PURE__*/function () {
2131
2130
  }, {
2132
2131
  key: "CreateContentObject",
2133
2132
  value: function () {
2134
- var _CreateContentObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(_ref30) {
2133
+ var _CreateContentObject = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee31(_ref28) {
2135
2134
  var libraryId, typeId, _yield$this$client$et4, contractAddress, transactionHash;
2136
- return _regeneratorRuntime.wrap(function _callee33$(_context33) {
2137
- while (1) switch (_context33.prev = _context33.next) {
2135
+ return _regeneratorRuntime.wrap(function (_context31) {
2136
+ while (1) switch (_context31.prev = _context31.next) {
2138
2137
  case 0:
2139
- libraryId = _ref30.libraryId, typeId = _ref30.typeId;
2140
- _context33.next = 3;
2138
+ libraryId = _ref28.libraryId, typeId = _ref28.typeId;
2139
+ _context31.next = 1;
2141
2140
  return this.client.ethClient.DeployContentContract({
2142
2141
  contentLibraryAddress: Utils.HashToAddress(libraryId),
2143
2142
  typeAddress: typeId ? Utils.HashToAddress(typeId) : Utils.nullAddress,
2144
2143
  signer: this.client.signer
2145
2144
  });
2146
- case 3:
2147
- _yield$this$client$et4 = _context33.sent;
2145
+ case 1:
2146
+ _yield$this$client$et4 = _context31.sent;
2148
2147
  contractAddress = _yield$this$client$et4.contractAddress;
2149
2148
  transactionHash = _yield$this$client$et4.transactionHash;
2150
- return _context33.abrupt("return", {
2149
+ return _context31.abrupt("return", {
2151
2150
  contractAddress: contractAddress,
2152
2151
  transactionHash: transactionHash
2153
2152
  });
2154
- case 7:
2153
+ case 2:
2155
2154
  case "end":
2156
- return _context33.stop();
2155
+ return _context31.stop();
2157
2156
  }
2158
- }, _callee33, this);
2157
+ }, _callee31, this);
2159
2158
  }));
2160
- function CreateContentObject(_x31) {
2159
+ function CreateContentObject(_x29) {
2161
2160
  return _CreateContentObject.apply(this, arguments);
2162
2161
  }
2163
2162
  return CreateContentObject;
@@ -2170,6 +2169,5 @@ var AuthorizationClient = /*#__PURE__*/function () {
2170
2169
  this.channelContentTokens = {};
2171
2170
  }
2172
2171
  }]);
2173
- return AuthorizationClient;
2174
2172
  }();
2175
2173
  module.exports = AuthorizationClient;