@eluvio/elv-client-js 3.1.96 → 3.1.97

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.
@@ -6,15 +6,13 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
6
6
 
7
7
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
8
8
 
9
- var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
10
-
11
9
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
12
10
 
13
11
  var _createClass = require("@babel/runtime/helpers/createClass");
14
12
 
15
- 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; }
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
16
14
 
17
- 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; }
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
16
 
19
17
  if (typeof Buffer === "undefined") {
20
18
  Buffer = require("buffer/").Buffer;
@@ -67,88 +65,11 @@ if (Utils.Platform() === Utils.PLATFORM_NODE) {
67
65
  */
68
66
 
69
67
 
70
- var ElvClient = /*#__PURE__*/function () {
68
+ var ElvClient =
69
+ /*#__PURE__*/
70
+ function () {
71
71
  "use strict";
72
72
 
73
- /**
74
- * Create a new ElvClient
75
- *
76
- * NOTE: It is highly recommended to use ElvClient.FromConfiguration to
77
- * automatically import the client settings from the fabric
78
- *
79
- * @constructor
80
- *
81
- * @namedParams
82
- * @param {string} contentSpaceId - ID of the content space
83
- * @param {string} contentSpaceId - ID of the blockchain network
84
- * @param {number} fabricVersion - The version of the target content fabric
85
- * @param {Array<string>} fabricURIs - A list of full URIs to content fabric nodes
86
- * @param {Array<string>} ethereumURIs - A list of full URIs to ethereum nodes
87
- * @param {Array<string>} ethereumURIs - A list of full URIs to auth service endpoints
88
- * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
89
- * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
90
- * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
91
- * @param {boolean=} noCache=false - If enabled, blockchain transactions will not be cached
92
- * @param {boolean=} noAuth=false - If enabled, blockchain authorization will not be performed
93
- *
94
- * @return {ElvClient} - New ElvClient connected to the specified content fabric and blockchain
95
- */
96
- function ElvClient(_ref) {
97
- var contentSpaceId = _ref.contentSpaceId,
98
- networkId = _ref.networkId,
99
- networkName = _ref.networkName,
100
- fabricVersion = _ref.fabricVersion,
101
- fabricURIs = _ref.fabricURIs,
102
- ethereumURIs = _ref.ethereumURIs,
103
- authServiceURIs = _ref.authServiceURIs,
104
- _ref$ethereumContract = _ref.ethereumContractTimeout,
105
- ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
106
- trustAuthorityId = _ref.trustAuthorityId,
107
- staticToken = _ref.staticToken,
108
- _ref$noCache = _ref.noCache,
109
- noCache = _ref$noCache === void 0 ? false : _ref$noCache,
110
- _ref$noAuth = _ref.noAuth,
111
- noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth,
112
- _ref$assumeV = _ref.assumeV3,
113
- assumeV3 = _ref$assumeV === void 0 ? false : _ref$assumeV;
114
-
115
- _classCallCheck(this, ElvClient);
116
-
117
- this.utils = Utils;
118
- this.contentSpaceId = contentSpaceId;
119
- this.contentSpaceAddress = this.utils.HashToAddress(contentSpaceId);
120
- this.contentSpaceLibraryId = this.utils.AddressToLibraryId(this.contentSpaceAddress);
121
- this.contentSpaceObjectId = this.utils.AddressToObjectId(this.contentSpaceAddress);
122
- this.networkId = networkId;
123
- this.networkName = networkName;
124
- this.fabricVersion = fabricVersion;
125
- this.fabricURIs = fabricURIs;
126
- this.authServiceURIs = authServiceURIs;
127
- this.ethereumURIs = ethereumURIs;
128
- this.ethereumContractTimeout = ethereumContractTimeout;
129
- this.trustAuthorityId = trustAuthorityId;
130
- this.noCache = noCache;
131
- this.noAuth = noAuth;
132
- this.assumeV3 = assumeV3;
133
- this.debug = false;
134
- this.InitializeClients({
135
- staticToken: staticToken
136
- });
137
- }
138
- /**
139
- * Retrieve content space info and preferred fabric and blockchain URLs from the fabric
140
- *
141
- * @methodGroup Constructor
142
- * @namedParams
143
- * @param {string} configUrl - Full URL to the config endpoint
144
- * @param {Array<string>} kmsUrls - List of KMS urls to use for OAuth authentication
145
- * @param {string=} region - Preferred region - the fabric will auto-detect the best region if not specified
146
- * - Available regions: as-east au-east eu-east-north eu-west-north na-east-north na-east-south na-west-north na-west-south eu-east-south eu-west-south
147
- *
148
- * @return {Promise<Object>} - Object containing content space ID and fabric and ethereum URLs
149
- */
150
-
151
-
152
73
  _createClass(ElvClient, [{
153
74
  key: "Log",
154
75
  value: function Log(message) {
@@ -196,7 +117,7 @@ var ElvClient = /*#__PURE__*/function () {
196
117
  var originalMethod = klass[methodName].bind(klass);
197
118
 
198
119
  if (originalMethod.constructor.name === "AsyncFunction") {
199
- klass[methodName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
120
+ klass[methodName] = function _callee() {
200
121
  var start,
201
122
  _len,
202
123
  args,
@@ -204,7 +125,7 @@ var ElvClient = /*#__PURE__*/function () {
204
125
  result,
205
126
  _args = arguments;
206
127
 
207
- return _regeneratorRuntime.wrap(function _callee$(_context) {
128
+ return _regeneratorRuntime.async(function _callee$(_context) {
208
129
  while (1) {
209
130
  switch (_context.prev = _context.next) {
210
131
  case 0:
@@ -215,7 +136,7 @@ var ElvClient = /*#__PURE__*/function () {
215
136
  }
216
137
 
217
138
  _context.next = 4;
218
- return originalMethod.apply(void 0, args);
139
+ return _regeneratorRuntime.awrap(originalMethod.apply(void 0, args));
219
140
 
220
141
  case 4:
221
142
  result = _context.sent;
@@ -228,8 +149,8 @@ var ElvClient = /*#__PURE__*/function () {
228
149
  return _context.stop();
229
150
  }
230
151
  }
231
- }, _callee);
232
- }));
152
+ });
153
+ };
233
154
  } else {
234
155
  klass[methodName] = function () {
235
156
  var start = Date.now();
@@ -249,90 +170,164 @@ var ElvClient = /*#__PURE__*/function () {
249
170
 
250
171
  MethodLogger(this);
251
172
  }
252
- }, {
173
+ /**
174
+ * Create a new ElvClient
175
+ *
176
+ * NOTE: It is highly recommended to use ElvClient.FromConfiguration to
177
+ * automatically import the client settings from the fabric
178
+ *
179
+ * @constructor
180
+ *
181
+ * @namedParams
182
+ * @param {string} contentSpaceId - ID of the content space
183
+ * @param {string} contentSpaceId - ID of the blockchain network
184
+ * @param {number} fabricVersion - The version of the target content fabric
185
+ * @param {Array<string>} fabricURIs - A list of full URIs to content fabric nodes
186
+ * @param {Array<string>} ethereumURIs - A list of full URIs to ethereum nodes
187
+ * @param {Array<string>} ethereumURIs - A list of full URIs to auth service endpoints
188
+ * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
189
+ * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
190
+ * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
191
+ * @param {boolean=} noCache=false - If enabled, blockchain transactions will not be cached
192
+ * @param {boolean=} noAuth=false - If enabled, blockchain authorization will not be performed
193
+ *
194
+ * @return {ElvClient} - New ElvClient connected to the specified content fabric and blockchain
195
+ */
196
+
197
+ }]);
198
+
199
+ function ElvClient(_ref) {
200
+ var contentSpaceId = _ref.contentSpaceId,
201
+ networkId = _ref.networkId,
202
+ networkName = _ref.networkName,
203
+ fabricVersion = _ref.fabricVersion,
204
+ fabricURIs = _ref.fabricURIs,
205
+ ethereumURIs = _ref.ethereumURIs,
206
+ authServiceURIs = _ref.authServiceURIs,
207
+ _ref$ethereumContract = _ref.ethereumContractTimeout,
208
+ ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
209
+ trustAuthorityId = _ref.trustAuthorityId,
210
+ staticToken = _ref.staticToken,
211
+ _ref$noCache = _ref.noCache,
212
+ noCache = _ref$noCache === void 0 ? false : _ref$noCache,
213
+ _ref$noAuth = _ref.noAuth,
214
+ noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth,
215
+ _ref$assumeV = _ref.assumeV3,
216
+ assumeV3 = _ref$assumeV === void 0 ? false : _ref$assumeV;
217
+
218
+ _classCallCheck(this, ElvClient);
219
+
220
+ this.utils = Utils;
221
+ this.contentSpaceId = contentSpaceId;
222
+ this.contentSpaceAddress = this.utils.HashToAddress(contentSpaceId);
223
+ this.contentSpaceLibraryId = this.utils.AddressToLibraryId(this.contentSpaceAddress);
224
+ this.contentSpaceObjectId = this.utils.AddressToObjectId(this.contentSpaceAddress);
225
+ this.networkId = networkId;
226
+ this.networkName = networkName;
227
+ this.fabricVersion = fabricVersion;
228
+ this.fabricURIs = fabricURIs;
229
+ this.authServiceURIs = authServiceURIs;
230
+ this.ethereumURIs = ethereumURIs;
231
+ this.ethereumContractTimeout = ethereumContractTimeout;
232
+ this.trustAuthorityId = trustAuthorityId;
233
+ this.noCache = noCache;
234
+ this.noAuth = noAuth;
235
+ this.assumeV3 = assumeV3;
236
+ this.debug = false;
237
+ this.InitializeClients({
238
+ staticToken: staticToken
239
+ });
240
+ }
241
+ /**
242
+ * Retrieve content space info and preferred fabric and blockchain URLs from the fabric
243
+ *
244
+ * @methodGroup Constructor
245
+ * @namedParams
246
+ * @param {string} configUrl - Full URL to the config endpoint
247
+ * @param {Array<string>} kmsUrls - List of KMS urls to use for OAuth authentication
248
+ * @param {string=} region - Preferred region - the fabric will auto-detect the best region if not specified
249
+ * - Available regions: as-east au-east eu-east-north eu-west-north na-east-north na-east-south na-west-north na-west-south eu-east-south eu-west-south
250
+ *
251
+ * @return {Promise<Object>} - Object containing content space ID and fabric and ethereum URLs
252
+ */
253
+
254
+
255
+ _createClass(ElvClient, [{
253
256
  key: "InitializeClients",
254
- value: function () {
255
- var _InitializeClients = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
256
- var _ref3,
257
- staticToken,
258
- wallet,
259
- signer,
260
- _args2 = arguments;
261
-
262
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
263
- while (1) {
264
- switch (_context2.prev = _context2.next) {
265
- case 0:
266
- _ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, staticToken = _ref3.staticToken;
267
- // Cached info
268
- this.contentTypes = {};
269
- this.encryptionConks = {};
270
- this.stateChannelAccess = {};
271
- this.objectTenantIds = {};
272
- this.objectLibraryIds = {};
273
- this.objectImageUrls = {};
274
- this.visibilityInfo = {};
275
- this.inaccessibleLibraries = {};
276
- this.HttpClient = new HttpClient({
277
- uris: this.fabricURIs,
278
- debug: this.debug
257
+ value: function InitializeClients() {
258
+ var _ref2,
259
+ staticToken,
260
+ wallet,
261
+ signer,
262
+ _args2 = arguments;
263
+
264
+ return _regeneratorRuntime.async(function InitializeClients$(_context2) {
265
+ while (1) {
266
+ switch (_context2.prev = _context2.next) {
267
+ case 0:
268
+ _ref2 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, staticToken = _ref2.staticToken;
269
+ // Cached info
270
+ this.contentTypes = {};
271
+ this.encryptionConks = {};
272
+ this.stateChannelAccess = {};
273
+ this.objectTenantIds = {};
274
+ this.objectLibraryIds = {};
275
+ this.objectImageUrls = {};
276
+ this.visibilityInfo = {};
277
+ this.inaccessibleLibraries = {};
278
+ this.HttpClient = new HttpClient({
279
+ uris: this.fabricURIs,
280
+ debug: this.debug
281
+ });
282
+ this.AuthHttpClient = new HttpClient({
283
+ uris: this.authServiceURIs,
284
+ debug: this.debug
285
+ });
286
+ this.ethClient = new EthClient({
287
+ client: this,
288
+ uris: this.ethereumURIs,
289
+ networkId: this.networkId,
290
+ debug: this.debug,
291
+ timeout: this.ethereumContractTimeout
292
+ });
293
+
294
+ if (!this.signer) {
295
+ wallet = this.GenerateWallet();
296
+ signer = wallet.AddAccountFromMnemonic({
297
+ mnemonic: wallet.GenerateMnemonic()
279
298
  });
280
- this.AuthHttpClient = new HttpClient({
281
- uris: this.authServiceURIs,
282
- debug: this.debug
299
+ this.SetSigner({
300
+ signer: signer,
301
+ reset: false
283
302
  });
284
- this.ethClient = new EthClient({
285
- client: this,
286
- uris: this.ethereumURIs,
287
- networkId: this.networkId,
288
- debug: this.debug,
289
- timeout: this.ethereumContractTimeout
303
+ this.SetStaticToken({
304
+ token: staticToken
290
305
  });
306
+ }
291
307
 
292
- if (!this.signer) {
293
- wallet = this.GenerateWallet();
294
- signer = wallet.AddAccountFromMnemonic({
295
- mnemonic: wallet.GenerateMnemonic()
296
- });
297
- this.SetSigner({
298
- signer: signer,
299
- reset: false
300
- });
301
- this.SetStaticToken({
302
- token: staticToken
303
- });
304
- }
305
-
306
- this.authClient = new AuthorizationClient({
307
- client: this,
308
- contentSpaceId: this.contentSpaceId,
309
- signer: this.signer,
310
- noCache: this.noCache,
311
- noAuth: this.noAuth,
312
- debug: this.debug
313
- });
314
- this.userProfileClient = new UserProfileClient({
315
- client: this,
316
- debug: this.debug
317
- }); // Initialize crypto wasm
318
-
319
- this.Crypto = Crypto;
320
- this.Crypto.ElvCrypto();
321
-
322
- case 17:
323
- case "end":
324
- return _context2.stop();
325
- }
308
+ this.authClient = new AuthorizationClient({
309
+ client: this,
310
+ contentSpaceId: this.contentSpaceId,
311
+ signer: this.signer,
312
+ noCache: this.noCache,
313
+ noAuth: this.noAuth,
314
+ debug: this.debug
315
+ });
316
+ this.userProfileClient = new UserProfileClient({
317
+ client: this,
318
+ debug: this.debug
319
+ }); // Initialize crypto wasm
320
+
321
+ this.Crypto = Crypto;
322
+ this.Crypto.ElvCrypto();
323
+
324
+ case 17:
325
+ case "end":
326
+ return _context2.stop();
326
327
  }
327
- }, _callee2, this);
328
- }));
329
-
330
- function InitializeClients() {
331
- return _InitializeClients.apply(this, arguments);
332
- }
333
-
334
- return InitializeClients;
335
- }()
328
+ }
329
+ }, null, this);
330
+ }
336
331
  }, {
337
332
  key: "ConfigUrl",
338
333
  value: function ConfigUrl() {
@@ -359,61 +354,53 @@ var ElvClient = /*#__PURE__*/function () {
359
354
 
360
355
  }, {
361
356
  key: "UseRegion",
362
- value: function () {
363
- var _UseRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
364
- var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs;
365
-
366
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
367
- while (1) {
368
- switch (_context3.prev = _context3.next) {
369
- case 0:
370
- region = _ref4.region;
371
-
372
- if (this.configUrl) {
373
- _context3.next = 3;
374
- break;
375
- }
357
+ value: function UseRegion(_ref3) {
358
+ var region, _ref4, fabricURIs, ethereumURIs, authServiceURIs;
376
359
 
377
- throw Error("Unable to change region: Configuration URL not set");
360
+ return _regeneratorRuntime.async(function UseRegion$(_context3) {
361
+ while (1) {
362
+ switch (_context3.prev = _context3.next) {
363
+ case 0:
364
+ region = _ref3.region;
378
365
 
379
- case 3:
380
- _context3.next = 5;
381
- return ElvClient.Configuration({
382
- configUrl: this.configUrl,
383
- region: region
384
- });
385
-
386
- case 5:
387
- _yield$ElvClient$Conf = _context3.sent;
388
- fabricURIs = _yield$ElvClient$Conf.fabricURIs;
389
- ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
390
- authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
391
- this.authServiceURIs = authServiceURIs;
392
- this.fabricURIs = fabricURIs;
393
- this.ethereumURIs = ethereumURIs;
394
- this.HttpClient.uris = fabricURIs;
395
- this.HttpClient.uriIndex = 0;
396
- this.ethClient.ethereumURIs = ethereumURIs;
397
- this.ethClient.ethereumURIIndex = 0;
398
- return _context3.abrupt("return", {
399
- fabricURIs: fabricURIs,
400
- ethereumURIs: ethereumURIs
401
- });
366
+ if (this.configUrl) {
367
+ _context3.next = 3;
368
+ break;
369
+ }
402
370
 
403
- case 17:
404
- case "end":
405
- return _context3.stop();
406
- }
371
+ throw Error("Unable to change region: Configuration URL not set");
372
+
373
+ case 3:
374
+ _context3.next = 5;
375
+ return _regeneratorRuntime.awrap(ElvClient.Configuration({
376
+ configUrl: this.configUrl,
377
+ region: region
378
+ }));
379
+
380
+ case 5:
381
+ _ref4 = _context3.sent;
382
+ fabricURIs = _ref4.fabricURIs;
383
+ ethereumURIs = _ref4.ethereumURIs;
384
+ authServiceURIs = _ref4.authServiceURIs;
385
+ this.authServiceURIs = authServiceURIs;
386
+ this.fabricURIs = fabricURIs;
387
+ this.ethereumURIs = ethereumURIs;
388
+ this.HttpClient.uris = fabricURIs;
389
+ this.HttpClient.uriIndex = 0;
390
+ this.ethClient.ethereumURIs = ethereumURIs;
391
+ this.ethClient.ethereumURIIndex = 0;
392
+ return _context3.abrupt("return", {
393
+ fabricURIs: fabricURIs,
394
+ ethereumURIs: ethereumURIs
395
+ });
396
+
397
+ case 17:
398
+ case "end":
399
+ return _context3.stop();
407
400
  }
408
- }, _callee3, this);
409
- }));
410
-
411
- function UseRegion(_x) {
412
- return _UseRegion.apply(this, arguments);
413
- }
414
-
415
- return UseRegion;
416
- }()
401
+ }
402
+ }, null, this);
403
+ }
417
404
  /**
418
405
  * Reset fabric URLs to prefer the best region auto-detected by the fabric.
419
406
  *
@@ -426,42 +413,34 @@ var ElvClient = /*#__PURE__*/function () {
426
413
 
427
414
  }, {
428
415
  key: "ResetRegion",
429
- value: function () {
430
- var _ResetRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
431
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
432
- while (1) {
433
- switch (_context4.prev = _context4.next) {
434
- case 0:
435
- if (this.configUrl) {
436
- _context4.next = 2;
437
- break;
438
- }
416
+ value: function ResetRegion() {
417
+ return _regeneratorRuntime.async(function ResetRegion$(_context4) {
418
+ while (1) {
419
+ switch (_context4.prev = _context4.next) {
420
+ case 0:
421
+ if (this.configUrl) {
422
+ _context4.next = 2;
423
+ break;
424
+ }
439
425
 
440
- throw Error("Unable to change region: Configuration URL not set");
426
+ throw Error("Unable to change region: Configuration URL not set");
441
427
 
442
- case 2:
443
- _context4.next = 4;
444
- return this.UseRegion({
445
- region: ""
446
- });
428
+ case 2:
429
+ _context4.next = 4;
430
+ return _regeneratorRuntime.awrap(this.UseRegion({
431
+ region: ""
432
+ }));
447
433
 
448
- case 4:
449
- return _context4.abrupt("return", _context4.sent);
434
+ case 4:
435
+ return _context4.abrupt("return", _context4.sent);
450
436
 
451
- case 5:
452
- case "end":
453
- return _context4.stop();
454
- }
437
+ case 5:
438
+ case "end":
439
+ return _context4.stop();
455
440
  }
456
- }, _callee4, this);
457
- }));
458
-
459
- function ResetRegion() {
460
- return _ResetRegion.apply(this, arguments);
461
- }
462
-
463
- return ResetRegion;
464
- }()
441
+ }
442
+ }, null, this);
443
+ }
465
444
  /**
466
445
  * Retrieve the node ID reported by the fabric for the specified region
467
446
  *
@@ -477,40 +456,32 @@ var ElvClient = /*#__PURE__*/function () {
477
456
 
478
457
  }, {
479
458
  key: "NodeId",
480
- value: function () {
481
- var _NodeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
482
- var region, _yield$ElvClient$Conf2, nodeId;
483
-
484
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
485
- while (1) {
486
- switch (_context5.prev = _context5.next) {
487
- case 0:
488
- region = _ref5.region;
489
- _context5.next = 3;
490
- return ElvClient.Configuration({
491
- configUrl: this.configUrl,
492
- region: region
493
- });
494
-
495
- case 3:
496
- _yield$ElvClient$Conf2 = _context5.sent;
497
- nodeId = _yield$ElvClient$Conf2.nodeId;
498
- return _context5.abrupt("return", nodeId);
499
-
500
- case 6:
501
- case "end":
502
- return _context5.stop();
503
- }
459
+ value: function NodeId(_ref5) {
460
+ var region, _ref6, nodeId;
461
+
462
+ return _regeneratorRuntime.async(function NodeId$(_context5) {
463
+ while (1) {
464
+ switch (_context5.prev = _context5.next) {
465
+ case 0:
466
+ region = _ref5.region;
467
+ _context5.next = 3;
468
+ return _regeneratorRuntime.awrap(ElvClient.Configuration({
469
+ configUrl: this.configUrl,
470
+ region: region
471
+ }));
472
+
473
+ case 3:
474
+ _ref6 = _context5.sent;
475
+ nodeId = _ref6.nodeId;
476
+ return _context5.abrupt("return", nodeId);
477
+
478
+ case 6:
479
+ case "end":
480
+ return _context5.stop();
504
481
  }
505
- }, _callee5, this);
506
- }));
507
-
508
- function NodeId(_x2) {
509
- return _NodeId.apply(this, arguments);
510
- }
511
-
512
- return NodeId;
513
- }()
482
+ }
483
+ }, null, this);
484
+ }
514
485
  /**
515
486
  * Retrieve the fabric and ethereum nodes currently used by the client, in preference order
516
487
  *
@@ -541,10 +512,10 @@ var ElvClient = /*#__PURE__*/function () {
541
512
 
542
513
  }, {
543
514
  key: "SetNodes",
544
- value: function SetNodes(_ref6) {
545
- var fabricURIs = _ref6.fabricURIs,
546
- ethereumURIs = _ref6.ethereumURIs,
547
- authServiceURIs = _ref6.authServiceURIs;
515
+ value: function SetNodes(_ref7) {
516
+ var fabricURIs = _ref7.fabricURIs,
517
+ ethereumURIs = _ref7.ethereumURIs,
518
+ authServiceURIs = _ref7.authServiceURIs;
548
519
 
549
520
  if (fabricURIs) {
550
521
  this.fabricURIs = fabricURIs;
@@ -627,10 +598,10 @@ var ElvClient = /*#__PURE__*/function () {
627
598
 
628
599
  }, {
629
600
  key: "SetSigner",
630
- value: function SetSigner(_ref7) {
631
- var signer = _ref7.signer,
632
- _ref7$reset = _ref7.reset,
633
- reset = _ref7$reset === void 0 ? true : _ref7$reset;
601
+ value: function SetSigner(_ref8) {
602
+ var signer = _ref8.signer,
603
+ _ref8$reset = _ref8.reset,
604
+ reset = _ref8$reset === void 0 ? true : _ref8$reset;
634
605
  this.staticToken = undefined;
635
606
  signer.connect(this.ethClient.Provider());
636
607
  signer.provider.pollingInterval = 500;
@@ -654,45 +625,37 @@ var ElvClient = /*#__PURE__*/function () {
654
625
 
655
626
  }, {
656
627
  key: "SetRemoteSigner",
657
- value: function () {
658
- var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref8) {
659
- var idToken, authToken, tenantId, extraData, unsignedPublicAuth, signer;
660
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
661
- while (1) {
662
- switch (_context6.prev = _context6.next) {
663
- case 0:
664
- idToken = _ref8.idToken, authToken = _ref8.authToken, tenantId = _ref8.tenantId, extraData = _ref8.extraData, unsignedPublicAuth = _ref8.unsignedPublicAuth;
665
- signer = new RemoteSigner({
666
- rpcUris: this.authServiceURIs,
667
- idToken: idToken,
668
- authToken: authToken,
669
- tenantId: tenantId,
670
- provider: this.ethClient.provider,
671
- extraData: extraData,
672
- unsignedPublicAuth: unsignedPublicAuth
673
- });
674
- _context6.next = 4;
675
- return signer.Initialize();
676
-
677
- case 4:
678
- this.SetSigner({
679
- signer: signer
680
- });
681
-
682
- case 5:
683
- case "end":
684
- return _context6.stop();
685
- }
628
+ value: function SetRemoteSigner(_ref9) {
629
+ var idToken, authToken, tenantId, extraData, unsignedPublicAuth, signer;
630
+ return _regeneratorRuntime.async(function SetRemoteSigner$(_context6) {
631
+ while (1) {
632
+ switch (_context6.prev = _context6.next) {
633
+ case 0:
634
+ idToken = _ref9.idToken, authToken = _ref9.authToken, tenantId = _ref9.tenantId, extraData = _ref9.extraData, unsignedPublicAuth = _ref9.unsignedPublicAuth;
635
+ signer = new RemoteSigner({
636
+ rpcUris: this.authServiceURIs,
637
+ idToken: idToken,
638
+ authToken: authToken,
639
+ tenantId: tenantId,
640
+ provider: this.ethClient.provider,
641
+ extraData: extraData,
642
+ unsignedPublicAuth: unsignedPublicAuth
643
+ });
644
+ _context6.next = 4;
645
+ return _regeneratorRuntime.awrap(signer.Initialize());
646
+
647
+ case 4:
648
+ this.SetSigner({
649
+ signer: signer
650
+ });
651
+
652
+ case 5:
653
+ case "end":
654
+ return _context6.stop();
686
655
  }
687
- }, _callee6, this);
688
- }));
689
-
690
- function SetRemoteSigner(_x3) {
691
- return _SetRemoteSigner.apply(this, arguments);
692
- }
693
-
694
- return SetRemoteSigner;
695
- }()
656
+ }
657
+ }, null, this);
658
+ }
696
659
  /**
697
660
  * Set the signer for this client to use for blockchain transactions from an existing web3 provider.
698
661
  * Useful for integrating with MetaMask
@@ -706,40 +669,32 @@ var ElvClient = /*#__PURE__*/function () {
706
669
 
707
670
  }, {
708
671
  key: "SetSignerFromWeb3Provider",
709
- value: function () {
710
- var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref9) {
711
- var provider, ethProvider;
712
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
713
- while (1) {
714
- switch (_context7.prev = _context7.next) {
715
- case 0:
716
- provider = _ref9.provider;
717
- this.staticToken = undefined;
718
- ethProvider = new Ethers.providers.Web3Provider(provider);
719
- ethProvider.pollingInterval = 250;
720
- this.signer = ethProvider.getSigner();
721
- _context7.next = 7;
722
- return this.signer.getAddress();
723
-
724
- case 7:
725
- this.signer.address = _context7.sent;
726
- _context7.next = 10;
727
- return this.InitializeClients();
728
-
729
- case 10:
730
- case "end":
731
- return _context7.stop();
732
- }
672
+ value: function SetSignerFromWeb3Provider(_ref10) {
673
+ var provider, ethProvider;
674
+ return _regeneratorRuntime.async(function SetSignerFromWeb3Provider$(_context7) {
675
+ while (1) {
676
+ switch (_context7.prev = _context7.next) {
677
+ case 0:
678
+ provider = _ref10.provider;
679
+ this.staticToken = undefined;
680
+ ethProvider = new Ethers.providers.Web3Provider(provider);
681
+ ethProvider.pollingInterval = 250;
682
+ this.signer = ethProvider.getSigner();
683
+ _context7.next = 7;
684
+ return _regeneratorRuntime.awrap(this.signer.getAddress());
685
+
686
+ case 7:
687
+ this.signer.address = _context7.sent;
688
+ _context7.next = 10;
689
+ return _regeneratorRuntime.awrap(this.InitializeClients());
690
+
691
+ case 10:
692
+ case "end":
693
+ return _context7.stop();
733
694
  }
734
- }, _callee7, this);
735
- }));
736
-
737
- function SetSignerFromWeb3Provider(_x4) {
738
- return _SetSignerFromWeb3Provider.apply(this, arguments);
739
- }
740
-
741
- return SetSignerFromWeb3Provider;
742
- }()
695
+ }
696
+ }, null, this);
697
+ }
743
698
  /**
744
699
  * Initialize a new account using the provided funding and group tokens.
745
700
  *
@@ -758,85 +713,77 @@ var ElvClient = /*#__PURE__*/function () {
758
713
 
759
714
  }, {
760
715
  key: "CreateAccount",
761
- value: function () {
762
- var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref10) {
763
- var tenantId, fundingToken, _ref10$funds, funds, groupToken, wallet, signer;
764
-
765
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
766
- while (1) {
767
- switch (_context8.prev = _context8.next) {
768
- case 0:
769
- tenantId = _ref10.tenantId, fundingToken = _ref10.fundingToken, _ref10$funds = _ref10.funds, funds = _ref10$funds === void 0 ? 0.5 : _ref10$funds, groupToken = _ref10.groupToken;
770
-
771
- if (!this.signer) {
772
- wallet = this.GenerateWallet();
773
- signer = wallet.AddAccountFromMnemonic({
774
- mnemonic: wallet.GenerateMnemonic()
775
- });
776
- this.SetSigner({
777
- signer: signer
778
- });
779
- }
780
-
781
- _context8.next = 4;
782
- return this.authClient.MakeKMSRequest({
783
- method: "POST",
784
- path: "/ks/otp/fnd/".concat(tenantId),
785
- body: {
786
- toAddr: this.signer.address,
787
- amtStr: this.utils.EtherToWei(funds)
788
- },
789
- headers: {
790
- Authorization: "Bearer ".concat(fundingToken)
791
- }
792
- });
716
+ value: function CreateAccount(_ref11) {
717
+ var tenantId, fundingToken, _ref11$funds, funds, groupToken, wallet, signer;
793
718
 
794
- case 4:
795
- _context8.next = 6;
796
- return this.userProfileClient.CreateWallet();
719
+ return _regeneratorRuntime.async(function CreateAccount$(_context8) {
720
+ while (1) {
721
+ switch (_context8.prev = _context8.next) {
722
+ case 0:
723
+ tenantId = _ref11.tenantId, fundingToken = _ref11.fundingToken, _ref11$funds = _ref11.funds, funds = _ref11$funds === void 0 ? 0.5 : _ref11$funds, groupToken = _ref11.groupToken;
797
724
 
798
- case 6:
799
- _context8.next = 8;
800
- return this.userProfileClient.ReplaceUserMetadata({
801
- metadataSubtree: "tenantContractId",
802
- metadata: tenantId
725
+ if (!this.signer) {
726
+ wallet = this.GenerateWallet();
727
+ signer = wallet.AddAccountFromMnemonic({
728
+ mnemonic: wallet.GenerateMnemonic()
803
729
  });
730
+ this.SetSigner({
731
+ signer: signer
732
+ });
733
+ }
804
734
 
805
- case 8:
806
- if (!groupToken) {
807
- _context8.next = 11;
808
- break;
735
+ _context8.next = 4;
736
+ return _regeneratorRuntime.awrap(this.authClient.MakeKMSRequest({
737
+ method: "POST",
738
+ path: "/ks/otp/fnd/".concat(tenantId),
739
+ body: {
740
+ toAddr: this.signer.address,
741
+ amtStr: this.utils.EtherToWei(funds)
742
+ },
743
+ headers: {
744
+ Authorization: "Bearer ".concat(fundingToken)
809
745
  }
746
+ }));
810
747
 
811
- _context8.next = 11;
812
- return this.authClient.MakeKMSRequest({
813
- method: "POST",
814
- path: "/ks/otp/grp/".concat(tenantId),
815
- body: {
816
- addAddr: this.signer.address
817
- },
818
- headers: {
819
- Authorization: "Bearer ".concat(groupToken)
820
- }
821
- });
748
+ case 4:
749
+ _context8.next = 6;
750
+ return _regeneratorRuntime.awrap(this.userProfileClient.CreateWallet());
822
751
 
823
- case 11:
824
- return _context8.abrupt("return", this.utils.FormatAddress(this.signer.address));
752
+ case 6:
753
+ _context8.next = 8;
754
+ return _regeneratorRuntime.awrap(this.userProfileClient.ReplaceUserMetadata({
755
+ metadataSubtree: "tenantContractId",
756
+ metadata: tenantId
757
+ }));
825
758
 
826
- case 12:
827
- case "end":
828
- return _context8.stop();
829
- }
830
- }
831
- }, _callee8, this);
832
- }));
759
+ case 8:
760
+ if (!groupToken) {
761
+ _context8.next = 11;
762
+ break;
763
+ }
833
764
 
834
- function CreateAccount(_x5) {
835
- return _CreateAccount.apply(this, arguments);
836
- }
765
+ _context8.next = 11;
766
+ return _regeneratorRuntime.awrap(this.authClient.MakeKMSRequest({
767
+ method: "POST",
768
+ path: "/ks/otp/grp/".concat(tenantId),
769
+ body: {
770
+ addAddr: this.signer.address
771
+ },
772
+ headers: {
773
+ Authorization: "Bearer ".concat(groupToken)
774
+ }
775
+ }));
776
+
777
+ case 11:
778
+ return _context8.abrupt("return", this.utils.FormatAddress(this.signer.address));
837
779
 
838
- return CreateAccount;
839
- }()
780
+ case 12:
781
+ case "end":
782
+ return _context8.stop();
783
+ }
784
+ }
785
+ }, null, this);
786
+ }
840
787
  /*
841
788
  TOKEN 211b PREFIX + BODY | aplsjcJf1HYcDDUuCdXcSZtU86nYK162YmYJeuqwMczEBJVkD5D5EvsBvVwYDRsf4hzDvBWMoe9piBpqx...
842
789
  PREFIX 6b aplsjc | apl=plain s=ES256K jc=json-compressed
@@ -861,103 +808,89 @@ var ElvClient = /*#__PURE__*/function () {
861
808
 
862
809
  }, {
863
810
  key: "CreateFabricToken",
864
- value: function () {
865
- var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
866
- var _this = this;
867
-
868
- var _ref11,
869
- _ref11$duration,
870
- duration,
871
- _ref11$spec,
872
- spec,
873
- address,
874
- Sign,
875
- _ref11$addEthereumPre,
876
- addEthereumPrefix,
877
- token,
878
- message,
879
- signature,
880
- compressedToken,
881
- _args10 = arguments;
882
-
883
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
884
- while (1) {
885
- switch (_context10.prev = _context10.next) {
886
- case 0:
887
- _ref11 = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {}, _ref11$duration = _ref11.duration, duration = _ref11$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref11$duration, _ref11$spec = _ref11.spec, spec = _ref11$spec === void 0 ? {} : _ref11$spec, address = _ref11.address, Sign = _ref11.Sign, _ref11$addEthereumPre = _ref11.addEthereumPrefix, addEthereumPrefix = _ref11$addEthereumPre === void 0 ? true : _ref11$addEthereumPre;
888
- address = address || this.CurrentAccountAddress();
889
- _context10.t0 = _objectSpread;
890
- _context10.t1 = _objectSpread({}, spec);
891
- _context10.t2 = {};
892
- _context10.t3 = "iusr".concat(Utils.AddressToHash(address));
893
- _context10.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
894
- _context10.next = 9;
895
- return this.ContentSpaceId();
896
-
897
- case 9:
898
- _context10.t5 = _context10.sent;
899
- _context10.t6 = Date.now();
900
- _context10.t7 = Date.now() + duration;
901
- _context10.t8 = {
902
- sub: _context10.t3,
903
- adr: _context10.t4,
904
- spc: _context10.t5,
905
- iat: _context10.t6,
906
- exp: _context10.t7
811
+ value: function CreateFabricToken() {
812
+ var _this = this;
813
+
814
+ var _ref12,
815
+ _ref12$duration,
816
+ duration,
817
+ _ref12$spec,
818
+ spec,
819
+ address,
820
+ Sign,
821
+ _ref12$addEthereumPre,
822
+ addEthereumPrefix,
823
+ token,
824
+ message,
825
+ signature,
826
+ compressedToken,
827
+ _args10 = arguments;
828
+
829
+ return _regeneratorRuntime.async(function CreateFabricToken$(_context10) {
830
+ while (1) {
831
+ switch (_context10.prev = _context10.next) {
832
+ case 0:
833
+ _ref12 = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {}, _ref12$duration = _ref12.duration, duration = _ref12$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref12$duration, _ref12$spec = _ref12.spec, spec = _ref12$spec === void 0 ? {} : _ref12$spec, address = _ref12.address, Sign = _ref12.Sign, _ref12$addEthereumPre = _ref12.addEthereumPrefix, addEthereumPrefix = _ref12$addEthereumPre === void 0 ? true : _ref12$addEthereumPre;
834
+ address = address || this.CurrentAccountAddress();
835
+ _context10.t0 = _objectSpread;
836
+ _context10.t1 = {};
837
+ _context10.t2 = spec;
838
+ _context10.t3 = "iusr".concat(Utils.AddressToHash(address));
839
+ _context10.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
840
+ _context10.next = 9;
841
+ return _regeneratorRuntime.awrap(this.ContentSpaceId());
842
+
843
+ case 9:
844
+ _context10.t5 = _context10.sent;
845
+ _context10.t6 = Date.now();
846
+ _context10.t7 = Date.now() + duration;
847
+ _context10.t8 = {
848
+ sub: _context10.t3,
849
+ adr: _context10.t4,
850
+ spc: _context10.t5,
851
+ iat: _context10.t6,
852
+ exp: _context10.t7
853
+ };
854
+ token = (0, _context10.t0)(_context10.t1, _context10.t2, _context10.t8);
855
+
856
+ if (!Sign) {
857
+ Sign = function Sign(message) {
858
+ return _regeneratorRuntime.async(function Sign$(_context9) {
859
+ while (1) {
860
+ switch (_context9.prev = _context9.next) {
861
+ case 0:
862
+ return _context9.abrupt("return", _this.authClient.Sign(message));
863
+
864
+ case 1:
865
+ case "end":
866
+ return _context9.stop();
867
+ }
868
+ }
869
+ });
907
870
  };
908
- token = (0, _context10.t0)(_context10.t1, _context10.t2, _context10.t8);
909
-
910
- if (!Sign) {
911
- Sign = /*#__PURE__*/function () {
912
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(message) {
913
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
914
- while (1) {
915
- switch (_context9.prev = _context9.next) {
916
- case 0:
917
- return _context9.abrupt("return", _this.authClient.Sign(message));
918
-
919
- case 1:
920
- case "end":
921
- return _context9.stop();
922
- }
923
- }
924
- }, _callee9);
925
- }));
926
-
927
- return function Sign(_x6) {
928
- return _ref12.apply(this, arguments);
929
- };
930
- }();
931
- }
871
+ }
932
872
 
933
- message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
873
+ message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
934
874
 
935
- if (addEthereumPrefix) {
936
- message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
937
- }
875
+ if (addEthereumPrefix) {
876
+ message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
877
+ }
938
878
 
939
- _context10.next = 19;
940
- return Sign(message);
879
+ _context10.next = 19;
880
+ return _regeneratorRuntime.awrap(Sign(message));
941
881
 
942
- case 19:
943
- signature = _context10.sent;
944
- compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
945
- return _context10.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
882
+ case 19:
883
+ signature = _context10.sent;
884
+ compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
885
+ return _context10.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
946
886
 
947
- case 22:
948
- case "end":
949
- return _context10.stop();
950
- }
887
+ case 22:
888
+ case "end":
889
+ return _context10.stop();
951
890
  }
952
- }, _callee10, this);
953
- }));
954
-
955
- function CreateFabricToken() {
956
- return _CreateFabricToken.apply(this, arguments);
957
- }
958
-
959
- return CreateFabricToken;
960
- }()
891
+ }
892
+ }, null, this);
893
+ }
961
894
  /**
962
895
  * Issue a self-signed authorization token
963
896
  *
@@ -977,130 +910,122 @@ var ElvClient = /*#__PURE__*/function () {
977
910
 
978
911
  }, {
979
912
  key: "CreateSignedToken",
980
- value: function () {
981
- var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref13) {
982
- var libraryId, objectId, versionHash, policyId, subject, _ref13$grantType, grantType, _ref13$allowDecryptio, allowDecryption, duration, _ref13$context, context, token, cap, compressedToken, signature;
983
-
984
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
985
- while (1) {
986
- switch (_context11.prev = _context11.next) {
987
- case 0:
988
- libraryId = _ref13.libraryId, objectId = _ref13.objectId, versionHash = _ref13.versionHash, policyId = _ref13.policyId, subject = _ref13.subject, _ref13$grantType = _ref13.grantType, grantType = _ref13$grantType === void 0 ? "read" : _ref13$grantType, _ref13$allowDecryptio = _ref13.allowDecryption, allowDecryption = _ref13$allowDecryptio === void 0 ? false : _ref13$allowDecryptio, duration = _ref13.duration, _ref13$context = _ref13.context, context = _ref13$context === void 0 ? {} : _ref13$context;
989
-
990
- if (subject) {
991
- _context11.next = 9;
992
- break;
993
- }
994
-
995
- _context11.t0 = "iusr";
996
- _context11.t1 = this.utils;
997
- _context11.next = 6;
998
- return this.CurrentAccountAddress();
913
+ value: function CreateSignedToken(_ref13) {
914
+ var libraryId, objectId, versionHash, policyId, subject, _ref13$grantType, grantType, _ref13$allowDecryptio, allowDecryption, duration, _ref13$context, context, token, cap, compressedToken, signature;
999
915
 
1000
- case 6:
1001
- _context11.t2 = _context11.sent;
1002
- _context11.t3 = _context11.t1.AddressToHash.call(_context11.t1, _context11.t2);
1003
- subject = _context11.t0.concat.call(_context11.t0, _context11.t3);
916
+ return _regeneratorRuntime.async(function CreateSignedToken$(_context11) {
917
+ while (1) {
918
+ switch (_context11.prev = _context11.next) {
919
+ case 0:
920
+ libraryId = _ref13.libraryId, objectId = _ref13.objectId, versionHash = _ref13.versionHash, policyId = _ref13.policyId, subject = _ref13.subject, _ref13$grantType = _ref13.grantType, grantType = _ref13$grantType === void 0 ? "read" : _ref13$grantType, _ref13$allowDecryptio = _ref13.allowDecryption, allowDecryption = _ref13$allowDecryptio === void 0 ? false : _ref13$allowDecryptio, duration = _ref13.duration, _ref13$context = _ref13.context, context = _ref13$context === void 0 ? {} : _ref13$context;
1004
921
 
1005
- case 9:
1006
- if (policyId) {
1007
- context["elv:delegation-id"] = policyId;
1008
- }
922
+ if (subject) {
923
+ _context11.next = 9;
924
+ break;
925
+ }
1009
926
 
1010
- _context11.t4 = Buffer;
1011
- _context11.next = 13;
1012
- return this.CurrentAccountAddress().replace(/^0x/, "");
1013
-
1014
- case 13:
1015
- _context11.t5 = _context11.sent;
1016
- _context11.t6 = _context11.t4.from.call(_context11.t4, _context11.t5, "hex").toString("base64");
1017
- _context11.t7 = subject;
1018
- _context11.next = 18;
1019
- return this.ContentSpaceId();
1020
-
1021
- case 18:
1022
- _context11.t8 = _context11.sent;
1023
- _context11.t9 = Date.now();
1024
- _context11.t10 = Date.now() + duration;
1025
- _context11.t11 = grantType;
1026
- _context11.t12 = context;
1027
- token = {
1028
- adr: _context11.t6,
1029
- sub: _context11.t7,
1030
- spc: _context11.t8,
1031
- iat: _context11.t9,
1032
- exp: _context11.t10,
1033
- gra: _context11.t11,
1034
- ctx: _context11.t12
1035
- };
927
+ _context11.t0 = "iusr";
928
+ _context11.t1 = this.utils;
929
+ _context11.next = 6;
930
+ return _regeneratorRuntime.awrap(this.CurrentAccountAddress());
1036
931
 
1037
- if (versionHash) {
1038
- objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1039
- }
932
+ case 6:
933
+ _context11.t2 = _context11.sent;
934
+ _context11.t3 = _context11.t1.AddressToHash.call(_context11.t1, _context11.t2);
935
+ subject = _context11.t0.concat.call(_context11.t0, _context11.t3);
1040
936
 
1041
- if (!objectId) {
1042
- _context11.next = 31;
1043
- break;
1044
- }
937
+ case 9:
938
+ if (policyId) {
939
+ context["elv:delegation-id"] = policyId;
940
+ }
1045
941
 
1046
- token.qid = objectId;
942
+ _context11.t4 = Buffer;
943
+ _context11.next = 13;
944
+ return _regeneratorRuntime.awrap(this.CurrentAccountAddress().replace(/^0x/, ""));
945
+
946
+ case 13:
947
+ _context11.t5 = _context11.sent;
948
+ _context11.t6 = _context11.t4.from.call(_context11.t4, _context11.t5, "hex").toString("base64");
949
+ _context11.t7 = subject;
950
+ _context11.next = 18;
951
+ return _regeneratorRuntime.awrap(this.ContentSpaceId());
952
+
953
+ case 18:
954
+ _context11.t8 = _context11.sent;
955
+ _context11.t9 = Date.now();
956
+ _context11.t10 = Date.now() + duration;
957
+ _context11.t11 = grantType;
958
+ _context11.t12 = context;
959
+ token = {
960
+ adr: _context11.t6,
961
+ sub: _context11.t7,
962
+ spc: _context11.t8,
963
+ iat: _context11.t9,
964
+ exp: _context11.t10,
965
+ gra: _context11.t11,
966
+ ctx: _context11.t12
967
+ };
968
+
969
+ if (versionHash) {
970
+ objectId = this.utils.DecodeVersionHash(versionHash).objectId;
971
+ }
1047
972
 
1048
- if (libraryId) {
1049
- _context11.next = 31;
1050
- break;
1051
- }
973
+ if (!objectId) {
974
+ _context11.next = 31;
975
+ break;
976
+ }
1052
977
 
1053
- _context11.next = 30;
1054
- return this.ContentObjectLibraryId({
1055
- objectId: objectId
1056
- });
978
+ token.qid = objectId;
1057
979
 
1058
- case 30:
1059
- libraryId = _context11.sent;
980
+ if (libraryId) {
981
+ _context11.next = 31;
982
+ break;
983
+ }
1060
984
 
1061
- case 31:
1062
- if (libraryId) {
1063
- token.lib = libraryId;
1064
- }
985
+ _context11.next = 30;
986
+ return _regeneratorRuntime.awrap(this.ContentObjectLibraryId({
987
+ objectId: objectId
988
+ }));
1065
989
 
1066
- if (!allowDecryption) {
1067
- _context11.next = 37;
1068
- break;
1069
- }
990
+ case 30:
991
+ libraryId = _context11.sent;
1070
992
 
1071
- _context11.next = 35;
1072
- return this.authClient.ReEncryptionConk({
1073
- libraryId: libraryId,
1074
- objectId: objectId
1075
- });
993
+ case 31:
994
+ if (libraryId) {
995
+ token.lib = libraryId;
996
+ }
1076
997
 
1077
- case 35:
1078
- cap = _context11.sent;
1079
- token.apk = cap.public_key;
998
+ if (!allowDecryption) {
999
+ _context11.next = 37;
1000
+ break;
1001
+ }
1080
1002
 
1081
- case 37:
1082
- compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1083
- _context11.next = 40;
1084
- return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
1003
+ _context11.next = 35;
1004
+ return _regeneratorRuntime.awrap(this.authClient.ReEncryptionConk({
1005
+ libraryId: libraryId,
1006
+ objectId: objectId
1007
+ }));
1085
1008
 
1086
- case 40:
1087
- signature = _context11.sent;
1088
- return _context11.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1009
+ case 35:
1010
+ cap = _context11.sent;
1011
+ token.apk = cap.public_key;
1089
1012
 
1090
- case 42:
1091
- case "end":
1092
- return _context11.stop();
1093
- }
1094
- }
1095
- }, _callee11, this);
1096
- }));
1013
+ case 37:
1014
+ compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1015
+ _context11.next = 40;
1016
+ return _regeneratorRuntime.awrap(this.authClient.Sign(Ethers.utils.keccak256(compressedToken)));
1097
1017
 
1098
- function CreateSignedToken(_x7) {
1099
- return _CreateSignedToken.apply(this, arguments);
1100
- }
1018
+ case 40:
1019
+ signature = _context11.sent;
1020
+ return _context11.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1101
1021
 
1102
- return CreateSignedToken;
1103
- }()
1022
+ case 42:
1023
+ case "end":
1024
+ return _context11.stop();
1025
+ }
1026
+ }
1027
+ }, null, this);
1028
+ }
1104
1029
  /**
1105
1030
  * Get the account address of the current signer
1106
1031
  *
@@ -1123,37 +1048,29 @@ var ElvClient = /*#__PURE__*/function () {
1123
1048
 
1124
1049
  }, {
1125
1050
  key: "SetOauthToken",
1126
- value: function () {
1127
- var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref14) {
1128
- var token, wallet, signer;
1129
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1130
- while (1) {
1131
- switch (_context12.prev = _context12.next) {
1132
- case 0:
1133
- token = _ref14.token;
1134
- this.oauthToken = token;
1135
- wallet = this.GenerateWallet();
1136
- signer = wallet.AddAccountFromMnemonic({
1137
- mnemonic: wallet.GenerateMnemonic()
1138
- });
1139
- this.SetSigner({
1140
- signer: signer
1141
- });
1142
-
1143
- case 5:
1144
- case "end":
1145
- return _context12.stop();
1146
- }
1051
+ value: function SetOauthToken(_ref14) {
1052
+ var token, wallet, signer;
1053
+ return _regeneratorRuntime.async(function SetOauthToken$(_context12) {
1054
+ while (1) {
1055
+ switch (_context12.prev = _context12.next) {
1056
+ case 0:
1057
+ token = _ref14.token;
1058
+ this.oauthToken = token;
1059
+ wallet = this.GenerateWallet();
1060
+ signer = wallet.AddAccountFromMnemonic({
1061
+ mnemonic: wallet.GenerateMnemonic()
1062
+ });
1063
+ this.SetSigner({
1064
+ signer: signer
1065
+ });
1066
+
1067
+ case 5:
1068
+ case "end":
1069
+ return _context12.stop();
1147
1070
  }
1148
- }, _callee12, this);
1149
- }));
1150
-
1151
- function SetOauthToken(_x8) {
1152
- return _SetOauthToken.apply(this, arguments);
1153
- }
1154
-
1155
- return SetOauthToken;
1156
- }()
1071
+ }
1072
+ }, null, this);
1073
+ }
1157
1074
  /**
1158
1075
  * Set the signer for this client via OAuth token. The client will exchange the given token
1159
1076
  * for the user's private key using the KMS specified in the configuration.
@@ -1167,121 +1084,113 @@ var ElvClient = /*#__PURE__*/function () {
1167
1084
 
1168
1085
  }, {
1169
1086
  key: "SetSignerFromOauthToken",
1170
- value: function () {
1171
- var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref15) {
1172
- var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
1173
-
1174
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1175
- while (1) {
1176
- switch (_context13.prev = _context13.next) {
1177
- case 0:
1178
- token = _ref15.token;
1179
-
1180
- if (this.trustAuthorityId) {
1181
- _context13.next = 3;
1182
- break;
1183
- }
1184
-
1185
- throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1186
-
1187
- case 3:
1188
- wallet = this.GenerateWallet();
1189
- _context13.prev = 4;
1190
-
1191
- if (this.kmsURIs) {
1192
- _context13.next = 17;
1193
- break;
1194
- }
1087
+ value: function SetSignerFromOauthToken(_ref15) {
1088
+ var token, wallet, client, _ref16, urls, path, httpClient, response, privateKey;
1195
1089
 
1196
- _context13.next = 8;
1197
- return ElvClient.FromConfigurationUrl({
1198
- configUrl: this.configUrl
1199
- });
1200
-
1201
- case 8:
1202
- client = _context13.sent;
1203
- client.SetSigner({
1204
- signer: wallet.AddAccountFromMnemonic({
1205
- mnemonic: wallet.GenerateMnemonic()
1206
- })
1207
- });
1208
- _context13.next = 12;
1209
- return client.authClient.KMSInfo({
1210
- kmsId: this.trustAuthorityId
1211
- });
1212
-
1213
- case 12:
1214
- _yield$client$authCli = _context13.sent;
1215
- urls = _yield$client$authCli.urls;
1090
+ return _regeneratorRuntime.async(function SetSignerFromOauthToken$(_context13) {
1091
+ while (1) {
1092
+ switch (_context13.prev = _context13.next) {
1093
+ case 0:
1094
+ token = _ref15.token;
1216
1095
 
1217
- if (!(!urls || urls.length === 0)) {
1218
- _context13.next = 16;
1219
- break;
1220
- }
1096
+ if (this.trustAuthorityId) {
1097
+ _context13.next = 3;
1098
+ break;
1099
+ }
1221
1100
 
1222
- throw Error("Unable to authorize with OAuth token: No KMS URLs set");
1101
+ throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1223
1102
 
1224
- case 16:
1225
- this.kmsURIs = urls;
1103
+ case 3:
1104
+ wallet = this.GenerateWallet();
1105
+ _context13.prev = 4;
1226
1106
 
1227
- case 17:
1228
- this.oauthToken = token;
1229
- path = "/ks/jwt/wlt";
1230
- httpClient = new HttpClient({
1231
- uris: this.kmsURIs,
1232
- debug: this.debug
1233
- });
1234
- _context13.next = 22;
1235
- return this.utils.ResponseToJson(httpClient.Request({
1236
- headers: {
1237
- Authorization: "Bearer ".concat(token)
1238
- },
1239
- method: "PUT",
1240
- path: path,
1241
- forceFailover: true
1242
- }));
1243
-
1244
- case 22:
1245
- response = _context13.sent;
1246
- privateKey = response["UserSKHex"];
1247
- this.SetSigner({
1248
- signer: wallet.AddAccount({
1249
- privateKey: privateKey
1250
- })
1251
- }); // Ensure wallet is initialized
1107
+ if (this.kmsURIs) {
1108
+ _context13.next = 17;
1109
+ break;
1110
+ }
1252
1111
 
1253
- _context13.next = 27;
1254
- return this.userProfileClient.WalletAddress();
1112
+ _context13.next = 8;
1113
+ return _regeneratorRuntime.awrap(ElvClient.FromConfigurationUrl({
1114
+ configUrl: this.configUrl
1115
+ }));
1255
1116
 
1256
- case 27:
1257
- _context13.next = 36;
1117
+ case 8:
1118
+ client = _context13.sent;
1119
+ client.SetSigner({
1120
+ signer: wallet.AddAccountFromMnemonic({
1121
+ mnemonic: wallet.GenerateMnemonic()
1122
+ })
1123
+ });
1124
+ _context13.next = 12;
1125
+ return _regeneratorRuntime.awrap(client.authClient.KMSInfo({
1126
+ kmsId: this.trustAuthorityId
1127
+ }));
1128
+
1129
+ case 12:
1130
+ _ref16 = _context13.sent;
1131
+ urls = _ref16.urls;
1132
+
1133
+ if (!(!urls || urls.length === 0)) {
1134
+ _context13.next = 16;
1258
1135
  break;
1136
+ }
1259
1137
 
1260
- case 29:
1261
- _context13.prev = 29;
1262
- _context13.t0 = _context13["catch"](4);
1263
- this.Log("Failed to set signer from OAuth token:", true);
1264
- this.Log(_context13.t0, true);
1265
- _context13.next = 35;
1266
- return this.ClearSigner();
1267
-
1268
- case 35:
1269
- throw _context13.t0;
1270
-
1271
- case 36:
1272
- case "end":
1273
- return _context13.stop();
1274
- }
1138
+ throw Error("Unable to authorize with OAuth token: No KMS URLs set");
1139
+
1140
+ case 16:
1141
+ this.kmsURIs = urls;
1142
+
1143
+ case 17:
1144
+ this.oauthToken = token;
1145
+ path = "/ks/jwt/wlt";
1146
+ httpClient = new HttpClient({
1147
+ uris: this.kmsURIs,
1148
+ debug: this.debug
1149
+ });
1150
+ _context13.next = 22;
1151
+ return _regeneratorRuntime.awrap(this.utils.ResponseToJson(httpClient.Request({
1152
+ headers: {
1153
+ Authorization: "Bearer ".concat(token)
1154
+ },
1155
+ method: "PUT",
1156
+ path: path,
1157
+ forceFailover: true
1158
+ })));
1159
+
1160
+ case 22:
1161
+ response = _context13.sent;
1162
+ privateKey = response["UserSKHex"];
1163
+ this.SetSigner({
1164
+ signer: wallet.AddAccount({
1165
+ privateKey: privateKey
1166
+ })
1167
+ }); // Ensure wallet is initialized
1168
+
1169
+ _context13.next = 27;
1170
+ return _regeneratorRuntime.awrap(this.userProfileClient.WalletAddress());
1171
+
1172
+ case 27:
1173
+ _context13.next = 36;
1174
+ break;
1175
+
1176
+ case 29:
1177
+ _context13.prev = 29;
1178
+ _context13.t0 = _context13["catch"](4);
1179
+ this.Log("Failed to set signer from OAuth token:", true);
1180
+ this.Log(_context13.t0, true);
1181
+ _context13.next = 35;
1182
+ return _regeneratorRuntime.awrap(this.ClearSigner());
1183
+
1184
+ case 35:
1185
+ throw _context13.t0;
1186
+
1187
+ case 36:
1188
+ case "end":
1189
+ return _context13.stop();
1275
1190
  }
1276
- }, _callee13, this, [[4, 29]]);
1277
- }));
1278
-
1279
- function SetSignerFromOauthToken(_x9) {
1280
- return _SetSignerFromOauthToken.apply(this, arguments);
1281
- }
1282
-
1283
- return SetSignerFromOauthToken;
1284
- }()
1191
+ }
1192
+ }, null, this, [[4, 29]]);
1193
+ }
1285
1194
  /**
1286
1195
  * Set a static token for the client to use for all authorization
1287
1196
  *
@@ -1293,8 +1202,8 @@ var ElvClient = /*#__PURE__*/function () {
1293
1202
  }, {
1294
1203
  key: "SetStaticToken",
1295
1204
  value: function SetStaticToken() {
1296
- var _ref16 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1297
- token = _ref16.token;
1205
+ var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1206
+ token = _ref17.token;
1298
1207
 
1299
1208
  if (!token) {
1300
1209
  token = this.utils.B64(JSON.stringify({
@@ -1325,42 +1234,34 @@ var ElvClient = /*#__PURE__*/function () {
1325
1234
 
1326
1235
  }, {
1327
1236
  key: "SetPolicyAuthorization",
1328
- value: function () {
1329
- var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref17) {
1330
- var objectId;
1331
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1332
- while (1) {
1333
- switch (_context14.prev = _context14.next) {
1334
- case 0:
1335
- objectId = _ref17.objectId;
1336
- _context14.t0 = this;
1337
- _context14.next = 4;
1338
- return this.GenerateStateChannelToken({
1339
- objectId: objectId
1340
- });
1341
-
1342
- case 4:
1343
- _context14.t1 = _context14.sent;
1344
- _context14.t2 = {
1345
- token: _context14.t1
1346
- };
1347
-
1348
- _context14.t0.SetStaticToken.call(_context14.t0, _context14.t2);
1349
-
1350
- case 7:
1351
- case "end":
1352
- return _context14.stop();
1353
- }
1237
+ value: function SetPolicyAuthorization(_ref18) {
1238
+ var objectId;
1239
+ return _regeneratorRuntime.async(function SetPolicyAuthorization$(_context14) {
1240
+ while (1) {
1241
+ switch (_context14.prev = _context14.next) {
1242
+ case 0:
1243
+ objectId = _ref18.objectId;
1244
+ _context14.t0 = this;
1245
+ _context14.next = 4;
1246
+ return _regeneratorRuntime.awrap(this.GenerateStateChannelToken({
1247
+ objectId: objectId
1248
+ }));
1249
+
1250
+ case 4:
1251
+ _context14.t1 = _context14.sent;
1252
+ _context14.t2 = {
1253
+ token: _context14.t1
1254
+ };
1255
+
1256
+ _context14.t0.SetStaticToken.call(_context14.t0, _context14.t2);
1257
+
1258
+ case 7:
1259
+ case "end":
1260
+ return _context14.stop();
1354
1261
  }
1355
- }, _callee14, this);
1356
- }));
1357
-
1358
- function SetPolicyAuthorization(_x10) {
1359
- return _SetPolicyAuthorization.apply(this, arguments);
1360
- }
1361
-
1362
- return SetPolicyAuthorization;
1363
- }()
1262
+ }
1263
+ }, null, this);
1264
+ }
1364
1265
  /**
1365
1266
  * Create a signature for the specified string
1366
1267
  *
@@ -1370,34 +1271,26 @@ var ElvClient = /*#__PURE__*/function () {
1370
1271
 
1371
1272
  }, {
1372
1273
  key: "Sign",
1373
- value: function () {
1374
- var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(string) {
1375
- var signature;
1376
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1377
- while (1) {
1378
- switch (_context15.prev = _context15.next) {
1379
- case 0:
1380
- _context15.next = 2;
1381
- return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
1382
-
1383
- case 2:
1384
- signature = _context15.sent;
1385
- return _context15.abrupt("return", this.utils.FormatSignature(signature));
1386
-
1387
- case 4:
1388
- case "end":
1389
- return _context15.stop();
1390
- }
1274
+ value: function Sign(string) {
1275
+ var signature;
1276
+ return _regeneratorRuntime.async(function Sign$(_context15) {
1277
+ while (1) {
1278
+ switch (_context15.prev = _context15.next) {
1279
+ case 0:
1280
+ _context15.next = 2;
1281
+ return _regeneratorRuntime.awrap(this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string))));
1282
+
1283
+ case 2:
1284
+ signature = _context15.sent;
1285
+ return _context15.abrupt("return", this.utils.FormatSignature(signature));
1286
+
1287
+ case 4:
1288
+ case "end":
1289
+ return _context15.stop();
1391
1290
  }
1392
- }, _callee15, this);
1393
- }));
1394
-
1395
- function Sign(_x11) {
1396
- return _Sign.apply(this, arguments);
1397
- }
1398
-
1399
- return Sign;
1400
- }()
1291
+ }
1292
+ }, null, this);
1293
+ }
1401
1294
  /**
1402
1295
  * Encrypt the given string or object with the current signer's public key
1403
1296
  *
@@ -1410,44 +1303,36 @@ var ElvClient = /*#__PURE__*/function () {
1410
1303
 
1411
1304
  }, {
1412
1305
  key: "EncryptECIES",
1413
- value: function () {
1414
- var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref18) {
1415
- var message, publicKey;
1416
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1417
- while (1) {
1418
- switch (_context16.prev = _context16.next) {
1419
- case 0:
1420
- message = _ref18.message, publicKey = _ref18.publicKey;
1421
-
1422
- if (this.signer) {
1423
- _context16.next = 3;
1424
- break;
1425
- }
1306
+ value: function EncryptECIES(_ref19) {
1307
+ var message, publicKey;
1308
+ return _regeneratorRuntime.async(function EncryptECIES$(_context16) {
1309
+ while (1) {
1310
+ switch (_context16.prev = _context16.next) {
1311
+ case 0:
1312
+ message = _ref19.message, publicKey = _ref19.publicKey;
1313
+
1314
+ if (this.signer) {
1315
+ _context16.next = 3;
1316
+ break;
1317
+ }
1426
1318
 
1427
- throw "Signer not set";
1319
+ throw "Signer not set";
1428
1320
 
1429
- case 3:
1430
- ValidatePresence("message", message);
1431
- _context16.next = 6;
1432
- return this.Crypto.EncryptConk(message, publicKey || this.signer.signingKey.keyPair.publicKey);
1321
+ case 3:
1322
+ ValidatePresence("message", message);
1323
+ _context16.next = 6;
1324
+ return _regeneratorRuntime.awrap(this.Crypto.EncryptConk(message, publicKey || this.signer.signingKey.keyPair.publicKey));
1433
1325
 
1434
- case 6:
1435
- return _context16.abrupt("return", _context16.sent);
1326
+ case 6:
1327
+ return _context16.abrupt("return", _context16.sent);
1436
1328
 
1437
- case 7:
1438
- case "end":
1439
- return _context16.stop();
1440
- }
1329
+ case 7:
1330
+ case "end":
1331
+ return _context16.stop();
1441
1332
  }
1442
- }, _callee16, this);
1443
- }));
1444
-
1445
- function EncryptECIES(_x12) {
1446
- return _EncryptECIES.apply(this, arguments);
1447
- }
1448
-
1449
- return EncryptECIES;
1450
- }()
1333
+ }
1334
+ }, null, this);
1335
+ }
1451
1336
  /**
1452
1337
  * Decrypt the given encrypted message with the current signer's private key
1453
1338
  *
@@ -1459,44 +1344,36 @@ var ElvClient = /*#__PURE__*/function () {
1459
1344
 
1460
1345
  }, {
1461
1346
  key: "DecryptECIES",
1462
- value: function () {
1463
- var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref19) {
1464
- var message;
1465
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1466
- while (1) {
1467
- switch (_context17.prev = _context17.next) {
1468
- case 0:
1469
- message = _ref19.message;
1470
-
1471
- if (this.signer) {
1472
- _context17.next = 3;
1473
- break;
1474
- }
1347
+ value: function DecryptECIES(_ref20) {
1348
+ var message;
1349
+ return _regeneratorRuntime.async(function DecryptECIES$(_context17) {
1350
+ while (1) {
1351
+ switch (_context17.prev = _context17.next) {
1352
+ case 0:
1353
+ message = _ref20.message;
1354
+
1355
+ if (this.signer) {
1356
+ _context17.next = 3;
1357
+ break;
1358
+ }
1475
1359
 
1476
- throw "Signer not set";
1360
+ throw "Signer not set";
1477
1361
 
1478
- case 3:
1479
- ValidatePresence("message", message);
1480
- _context17.next = 6;
1481
- return this.Crypto.DecryptCap(message, this.signer.signingKey.privateKey);
1362
+ case 3:
1363
+ ValidatePresence("message", message);
1364
+ _context17.next = 6;
1365
+ return _regeneratorRuntime.awrap(this.Crypto.DecryptCap(message, this.signer.signingKey.privateKey));
1482
1366
 
1483
- case 6:
1484
- return _context17.abrupt("return", _context17.sent);
1367
+ case 6:
1368
+ return _context17.abrupt("return", _context17.sent);
1485
1369
 
1486
- case 7:
1487
- case "end":
1488
- return _context17.stop();
1489
- }
1370
+ case 7:
1371
+ case "end":
1372
+ return _context17.stop();
1490
1373
  }
1491
- }, _callee17, this);
1492
- }));
1493
-
1494
- function DecryptECIES(_x13) {
1495
- return _DecryptECIES.apply(this, arguments);
1496
- }
1497
-
1498
- return DecryptECIES;
1499
- }()
1374
+ }
1375
+ }, null, this);
1376
+ }
1500
1377
  /**
1501
1378
  * Request the specified URL with the given method and body, and return the result in the specified format
1502
1379
  *
@@ -1511,35 +1388,27 @@ var ElvClient = /*#__PURE__*/function () {
1511
1388
 
1512
1389
  }, {
1513
1390
  key: "Request",
1514
- value: function () {
1515
- var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref20) {
1516
- var url, _ref20$format, format, _ref20$method, method, _ref20$headers, headers, body;
1517
-
1518
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1519
- while (1) {
1520
- switch (_context18.prev = _context18.next) {
1521
- case 0:
1522
- url = _ref20.url, _ref20$format = _ref20.format, format = _ref20$format === void 0 ? "json" : _ref20$format, _ref20$method = _ref20.method, method = _ref20$method === void 0 ? "GET" : _ref20$method, _ref20$headers = _ref20.headers, headers = _ref20$headers === void 0 ? {} : _ref20$headers, body = _ref20.body;
1523
- return _context18.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1524
- method: method,
1525
- headers: headers,
1526
- body: body
1527
- })));
1528
-
1529
- case 2:
1530
- case "end":
1531
- return _context18.stop();
1532
- }
1391
+ value: function Request(_ref21) {
1392
+ var url, _ref21$format, format, _ref21$method, method, _ref21$headers, headers, body;
1393
+
1394
+ return _regeneratorRuntime.async(function Request$(_context18) {
1395
+ while (1) {
1396
+ switch (_context18.prev = _context18.next) {
1397
+ case 0:
1398
+ url = _ref21.url, _ref21$format = _ref21.format, format = _ref21$format === void 0 ? "json" : _ref21$format, _ref21$method = _ref21.method, method = _ref21$method === void 0 ? "GET" : _ref21$method, _ref21$headers = _ref21.headers, headers = _ref21$headers === void 0 ? {} : _ref21$headers, body = _ref21.body;
1399
+ return _context18.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1400
+ method: method,
1401
+ headers: headers,
1402
+ body: body
1403
+ })));
1404
+
1405
+ case 2:
1406
+ case "end":
1407
+ return _context18.stop();
1533
1408
  }
1534
- }, _callee18, this);
1535
- }));
1536
-
1537
- function Request(_x14) {
1538
- return _Request.apply(this, arguments);
1539
- }
1540
-
1541
- return Request;
1542
- }()
1409
+ }
1410
+ }, null, this);
1411
+ }
1543
1412
  /* FrameClient related */
1544
1413
  // Whitelist of methods allowed to be called using the frame API
1545
1414
 
@@ -1556,195 +1425,179 @@ var ElvClient = /*#__PURE__*/function () {
1556
1425
 
1557
1426
  }, {
1558
1427
  key: "CallFromFrameMessage",
1559
- value: function () {
1560
- var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(message, Respond) {
1561
- var _this3 = this;
1562
-
1563
- var callback, method, methodResults, responseError;
1564
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1565
- while (1) {
1566
- switch (_context19.prev = _context19.next) {
1567
- case 0:
1568
- if (!(message.type !== "ElvFrameRequest")) {
1569
- _context19.next = 2;
1570
- break;
1571
- }
1572
-
1573
- return _context19.abrupt("return");
1574
-
1575
- case 2:
1576
- if (message.callbackId) {
1577
- callback = function callback(result) {
1578
- Respond(_this3.utils.MakeClonable({
1579
- type: "ElvFrameResponse",
1580
- requestId: message.callbackId,
1581
- response: result
1582
- }));
1583
- };
1584
-
1585
- message.args.callback = callback;
1586
- }
1587
-
1588
- _context19.prev = 3;
1589
- method = message.calledMethod;
1428
+ value: function CallFromFrameMessage(message, Respond) {
1429
+ var _this3 = this;
1430
+
1431
+ var callback, method, methodResults, responseError;
1432
+ return _regeneratorRuntime.async(function CallFromFrameMessage$(_context19) {
1433
+ while (1) {
1434
+ switch (_context19.prev = _context19.next) {
1435
+ case 0:
1436
+ if (!(message.type !== "ElvFrameRequest")) {
1437
+ _context19.next = 2;
1438
+ break;
1439
+ }
1590
1440
 
1591
- if (!(message.module === "userProfileClient")) {
1592
- _context19.next = 13;
1593
- break;
1594
- }
1441
+ return _context19.abrupt("return");
1595
1442
 
1596
- if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1597
- _context19.next = 8;
1598
- break;
1599
- }
1443
+ case 2:
1444
+ if (message.callbackId) {
1445
+ callback = function callback(result) {
1446
+ Respond(_this3.utils.MakeClonable({
1447
+ type: "ElvFrameResponse",
1448
+ requestId: message.callbackId,
1449
+ response: result
1450
+ }));
1451
+ };
1600
1452
 
1601
- throw Error("Invalid user profile method: " + method);
1453
+ message.args.callback = callback;
1454
+ }
1602
1455
 
1603
- case 8:
1604
- _context19.next = 10;
1605
- return this.userProfileClient[method](message.args);
1456
+ _context19.prev = 3;
1457
+ method = message.calledMethod;
1606
1458
 
1607
- case 10:
1608
- methodResults = _context19.sent;
1609
- _context19.next = 18;
1459
+ if (!(message.module === "userProfileClient")) {
1460
+ _context19.next = 13;
1610
1461
  break;
1462
+ }
1611
1463
 
1612
- case 13:
1613
- if (this.FrameAllowedMethods().includes(method)) {
1614
- _context19.next = 15;
1615
- break;
1616
- }
1464
+ if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1465
+ _context19.next = 8;
1466
+ break;
1467
+ }
1617
1468
 
1618
- throw Error("Invalid method: " + method);
1469
+ throw Error("Invalid user profile method: " + method);
1619
1470
 
1620
- case 15:
1621
- _context19.next = 17;
1622
- return this[method](message.args);
1471
+ case 8:
1472
+ _context19.next = 10;
1473
+ return _regeneratorRuntime.awrap(this.userProfileClient[method](message.args));
1623
1474
 
1624
- case 17:
1625
- methodResults = _context19.sent;
1475
+ case 10:
1476
+ methodResults = _context19.sent;
1477
+ _context19.next = 18;
1478
+ break;
1626
1479
 
1627
- case 18:
1628
- Respond(this.utils.MakeClonable({
1629
- type: "ElvFrameResponse",
1630
- requestId: message.requestId,
1631
- response: methodResults
1632
- }));
1633
- _context19.next = 27;
1480
+ case 13:
1481
+ if (this.FrameAllowedMethods().includes(method)) {
1482
+ _context19.next = 15;
1634
1483
  break;
1484
+ }
1635
1485
 
1636
- case 21:
1637
- _context19.prev = 21;
1638
- _context19.t0 = _context19["catch"](3);
1639
- // eslint-disable-next-line no-console
1640
- this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context19.t0) === "object" ? JSON.stringify(_context19.t0, null, 2) : _context19.t0), true); // eslint-disable-next-line no-console
1641
-
1642
- console.error(_context19.t0);
1643
- responseError = _context19.t0 instanceof Error ? _context19.t0.message : _context19.t0;
1644
- Respond(this.utils.MakeClonable({
1645
- type: "ElvFrameResponse",
1646
- requestId: message.requestId,
1647
- error: responseError
1648
- }));
1649
-
1650
- case 27:
1651
- case "end":
1652
- return _context19.stop();
1653
- }
1486
+ throw Error("Invalid method: " + method);
1487
+
1488
+ case 15:
1489
+ _context19.next = 17;
1490
+ return _regeneratorRuntime.awrap(this[method](message.args));
1491
+
1492
+ case 17:
1493
+ methodResults = _context19.sent;
1494
+
1495
+ case 18:
1496
+ Respond(this.utils.MakeClonable({
1497
+ type: "ElvFrameResponse",
1498
+ requestId: message.requestId,
1499
+ response: methodResults
1500
+ }));
1501
+ _context19.next = 27;
1502
+ break;
1503
+
1504
+ case 21:
1505
+ _context19.prev = 21;
1506
+ _context19.t0 = _context19["catch"](3);
1507
+ // eslint-disable-next-line no-console
1508
+ this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context19.t0) === "object" ? JSON.stringify(_context19.t0, null, 2) : _context19.t0), true); // eslint-disable-next-line no-console
1509
+
1510
+ console.error(_context19.t0);
1511
+ responseError = _context19.t0 instanceof Error ? _context19.t0.message : _context19.t0;
1512
+ Respond(this.utils.MakeClonable({
1513
+ type: "ElvFrameResponse",
1514
+ requestId: message.requestId,
1515
+ error: responseError
1516
+ }));
1517
+
1518
+ case 27:
1519
+ case "end":
1520
+ return _context19.stop();
1654
1521
  }
1655
- }, _callee19, this, [[3, 21]]);
1656
- }));
1657
-
1658
- function CallFromFrameMessage(_x15, _x16) {
1659
- return _CallFromFrameMessage.apply(this, arguments);
1660
- }
1661
-
1662
- return CallFromFrameMessage;
1663
- }()
1522
+ }
1523
+ }, null, this, [[3, 21]]);
1524
+ }
1664
1525
  }], [{
1665
1526
  key: "Configuration",
1666
- value: function () {
1667
- var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref21) {
1668
- var configUrl, _ref21$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion;
1669
-
1670
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1671
- while (1) {
1672
- switch (_context20.prev = _context20.next) {
1673
- case 0:
1674
- configUrl = _ref21.configUrl, _ref21$kmsUrls = _ref21.kmsUrls, kmsUrls = _ref21$kmsUrls === void 0 ? [] : _ref21$kmsUrls, region = _ref21.region;
1675
- _context20.prev = 1;
1676
- uri = new URI(configUrl);
1677
- uri.pathname("/config");
1678
-
1679
- if (region) {
1680
- uri.addSearch("elvgeo", region);
1681
- }
1682
-
1683
- _context20.next = 7;
1684
- return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
1685
-
1686
- case 7:
1687
- fabricInfo = _context20.sent;
1688
-
1689
- // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1690
- filterHTTPS = function filterHTTPS(uri) {
1691
- return uri.toLowerCase().startsWith("https");
1692
- };
1527
+ value: function Configuration(_ref22) {
1528
+ var configUrl, _ref22$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion;
1529
+
1530
+ return _regeneratorRuntime.async(function Configuration$(_context20) {
1531
+ while (1) {
1532
+ switch (_context20.prev = _context20.next) {
1533
+ case 0:
1534
+ configUrl = _ref22.configUrl, _ref22$kmsUrls = _ref22.kmsUrls, kmsUrls = _ref22$kmsUrls === void 0 ? [] : _ref22$kmsUrls, region = _ref22.region;
1535
+ _context20.prev = 1;
1536
+ uri = new URI(configUrl);
1537
+ uri.pathname("/config");
1538
+
1539
+ if (region) {
1540
+ uri.addSearch("elvgeo", region);
1541
+ }
1693
1542
 
1694
- fabricURIs = fabricInfo.network.services.fabric_api;
1543
+ _context20.next = 7;
1544
+ return _regeneratorRuntime.awrap(Utils.ResponseToJson(HttpClient.Fetch(uri.toString())));
1695
1545
 
1696
- if (fabricURIs.find(filterHTTPS)) {
1697
- fabricURIs = fabricURIs.filter(filterHTTPS);
1698
- }
1546
+ case 7:
1547
+ fabricInfo = _context20.sent;
1699
1548
 
1700
- ethereumURIs = fabricInfo.network.services.ethereum_api;
1549
+ // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1550
+ filterHTTPS = function filterHTTPS(uri) {
1551
+ return uri.toLowerCase().startsWith("https");
1552
+ };
1701
1553
 
1702
- if (ethereumURIs.find(filterHTTPS)) {
1703
- ethereumURIs = ethereumURIs.filter(filterHTTPS);
1704
- }
1554
+ fabricURIs = fabricInfo.network.services.fabric_api;
1705
1555
 
1706
- authServiceURIs = fabricInfo.network.services.authority_service || [];
1556
+ if (fabricURIs.find(filterHTTPS)) {
1557
+ fabricURIs = fabricURIs.filter(filterHTTPS);
1558
+ }
1707
1559
 
1708
- if (authServiceURIs.find(filterHTTPS)) {
1709
- authServiceURIs = authServiceURIs.filter(filterHTTPS);
1710
- }
1560
+ ethereumURIs = fabricInfo.network.services.ethereum_api;
1711
1561
 
1712
- fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1713
- return _context20.abrupt("return", {
1714
- nodeId: fabricInfo.node_id,
1715
- contentSpaceId: fabricInfo.qspace.id,
1716
- networkId: (fabricInfo.qspace.ethereum || {}).network_id,
1717
- networkName: ((fabricInfo.qspace || {}).names || [])[0],
1718
- fabricURIs: fabricURIs,
1719
- ethereumURIs: ethereumURIs,
1720
- authServiceURIs: authServiceURIs,
1721
- kmsURIs: kmsUrls,
1722
- fabricVersion: fabricVersion
1723
- });
1562
+ if (ethereumURIs.find(filterHTTPS)) {
1563
+ ethereumURIs = ethereumURIs.filter(filterHTTPS);
1564
+ }
1724
1565
 
1725
- case 19:
1726
- _context20.prev = 19;
1727
- _context20.t0 = _context20["catch"](1);
1728
- // eslint-disable-next-line no-console
1729
- console.error("Error retrieving fabric configuration:"); // eslint-disable-next-line no-console
1566
+ authServiceURIs = fabricInfo.network.services.authority_service || [];
1730
1567
 
1731
- console.error(_context20.t0);
1732
- throw _context20.t0;
1568
+ if (authServiceURIs.find(filterHTTPS)) {
1569
+ authServiceURIs = authServiceURIs.filter(filterHTTPS);
1570
+ }
1733
1571
 
1734
- case 24:
1735
- case "end":
1736
- return _context20.stop();
1737
- }
1572
+ fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1573
+ return _context20.abrupt("return", {
1574
+ nodeId: fabricInfo.node_id,
1575
+ contentSpaceId: fabricInfo.qspace.id,
1576
+ networkId: (fabricInfo.qspace.ethereum || {}).network_id,
1577
+ networkName: ((fabricInfo.qspace || {}).names || [])[0],
1578
+ fabricURIs: fabricURIs,
1579
+ ethereumURIs: ethereumURIs,
1580
+ authServiceURIs: authServiceURIs,
1581
+ kmsURIs: kmsUrls,
1582
+ fabricVersion: fabricVersion
1583
+ });
1584
+
1585
+ case 19:
1586
+ _context20.prev = 19;
1587
+ _context20.t0 = _context20["catch"](1);
1588
+ // eslint-disable-next-line no-console
1589
+ console.error("Error retrieving fabric configuration:"); // eslint-disable-next-line no-console
1590
+
1591
+ console.error(_context20.t0);
1592
+ throw _context20.t0;
1593
+
1594
+ case 24:
1595
+ case "end":
1596
+ return _context20.stop();
1738
1597
  }
1739
- }, _callee20, null, [[1, 19]]);
1740
- }));
1741
-
1742
- function Configuration(_x17) {
1743
- return _Configuration.apply(this, arguments);
1744
- }
1745
-
1746
- return Configuration;
1747
- }()
1598
+ }
1599
+ }, null, null, [[1, 19]]);
1600
+ }
1748
1601
  /**
1749
1602
  * Create a new ElvClient for the specified network
1750
1603
  *
@@ -1763,54 +1616,46 @@ var ElvClient = /*#__PURE__*/function () {
1763
1616
 
1764
1617
  }, {
1765
1618
  key: "FromNetworkName",
1766
- value: function () {
1767
- var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref22) {
1768
- var networkName, region, trustAuthorityId, staticToken, _ref22$ethereumContra, ethereumContractTimeout, _ref22$noCache, noCache, _ref22$noAuth, noAuth, assumeV3, configUrl;
1769
-
1770
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1771
- while (1) {
1772
- switch (_context21.prev = _context21.next) {
1773
- case 0:
1774
- networkName = _ref22.networkName, region = _ref22.region, trustAuthorityId = _ref22.trustAuthorityId, staticToken = _ref22.staticToken, _ref22$ethereumContra = _ref22.ethereumContractTimeout, ethereumContractTimeout = _ref22$ethereumContra === void 0 ? 10 : _ref22$ethereumContra, _ref22$noCache = _ref22.noCache, noCache = _ref22$noCache === void 0 ? false : _ref22$noCache, _ref22$noAuth = _ref22.noAuth, noAuth = _ref22$noAuth === void 0 ? false : _ref22$noAuth, assumeV3 = _ref22.assumeV3;
1775
- configUrl = networks[networkName];
1776
-
1777
- if (configUrl) {
1778
- _context21.next = 4;
1779
- break;
1780
- }
1781
-
1782
- throw Error("Invalid network name: " + networkName);
1783
-
1784
- case 4:
1785
- _context21.next = 6;
1786
- return this.FromConfigurationUrl({
1787
- configUrl: configUrl,
1788
- region: region,
1789
- trustAuthorityId: trustAuthorityId,
1790
- staticToken: staticToken,
1791
- ethereumContractTimeout: ethereumContractTimeout,
1792
- noCache: noCache,
1793
- noAuth: noAuth,
1794
- assumeV3: assumeV3
1795
- });
1796
-
1797
- case 6:
1798
- return _context21.abrupt("return", _context21.sent);
1619
+ value: function FromNetworkName(_ref23) {
1620
+ var networkName, region, trustAuthorityId, staticToken, _ref23$ethereumContra, ethereumContractTimeout, _ref23$noCache, noCache, _ref23$noAuth, noAuth, assumeV3, configUrl;
1621
+
1622
+ return _regeneratorRuntime.async(function FromNetworkName$(_context21) {
1623
+ while (1) {
1624
+ switch (_context21.prev = _context21.next) {
1625
+ case 0:
1626
+ networkName = _ref23.networkName, region = _ref23.region, trustAuthorityId = _ref23.trustAuthorityId, staticToken = _ref23.staticToken, _ref23$ethereumContra = _ref23.ethereumContractTimeout, ethereumContractTimeout = _ref23$ethereumContra === void 0 ? 10 : _ref23$ethereumContra, _ref23$noCache = _ref23.noCache, noCache = _ref23$noCache === void 0 ? false : _ref23$noCache, _ref23$noAuth = _ref23.noAuth, noAuth = _ref23$noAuth === void 0 ? false : _ref23$noAuth, assumeV3 = _ref23.assumeV3;
1627
+ configUrl = networks[networkName];
1628
+
1629
+ if (configUrl) {
1630
+ _context21.next = 4;
1631
+ break;
1632
+ }
1799
1633
 
1800
- case 7:
1801
- case "end":
1802
- return _context21.stop();
1803
- }
1634
+ throw Error("Invalid network name: " + networkName);
1635
+
1636
+ case 4:
1637
+ _context21.next = 6;
1638
+ return _regeneratorRuntime.awrap(this.FromConfigurationUrl({
1639
+ configUrl: configUrl,
1640
+ region: region,
1641
+ trustAuthorityId: trustAuthorityId,
1642
+ staticToken: staticToken,
1643
+ ethereumContractTimeout: ethereumContractTimeout,
1644
+ noCache: noCache,
1645
+ noAuth: noAuth,
1646
+ assumeV3: assumeV3
1647
+ }));
1648
+
1649
+ case 6:
1650
+ return _context21.abrupt("return", _context21.sent);
1651
+
1652
+ case 7:
1653
+ case "end":
1654
+ return _context21.stop();
1804
1655
  }
1805
- }, _callee21, this);
1806
- }));
1807
-
1808
- function FromNetworkName(_x18) {
1809
- return _FromNetworkName.apply(this, arguments);
1810
- }
1811
-
1812
- return FromNetworkName;
1813
- }()
1656
+ }
1657
+ }, null, this);
1658
+ }
1814
1659
  /**
1815
1660
  * Create a new ElvClient from the specified configuration URL
1816
1661
  *
@@ -1829,62 +1674,54 @@ var ElvClient = /*#__PURE__*/function () {
1829
1674
 
1830
1675
  }, {
1831
1676
  key: "FromConfigurationUrl",
1832
- value: function () {
1833
- var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref23) {
1834
- var configUrl, region, trustAuthorityId, staticToken, _ref23$ethereumContra, ethereumContractTimeout, _ref23$noCache, noCache, _ref23$noAuth, noAuth, _ref23$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion, client;
1835
-
1836
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1837
- while (1) {
1838
- switch (_context22.prev = _context22.next) {
1839
- case 0:
1840
- configUrl = _ref23.configUrl, region = _ref23.region, trustAuthorityId = _ref23.trustAuthorityId, staticToken = _ref23.staticToken, _ref23$ethereumContra = _ref23.ethereumContractTimeout, ethereumContractTimeout = _ref23$ethereumContra === void 0 ? 10 : _ref23$ethereumContra, _ref23$noCache = _ref23.noCache, noCache = _ref23$noCache === void 0 ? false : _ref23$noCache, _ref23$noAuth = _ref23.noAuth, noAuth = _ref23$noAuth === void 0 ? false : _ref23$noAuth, _ref23$assumeV = _ref23.assumeV3, assumeV3 = _ref23$assumeV === void 0 ? false : _ref23$assumeV;
1841
- _context22.next = 3;
1842
- return ElvClient.Configuration({
1843
- configUrl: configUrl,
1844
- region: region
1845
- });
1846
-
1847
- case 3:
1848
- _yield$ElvClient$Conf3 = _context22.sent;
1849
- contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
1850
- networkId = _yield$ElvClient$Conf3.networkId;
1851
- networkName = _yield$ElvClient$Conf3.networkName;
1852
- fabricURIs = _yield$ElvClient$Conf3.fabricURIs;
1853
- ethereumURIs = _yield$ElvClient$Conf3.ethereumURIs;
1854
- authServiceURIs = _yield$ElvClient$Conf3.authServiceURIs;
1855
- fabricVersion = _yield$ElvClient$Conf3.fabricVersion;
1856
- client = new ElvClient({
1857
- contentSpaceId: contentSpaceId,
1858
- networkId: networkId,
1859
- networkName: networkName,
1860
- fabricVersion: fabricVersion,
1861
- fabricURIs: fabricURIs,
1862
- ethereumURIs: ethereumURIs,
1863
- authServiceURIs: authServiceURIs,
1864
- ethereumContractTimeout: ethereumContractTimeout,
1865
- trustAuthorityId: trustAuthorityId,
1866
- staticToken: staticToken,
1867
- noCache: noCache,
1868
- noAuth: noAuth,
1869
- assumeV3: assumeV3
1870
- });
1871
- client.configUrl = configUrl;
1872
- return _context22.abrupt("return", client);
1873
-
1874
- case 14:
1875
- case "end":
1876
- return _context22.stop();
1877
- }
1677
+ value: function FromConfigurationUrl(_ref24) {
1678
+ var configUrl, region, trustAuthorityId, staticToken, _ref24$ethereumContra, ethereumContractTimeout, _ref24$noCache, noCache, _ref24$noAuth, noAuth, _ref24$assumeV, assumeV3, _ref25, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion, client;
1679
+
1680
+ return _regeneratorRuntime.async(function FromConfigurationUrl$(_context22) {
1681
+ while (1) {
1682
+ switch (_context22.prev = _context22.next) {
1683
+ case 0:
1684
+ configUrl = _ref24.configUrl, region = _ref24.region, trustAuthorityId = _ref24.trustAuthorityId, staticToken = _ref24.staticToken, _ref24$ethereumContra = _ref24.ethereumContractTimeout, ethereumContractTimeout = _ref24$ethereumContra === void 0 ? 10 : _ref24$ethereumContra, _ref24$noCache = _ref24.noCache, noCache = _ref24$noCache === void 0 ? false : _ref24$noCache, _ref24$noAuth = _ref24.noAuth, noAuth = _ref24$noAuth === void 0 ? false : _ref24$noAuth, _ref24$assumeV = _ref24.assumeV3, assumeV3 = _ref24$assumeV === void 0 ? false : _ref24$assumeV;
1685
+ _context22.next = 3;
1686
+ return _regeneratorRuntime.awrap(ElvClient.Configuration({
1687
+ configUrl: configUrl,
1688
+ region: region
1689
+ }));
1690
+
1691
+ case 3:
1692
+ _ref25 = _context22.sent;
1693
+ contentSpaceId = _ref25.contentSpaceId;
1694
+ networkId = _ref25.networkId;
1695
+ networkName = _ref25.networkName;
1696
+ fabricURIs = _ref25.fabricURIs;
1697
+ ethereumURIs = _ref25.ethereumURIs;
1698
+ authServiceURIs = _ref25.authServiceURIs;
1699
+ fabricVersion = _ref25.fabricVersion;
1700
+ client = new ElvClient({
1701
+ contentSpaceId: contentSpaceId,
1702
+ networkId: networkId,
1703
+ networkName: networkName,
1704
+ fabricVersion: fabricVersion,
1705
+ fabricURIs: fabricURIs,
1706
+ ethereumURIs: ethereumURIs,
1707
+ authServiceURIs: authServiceURIs,
1708
+ ethereumContractTimeout: ethereumContractTimeout,
1709
+ trustAuthorityId: trustAuthorityId,
1710
+ staticToken: staticToken,
1711
+ noCache: noCache,
1712
+ noAuth: noAuth,
1713
+ assumeV3: assumeV3
1714
+ });
1715
+ client.configUrl = configUrl;
1716
+ return _context22.abrupt("return", client);
1717
+
1718
+ case 14:
1719
+ case "end":
1720
+ return _context22.stop();
1878
1721
  }
1879
- }, _callee22);
1880
- }));
1881
-
1882
- function FromConfigurationUrl(_x19) {
1883
- return _FromConfigurationUrl.apply(this, arguments);
1884
- }
1885
-
1886
- return FromConfigurationUrl;
1887
- }()
1722
+ }
1723
+ });
1724
+ }
1888
1725
  }]);
1889
1726
 
1890
1727
  return ElvClient;