@eluvio/elv-client-js 4.0.11 → 4.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/.keep +0 -0
  2. package/dist/ElvClient-min.js +11 -10
  3. package/dist/ElvClient-node-min.js +11 -10
  4. package/dist/ElvFrameClient-min.js +11 -10
  5. package/dist/ElvPermissionsClient-min.js +10 -9
  6. package/dist/ElvWalletClient-min.js +10 -9
  7. package/dist/ElvWalletClient-node-min.js +10 -9
  8. package/dist/src/AuthorizationClient.js +1555 -2076
  9. package/dist/src/ContentObjectVerification.js +134 -185
  10. package/dist/src/Crypto.js +224 -319
  11. package/dist/src/ElvClient.js +822 -1114
  12. package/dist/src/ElvWallet.js +64 -106
  13. package/dist/src/EthClient.js +719 -974
  14. package/dist/src/FrameClient.js +223 -319
  15. package/dist/src/HttpClient.js +117 -156
  16. package/dist/src/Id.js +1 -6
  17. package/dist/src/LogMessage.js +4 -8
  18. package/dist/src/PermissionsClient.js +973 -1271
  19. package/dist/src/RemoteSigner.js +161 -232
  20. package/dist/src/UserProfileClient.js +781 -1038
  21. package/dist/src/Utils.js +159 -299
  22. package/dist/src/Validation.js +2 -17
  23. package/dist/src/client/ABRPublishing.js +828 -958
  24. package/dist/src/client/AccessGroups.js +849 -1095
  25. package/dist/src/client/ContentAccess.js +3323 -4195
  26. package/dist/src/client/ContentManagement.js +1818 -2290
  27. package/dist/src/client/Contracts.js +468 -614
  28. package/dist/src/client/Files.js +1506 -1846
  29. package/dist/src/client/NFT.js +94 -116
  30. package/dist/src/client/NTP.js +326 -425
  31. package/dist/src/index.js +2 -5
  32. package/dist/src/walletClient/ClientMethods.js +1368 -1763
  33. package/dist/src/walletClient/Configuration.js +5 -3
  34. package/dist/src/walletClient/Notifications.js +98 -127
  35. package/dist/src/walletClient/Profile.js +184 -246
  36. package/dist/src/walletClient/Utils.js +76 -122
  37. package/dist/src/walletClient/index.js +1171 -1496
  38. package/package.json +4 -21
  39. package/src/FrameClient.js +1 -0
  40. package/src/HttpClient.js +4 -2
  41. package/src/client/ABRPublishing.js +126 -105
  42. package/src/client/ContentAccess.js +1 -0
  43. package/src/client/ContentManagement.js +4 -2
  44. package/src/walletClient/Configuration.js +3 -2
  45. package/dist/AccessClient-min.js +0 -54
  46. package/dist/AccessClient-node-min.js +0 -74
  47. package/dist/src/AccessClient.js +0 -798
  48. package/dist/src/LimitedMap.js +0 -120
  49. package/dist/src/client/Access.js +0 -1
  50. package/dist/src/client/Management.js +0 -1606
  51. package/dist/src/contracts/AccessIndexor.js +0 -831
  52. package/dist/src/contracts/Accessible.js +0 -31
  53. package/dist/src/contracts/AdmgrAdvertisement.js +0 -695
  54. package/dist/src/contracts/AdmgrCampaign.js +0 -648
  55. package/dist/src/contracts/AdmgrCampaignManager.js +0 -493
  56. package/dist/src/contracts/AdmgrCommercialOffering.js +0 -622
  57. package/dist/src/contracts/AdmgrCommercialOfferingManager.js +0 -413
  58. package/dist/src/contracts/AdmgrMarketPlace.js +0 -413
  59. package/dist/src/contracts/AvailsDelivery.js +0 -535
  60. package/dist/src/contracts/BaseAccessControlGroup.js +0 -1221
  61. package/dist/src/contracts/BaseAccessWallet.js +0 -1575
  62. package/dist/src/contracts/BaseAccessWalletFactory.js +0 -93
  63. package/dist/src/contracts/BaseContent.js +0 -1104
  64. package/dist/src/contracts/BaseContentFactory.js +0 -99
  65. package/dist/src/contracts/BaseContentFactoryExt.js +0 -219
  66. package/dist/src/contracts/BaseContentSpace.js +0 -1346
  67. package/dist/src/contracts/BaseContentType.js +0 -353
  68. package/dist/src/contracts/BaseFactory.js +0 -107
  69. package/dist/src/contracts/BaseGroupFactory.js +0 -93
  70. package/dist/src/contracts/BaseLibrary.js +0 -1035
  71. package/dist/src/contracts/BaseLibraryFactory.js +0 -96
  72. package/dist/src/contracts/Certifyer.js +0 -87
  73. package/dist/src/contracts/Container.js +0 -543
  74. package/dist/src/contracts/Content.js +0 -432
  75. package/dist/src/contracts/Editable.js +0 -295
  76. package/dist/src/contracts/FactorySpace.js +0 -57
  77. package/dist/src/contracts/KmsSpace.js +0 -52
  78. package/dist/src/contracts/LvProvider.js +0 -512
  79. package/dist/src/contracts/LvRecordableStream.js +0 -1026
  80. package/dist/src/contracts/LvRecording.js +0 -627
  81. package/dist/src/contracts/LvStreamRightsHolder.js +0 -551
  82. package/dist/src/contracts/MetaObject.js +0 -110
  83. package/dist/src/contracts/Node.js +0 -167
  84. package/dist/src/contracts/NodeSpace.js +0 -18
  85. package/dist/src/contracts/NodeSpaceImpl.js +0 -273
  86. package/dist/src/contracts/Ownable.js +0 -87
  87. package/dist/src/contracts/PaymentService.js +0 -616
  88. package/dist/src/contracts/Precompile.js +0 -15
  89. package/dist/src/contracts/SampleContentAdMarketplace.js +0 -564
  90. package/dist/src/contracts/SampleContentAdvertising.js +0 -444
  91. package/dist/src/contracts/SampleContentHelloWorld.js +0 -459
  92. package/dist/src/contracts/SampleContentLicensing.js +0 -618
  93. package/dist/src/contracts/SampleContentSigned.js +0 -447
  94. package/dist/src/contracts/SampleInstance.js +0 -438
  95. package/dist/src/contracts/SampleInstanceFactory.js +0 -451
  96. package/dist/src/contracts/Transactable.js +0 -82
  97. package/dist/src/contracts/UserSpace.js +0 -18
  98. package/dist/src/contracts/UserSpaceImpl.js +0 -43
  99. package/dist/src/contracts/Utils.js +0 -18
  100. package/dist/src/contracts/Verifier.js +0 -53
  101. package/dist/src/contracts/strings.js +0 -4
  102. package/dist/src/contracts/v2/BaseContentFactoryExt.js +0 -219
  103. package/dist/src/contracts/v2/FactorySpace.js +0 -57
  104. package/dist/src/contracts/v2/KmsSpace.js +0 -52
  105. package/dist/src/contracts/v2/NodeSpaceImpl.js +0 -273
  106. package/dist/src/contracts/v2/UserSpaceImpl.js +0 -43
  107. package/dist/src/marketplaceClient/ClientMethods.js +0 -1918
  108. package/dist/src/marketplaceClient/Configuration.js +0 -29
  109. package/dist/src/marketplaceClient/Utils.js +0 -304
  110. package/dist/src/marketplaceClient/index.js +0 -1553
  111. package/utilities/ListAccessGroups.js +0 -34
@@ -1,66 +1,44 @@
1
1
  var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
2
-
3
2
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
3
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
6
-
7
4
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
8
-
9
5
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
10
-
11
6
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
12
-
13
7
  var _createClass = require("@babel/runtime/helpers/createClass");
14
-
15
8
  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; }
16
-
17
9
  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; }
18
-
19
10
  if (typeof globalThis.Buffer === "undefined") {
20
11
  globalThis.Buffer = require("buffer/").Buffer;
21
12
  }
22
-
23
13
  var URI = require("urijs");
24
-
25
14
  var Ethers = require("ethers");
26
-
27
15
  var AuthorizationClient = require("./AuthorizationClient");
28
-
29
16
  var ElvWallet = require("./ElvWallet");
30
-
31
17
  var EthClient = require("./EthClient");
32
-
33
18
  var UserProfileClient = require("./UserProfileClient");
34
-
35
19
  var HttpClient = require("./HttpClient");
20
+ var RemoteSigner = require("./RemoteSigner");
36
21
 
37
- var RemoteSigner = require("./RemoteSigner"); // const ContentObjectVerification = require("./ContentObjectVerification");
38
-
39
-
22
+ // const ContentObjectVerification = require("./ContentObjectVerification");
40
23
  var Utils = require("./Utils");
41
-
42
24
  var Crypto = require("./Crypto");
43
-
44
25
  var _require = require("./LogMessage"),
45
- LogMessage = _require.LogMessage;
46
-
26
+ LogMessage = _require.LogMessage;
47
27
  var Pako = require("pako");
48
-
49
28
  var _require2 = require("./Validation"),
50
- ValidatePresence = _require2.ValidatePresence;
51
-
29
+ ValidatePresence = _require2.ValidatePresence;
52
30
  var networks = {
53
31
  "main": "https://main.net955305.contentfabric.io",
54
32
  "demo": "https://demov3.net955210.contentfabric.io",
55
33
  "demov3": "https://demov3.net955210.contentfabric.io",
56
34
  "test": "https://test.net955203.contentfabric.io"
57
35
  };
58
-
59
36
  if (Utils.Platform() === Utils.PLATFORM_NODE) {
60
37
  // Define Response in node
61
38
  // eslint-disable-next-line no-global-assign
62
39
  globalThis.Response = require("node-fetch").Response;
63
40
  }
41
+
64
42
  /**
65
43
  * See the Modules section on the sidebar for details about methods related to interacting with the Fabric.
66
44
  *
@@ -68,8 +46,6 @@ if (Utils.Platform() === Utils.PLATFORM_NODE) {
68
46
  *
69
47
  * For information about the Eluvio Wallet Client, go <a href="wallet-client/index.html">here</a>.
70
48
  */
71
-
72
-
73
49
  var ElvClient = /*#__PURE__*/function () {
74
50
  "use strict";
75
51
 
@@ -103,28 +79,26 @@ var ElvClient = /*#__PURE__*/function () {
103
79
  */
104
80
  function ElvClient(_ref) {
105
81
  var contentSpaceId = _ref.contentSpaceId,
106
- networkId = _ref.networkId,
107
- networkName = _ref.networkName,
108
- fabricVersion = _ref.fabricVersion,
109
- fabricURIs = _ref.fabricURIs,
110
- ethereumURIs = _ref.ethereumURIs,
111
- authServiceURIs = _ref.authServiceURIs,
112
- searchURIs = _ref.searchURIs,
113
- _ref$ethereumContract = _ref.ethereumContractTimeout,
114
- ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
115
- trustAuthorityId = _ref.trustAuthorityId,
116
- staticToken = _ref.staticToken,
117
- _ref$noCache = _ref.noCache,
118
- noCache = _ref$noCache === void 0 ? false : _ref$noCache,
119
- _ref$noAuth = _ref.noAuth,
120
- noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth,
121
- _ref$assumeV = _ref.assumeV3,
122
- assumeV3 = _ref$assumeV === void 0 ? false : _ref$assumeV,
123
- _ref$service = _ref.service,
124
- service = _ref$service === void 0 ? "default" : _ref$service;
125
-
82
+ networkId = _ref.networkId,
83
+ networkName = _ref.networkName,
84
+ fabricVersion = _ref.fabricVersion,
85
+ fabricURIs = _ref.fabricURIs,
86
+ ethereumURIs = _ref.ethereumURIs,
87
+ authServiceURIs = _ref.authServiceURIs,
88
+ searchURIs = _ref.searchURIs,
89
+ _ref$ethereumContract = _ref.ethereumContractTimeout,
90
+ ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
91
+ trustAuthorityId = _ref.trustAuthorityId,
92
+ staticToken = _ref.staticToken,
93
+ _ref$noCache = _ref.noCache,
94
+ noCache = _ref$noCache === void 0 ? false : _ref$noCache,
95
+ _ref$noAuth = _ref.noAuth,
96
+ noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth,
97
+ _ref$assumeV = _ref.assumeV3,
98
+ assumeV3 = _ref$assumeV === void 0 ? false : _ref$assumeV,
99
+ _ref$service = _ref.service,
100
+ service = _ref$service === void 0 ? "default" : _ref$service;
126
101
  _classCallCheck(this, ElvClient);
127
-
128
102
  this.utils = Utils;
129
103
  this.contentSpaceId = contentSpaceId;
130
104
  this.contentSpaceAddress = this.utils.HashToAddress(contentSpaceId);
@@ -142,17 +116,16 @@ var ElvClient = /*#__PURE__*/function () {
142
116
  this.noCache = noCache;
143
117
  this.noAuth = noAuth;
144
118
  this.assumeV3 = assumeV3;
145
-
146
119
  if (!["search", "default"].includes(service)) {
147
120
  throw Error("Invalid service: ".concat(service));
148
121
  }
149
-
150
122
  this.service = service;
151
123
  this.debug = false;
152
124
  this.InitializeClients({
153
125
  staticToken: staticToken
154
126
  });
155
127
  }
128
+
156
129
  /**
157
130
  * Retrieve content space info and preferred fabric and blockchain URLs from the fabric
158
131
  *
@@ -165,14 +138,13 @@ var ElvClient = /*#__PURE__*/function () {
165
138
  *
166
139
  * @return {Promise<Object>} - Object containing content space ID and fabric and ethereum URLs
167
140
  */
168
-
169
-
170
141
  _createClass(ElvClient, [{
171
142
  key: "Log",
172
143
  value: function Log(message) {
173
144
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
174
145
  LogMessage(this, message, error);
175
146
  }
147
+
176
148
  /**
177
149
  * Enable or disable verbose logging
178
150
  *
@@ -184,12 +156,10 @@ var ElvClient = /*#__PURE__*/function () {
184
156
  * - error: custom error() function
185
157
  * - (custom functions must accept same arguments as console.log/console.error)
186
158
  */
187
-
188
159
  }, {
189
160
  key: "ToggleLogging",
190
161
  value: function ToggleLogging(enable) {
191
162
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
192
-
193
163
  // define func with closure to pass to forEach
194
164
  var setDebug = function setDebug(reporter) {
195
165
  if (reporter) {
@@ -197,9 +167,7 @@ var ElvClient = /*#__PURE__*/function () {
197
167
  reporter.debugOptions = options;
198
168
  }
199
169
  };
200
-
201
170
  [this, this.authClient, this.ethClient, this.HttpClient, this.userProfileClient].forEach(setDebug);
202
-
203
171
  if (enable) {
204
172
  this.Log("Debug Logging Enabled:\n Content Space: ".concat(this.contentSpaceId, "\n Fabric URLs: [\n\t\t").concat(this.fabricURIs.join(", \n\t\t"), "\n\t]\n Ethereum URLs: [\n\t\t").concat(this.ethereumURIs.join(", \n\t\t"), "\n\t]\n Auth Service URLs: [\n\t\t").concat(this.authServiceURIs.join(", \n\t\t"), "\n\t]\n "));
205
173
  }
@@ -212,59 +180,48 @@ var ElvClient = /*#__PURE__*/function () {
212
180
  return typeof klass[method] === "function";
213
181
  }).forEach(function (methodName) {
214
182
  var originalMethod = klass[methodName].bind(klass);
215
-
216
183
  if (originalMethod.constructor.name === "AsyncFunction") {
217
184
  klass[methodName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
218
185
  var start,
219
- _len,
220
- args,
221
- _key,
222
- result,
223
- _args = arguments;
224
-
186
+ _len,
187
+ args,
188
+ _key,
189
+ result,
190
+ _args = arguments;
225
191
  return _regeneratorRuntime.wrap(function _callee$(_context) {
226
- while (1) {
227
- switch (_context.prev = _context.next) {
228
- case 0:
229
- start = Date.now();
230
-
231
- for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
232
- args[_key] = _args[_key];
233
- }
234
-
235
- _context.next = 4;
236
- return originalMethod.apply(void 0, args);
237
-
238
- case 4:
239
- result = _context.sent;
240
- // eslint-disable-next-line no-console
241
- console.log(methodName, Date.now() - start, "ms", JSON.stringify(args));
242
- return _context.abrupt("return", result);
243
-
244
- case 7:
245
- case "end":
246
- return _context.stop();
247
- }
192
+ while (1) switch (_context.prev = _context.next) {
193
+ case 0:
194
+ start = Date.now();
195
+ for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
196
+ args[_key] = _args[_key];
197
+ }
198
+ _context.next = 4;
199
+ return originalMethod.apply(void 0, args);
200
+ case 4:
201
+ result = _context.sent;
202
+ // eslint-disable-next-line no-console
203
+ console.log(methodName, Date.now() - start, "ms", JSON.stringify(args));
204
+ return _context.abrupt("return", result);
205
+ case 7:
206
+ case "end":
207
+ return _context.stop();
248
208
  }
249
209
  }, _callee);
250
210
  }));
251
211
  } else {
252
212
  klass[methodName] = function () {
253
213
  var start = Date.now();
254
-
255
214
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
256
215
  args[_key2] = arguments[_key2];
257
216
  }
258
-
259
- var result = originalMethod.apply(void 0, args); // eslint-disable-next-line no-console
260
-
217
+ var result = originalMethod.apply(void 0, args);
218
+ // eslint-disable-next-line no-console
261
219
  console.log(methodName, Date.now() - start, "ms", JSON.stringify(args));
262
220
  return result;
263
221
  };
264
222
  }
265
223
  });
266
224
  };
267
-
268
225
  MethodLogger(this);
269
226
  }
270
227
  }, {
@@ -272,85 +229,78 @@ var ElvClient = /*#__PURE__*/function () {
272
229
  value: function () {
273
230
  var _InitializeClients = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
274
231
  var _ref3,
275
- staticToken,
276
- uris,
277
- wallet,
278
- signer,
279
- _args2 = arguments;
280
-
232
+ staticToken,
233
+ uris,
234
+ wallet,
235
+ signer,
236
+ _args2 = arguments;
281
237
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
282
- while (1) {
283
- switch (_context2.prev = _context2.next) {
284
- case 0:
285
- _ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, staticToken = _ref3.staticToken;
286
- // Cached info
287
- this.contentTypes = {};
288
- this.encryptionConks = {};
289
- this.stateChannelAccess = {};
290
- this.objectTenantIds = {};
291
- this.objectLibraryIds = {};
292
- this.objectImageUrls = {};
293
- this.visibilityInfo = {};
294
- this.inaccessibleLibraries = {};
295
- uris = this.service === "search" ? this.searchURIs : this.fabricURIs;
296
- this.HttpClient = new HttpClient({
297
- uris: uris,
298
- debug: this.debug
238
+ while (1) switch (_context2.prev = _context2.next) {
239
+ case 0:
240
+ _ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, staticToken = _ref3.staticToken;
241
+ // Cached info
242
+ this.contentTypes = {};
243
+ this.encryptionConks = {};
244
+ this.stateChannelAccess = {};
245
+ this.objectTenantIds = {};
246
+ this.objectLibraryIds = {};
247
+ this.objectImageUrls = {};
248
+ this.visibilityInfo = {};
249
+ this.inaccessibleLibraries = {};
250
+ uris = this.service === "search" ? this.searchURIs : this.fabricURIs;
251
+ this.HttpClient = new HttpClient({
252
+ uris: uris,
253
+ debug: this.debug
254
+ });
255
+ this.AuthHttpClient = new HttpClient({
256
+ uris: this.authServiceURIs,
257
+ debug: this.debug
258
+ });
259
+ this.ethClient = new EthClient({
260
+ client: this,
261
+ uris: this.ethereumURIs,
262
+ networkId: this.networkId,
263
+ debug: this.debug,
264
+ timeout: this.ethereumContractTimeout
265
+ });
266
+ if (!this.signer) {
267
+ wallet = this.GenerateWallet();
268
+ signer = wallet.AddAccountFromMnemonic({
269
+ mnemonic: wallet.GenerateMnemonic()
299
270
  });
300
- this.AuthHttpClient = new HttpClient({
301
- uris: this.authServiceURIs,
302
- debug: this.debug
271
+ this.SetSigner({
272
+ signer: signer,
273
+ reset: false
303
274
  });
304
- this.ethClient = new EthClient({
305
- client: this,
306
- uris: this.ethereumURIs,
307
- networkId: this.networkId,
308
- debug: this.debug,
309
- timeout: this.ethereumContractTimeout
275
+ this.SetStaticToken({
276
+ token: staticToken
310
277
  });
311
-
312
- if (!this.signer) {
313
- wallet = this.GenerateWallet();
314
- signer = wallet.AddAccountFromMnemonic({
315
- mnemonic: wallet.GenerateMnemonic()
316
- });
317
- this.SetSigner({
318
- signer: signer,
319
- reset: false
320
- });
321
- this.SetStaticToken({
322
- token: staticToken
323
- });
324
- }
325
-
326
- this.authClient = new AuthorizationClient({
327
- client: this,
328
- contentSpaceId: this.contentSpaceId,
329
- signer: this.signer,
330
- noCache: this.noCache,
331
- noAuth: this.noAuth,
332
- debug: this.debug
333
- });
334
- this.userProfileClient = new UserProfileClient({
335
- client: this,
336
- debug: this.debug
337
- }); // Initialize crypto wasm
338
-
339
- this.Crypto = Crypto;
340
- this.Crypto.ElvCrypto();
341
-
342
- case 18:
343
- case "end":
344
- return _context2.stop();
345
- }
278
+ }
279
+ this.authClient = new AuthorizationClient({
280
+ client: this,
281
+ contentSpaceId: this.contentSpaceId,
282
+ signer: this.signer,
283
+ noCache: this.noCache,
284
+ noAuth: this.noAuth,
285
+ debug: this.debug
286
+ });
287
+ this.userProfileClient = new UserProfileClient({
288
+ client: this,
289
+ debug: this.debug
290
+ });
291
+
292
+ // Initialize crypto wasm
293
+ this.Crypto = Crypto;
294
+ this.Crypto.ElvCrypto();
295
+ case 18:
296
+ case "end":
297
+ return _context2.stop();
346
298
  }
347
299
  }, _callee2, this);
348
300
  }));
349
-
350
301
  function InitializeClients() {
351
302
  return _InitializeClients.apply(this, arguments);
352
303
  }
353
-
354
304
  return InitializeClients;
355
305
  }()
356
306
  }, {
@@ -364,6 +314,7 @@ var ElvClient = /*#__PURE__*/function () {
364
314
  this.noAuth = !auth;
365
315
  this.authClient.noAuth = !auth;
366
316
  }
317
+
367
318
  /**
368
319
  * Update fabric URLs to prefer the specified region.
369
320
  *
@@ -376,65 +327,54 @@ var ElvClient = /*#__PURE__*/function () {
376
327
  *
377
328
  * @return {Promise<Object>} - An object containing the updated fabric, ethereum, auth service, and search URLs in order of preference
378
329
  */
379
-
380
330
  }, {
381
331
  key: "UseRegion",
382
332
  value: function () {
383
333
  var _UseRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
384
334
  var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, searchURIs;
385
-
386
335
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
387
- while (1) {
388
- switch (_context3.prev = _context3.next) {
389
- case 0:
390
- region = _ref4.region;
391
-
392
- if (this.configUrl) {
393
- _context3.next = 3;
394
- break;
395
- }
396
-
397
- throw Error("Unable to change region: Configuration URL not set");
398
-
399
- case 3:
400
- _context3.next = 5;
401
- return ElvClient.Configuration({
402
- configUrl: this.configUrl,
403
- region: region
404
- });
405
-
406
- case 5:
407
- _yield$ElvClient$Conf = _context3.sent;
408
- fabricURIs = _yield$ElvClient$Conf.fabricURIs;
409
- ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
410
- authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
411
- searchURIs = _yield$ElvClient$Conf.searchURIs;
412
- this.authServiceURIs = authServiceURIs;
413
- this.fabricURIs = fabricURIs;
414
- this.ethereumURIs = ethereumURIs;
415
- this.searchURIs = searchURIs;
416
- this.HttpClient.uris = fabricURIs;
417
- this.HttpClient.uriIndex = 0;
418
- this.ethClient.ethereumURIs = ethereumURIs;
419
- this.ethClient.ethereumURIIndex = 0;
420
- return _context3.abrupt("return", {
421
- fabricURIs: fabricURIs,
422
- ethereumURIs: ethereumURIs,
423
- searchURIs: searchURIs
424
- });
425
-
426
- case 19:
427
- case "end":
428
- return _context3.stop();
429
- }
336
+ while (1) switch (_context3.prev = _context3.next) {
337
+ case 0:
338
+ region = _ref4.region;
339
+ if (this.configUrl) {
340
+ _context3.next = 3;
341
+ break;
342
+ }
343
+ throw Error("Unable to change region: Configuration URL not set");
344
+ case 3:
345
+ _context3.next = 5;
346
+ return ElvClient.Configuration({
347
+ configUrl: this.configUrl,
348
+ region: region
349
+ });
350
+ case 5:
351
+ _yield$ElvClient$Conf = _context3.sent;
352
+ fabricURIs = _yield$ElvClient$Conf.fabricURIs;
353
+ ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
354
+ authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
355
+ searchURIs = _yield$ElvClient$Conf.searchURIs;
356
+ this.authServiceURIs = authServiceURIs;
357
+ this.fabricURIs = fabricURIs;
358
+ this.ethereumURIs = ethereumURIs;
359
+ this.searchURIs = searchURIs;
360
+ this.HttpClient.uris = fabricURIs;
361
+ this.HttpClient.uriIndex = 0;
362
+ this.ethClient.ethereumURIs = ethereumURIs;
363
+ this.ethClient.ethereumURIIndex = 0;
364
+ return _context3.abrupt("return", {
365
+ fabricURIs: fabricURIs,
366
+ ethereumURIs: ethereumURIs,
367
+ searchURIs: searchURIs
368
+ });
369
+ case 19:
370
+ case "end":
371
+ return _context3.stop();
430
372
  }
431
373
  }, _callee3, this);
432
374
  }));
433
-
434
375
  function UseRegion(_x) {
435
376
  return _UseRegion.apply(this, arguments);
436
377
  }
437
-
438
378
  return UseRegion;
439
379
  }()
440
380
  /**
@@ -446,43 +386,34 @@ var ElvClient = /*#__PURE__*/function () {
446
386
  *
447
387
  * @return {Promise<Object>} - An object containing the updated fabric and ethereum URLs in order of preference
448
388
  */
449
-
450
389
  }, {
451
390
  key: "ResetRegion",
452
391
  value: function () {
453
392
  var _ResetRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
454
393
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
455
- while (1) {
456
- switch (_context4.prev = _context4.next) {
457
- case 0:
458
- if (this.configUrl) {
459
- _context4.next = 2;
460
- break;
461
- }
462
-
463
- throw Error("Unable to change region: Configuration URL not set");
464
-
465
- case 2:
466
- _context4.next = 4;
467
- return this.UseRegion({
468
- region: ""
469
- });
470
-
471
- case 4:
472
- return _context4.abrupt("return", _context4.sent);
473
-
474
- case 5:
475
- case "end":
476
- return _context4.stop();
477
- }
394
+ while (1) switch (_context4.prev = _context4.next) {
395
+ case 0:
396
+ if (this.configUrl) {
397
+ _context4.next = 2;
398
+ break;
399
+ }
400
+ throw Error("Unable to change region: Configuration URL not set");
401
+ case 2:
402
+ _context4.next = 4;
403
+ return this.UseRegion({
404
+ region: ""
405
+ });
406
+ case 4:
407
+ return _context4.abrupt("return", _context4.sent);
408
+ case 5:
409
+ case "end":
410
+ return _context4.stop();
478
411
  }
479
412
  }, _callee4, this);
480
413
  }));
481
-
482
414
  function ResetRegion() {
483
415
  return _ResetRegion.apply(this, arguments);
484
416
  }
485
-
486
417
  return ResetRegion;
487
418
  }()
488
419
  /**
@@ -497,41 +428,33 @@ var ElvClient = /*#__PURE__*/function () {
497
428
  *
498
429
  * @return {Promise<string>} - The node ID reported by the fabric
499
430
  */
500
-
501
431
  }, {
502
432
  key: "NodeId",
503
433
  value: function () {
504
434
  var _NodeId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
505
435
  var region, _yield$ElvClient$Conf2, nodeId;
506
-
507
436
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
508
- while (1) {
509
- switch (_context5.prev = _context5.next) {
510
- case 0:
511
- region = _ref5.region;
512
- _context5.next = 3;
513
- return ElvClient.Configuration({
514
- configUrl: this.configUrl,
515
- region: region
516
- });
517
-
518
- case 3:
519
- _yield$ElvClient$Conf2 = _context5.sent;
520
- nodeId = _yield$ElvClient$Conf2.nodeId;
521
- return _context5.abrupt("return", nodeId);
522
-
523
- case 6:
524
- case "end":
525
- return _context5.stop();
526
- }
437
+ while (1) switch (_context5.prev = _context5.next) {
438
+ case 0:
439
+ region = _ref5.region;
440
+ _context5.next = 3;
441
+ return ElvClient.Configuration({
442
+ configUrl: this.configUrl,
443
+ region: region
444
+ });
445
+ case 3:
446
+ _yield$ElvClient$Conf2 = _context5.sent;
447
+ nodeId = _yield$ElvClient$Conf2.nodeId;
448
+ return _context5.abrupt("return", nodeId);
449
+ case 6:
450
+ case "end":
451
+ return _context5.stop();
527
452
  }
528
453
  }, _callee5, this);
529
454
  }));
530
-
531
455
  function NodeId(_x2) {
532
456
  return _NodeId.apply(this, arguments);
533
457
  }
534
-
535
458
  return NodeId;
536
459
  }()
537
460
  /**
@@ -541,7 +464,6 @@ var ElvClient = /*#__PURE__*/function () {
541
464
  *
542
465
  * @return {Promise<Object>} - An object containing the lists of fabric, ethereum, auth service, and search urls in use by the client
543
466
  */
544
-
545
467
  }, {
546
468
  key: "Nodes",
547
469
  value: function Nodes() {
@@ -552,6 +474,7 @@ var ElvClient = /*#__PURE__*/function () {
552
474
  searchURIs: this.searchURIs
553
475
  };
554
476
  }
477
+
555
478
  /**
556
479
  * Set the client to use the specified fabric, ethereum, auth service, and search nodes, in preference order
557
480
  *
@@ -563,44 +486,39 @@ var ElvClient = /*#__PURE__*/function () {
563
486
  *
564
487
  * @methodGroup Nodes
565
488
  */
566
-
567
489
  }, {
568
490
  key: "SetNodes",
569
491
  value: function SetNodes(_ref6) {
570
492
  var fabricURIs = _ref6.fabricURIs,
571
- ethereumURIs = _ref6.ethereumURIs,
572
- authServiceURIs = _ref6.authServiceURIs,
573
- searchURIs = _ref6.searchURIs;
574
-
493
+ ethereumURIs = _ref6.ethereumURIs,
494
+ authServiceURIs = _ref6.authServiceURIs,
495
+ searchURIs = _ref6.searchURIs;
575
496
  if (fabricURIs) {
576
497
  this.fabricURIs = fabricURIs;
577
498
  this.HttpClient.uris = fabricURIs;
578
499
  this.HttpClient.uriIndex = 0;
579
500
  }
580
-
581
501
  if (ethereumURIs) {
582
502
  this.ethereumURIs = ethereumURIs;
583
503
  this.ethClient.ethereumURIs = ethereumURIs;
584
504
  this.ethClient.ethereumURIIndex = 0;
585
505
  }
586
-
587
506
  if (authServiceURIs) {
588
507
  this.authServiceURIs = authServiceURIs;
589
508
  this.AuthHttpClient.uris = authServiceURIs;
590
509
  this.AuthHttpClient.uriIndex = 0;
591
510
  }
592
-
593
511
  if (searchURIs) {
594
512
  this.searchURIs = searchURIs;
595
513
  }
596
514
  }
515
+
597
516
  /**
598
517
  * Return information about how the client was connected to the network
599
518
  *
600
519
  * @methodGroup Nodes
601
520
  * @returns {Object} - The name, ID and configuration URL of the network
602
521
  */
603
-
604
522
  }, {
605
523
  key: "NetworkInfo",
606
524
  value: function NetworkInfo() {
@@ -610,6 +528,7 @@ var ElvClient = /*#__PURE__*/function () {
610
528
  configUrl: this.configUrl
611
529
  };
612
530
  }
531
+
613
532
  /* Wallet and signers */
614
533
 
615
534
  /**
@@ -618,35 +537,35 @@ var ElvClient = /*#__PURE__*/function () {
618
537
  * @methodGroup Signers
619
538
  * @returns {ElvWallet} - ElvWallet instance with this client's provider
620
539
  */
621
-
622
540
  }, {
623
541
  key: "GenerateWallet",
624
542
  value: function GenerateWallet() {
625
543
  return new ElvWallet(this.ethClient.Provider());
626
544
  }
545
+
627
546
  /**
628
547
  * Remove the signer from this client
629
548
  *
630
549
  * @methodGroup Signers
631
550
  */
632
-
633
551
  }, {
634
552
  key: "ClearSigner",
635
553
  value: function ClearSigner() {
636
554
  this.signer = undefined;
637
555
  this.InitializeClients();
638
556
  }
557
+
639
558
  /**
640
559
  * Clear saved access and state channel tokens
641
560
  *
642
561
  * @methodGroup Access Requests
643
562
  */
644
-
645
563
  }, {
646
564
  key: "ClearCache",
647
565
  value: function ClearCache() {
648
566
  this.authClient.ClearCache();
649
567
  }
568
+
650
569
  /**
651
570
  * Set the signer for this client to use for blockchain transactions
652
571
  *
@@ -654,22 +573,21 @@ var ElvClient = /*#__PURE__*/function () {
654
573
  * @namedParams
655
574
  * @param {object} signer - The ethers.js signer object
656
575
  */
657
-
658
576
  }, {
659
577
  key: "SetSigner",
660
578
  value: function SetSigner(_ref7) {
661
579
  var signer = _ref7.signer,
662
- _ref7$reset = _ref7.reset,
663
- reset = _ref7$reset === void 0 ? true : _ref7$reset;
580
+ _ref7$reset = _ref7.reset,
581
+ reset = _ref7$reset === void 0 ? true : _ref7$reset;
664
582
  this.staticToken = undefined;
665
583
  signer.connect(this.ethClient.Provider());
666
584
  signer.provider.pollingInterval = 500;
667
585
  this.signer = signer;
668
-
669
586
  if (reset) {
670
587
  this.InitializeClients();
671
588
  }
672
589
  }
590
+
673
591
  /**
674
592
  * Set signer using OAuth ID token
675
593
  *
@@ -682,59 +600,51 @@ var ElvClient = /*#__PURE__*/function () {
682
600
  * @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
683
601
  * @param {boolean=} unsignedPublicAuth=false - If specified, the client will use an unsigned static token for calls that don't require authorization (reduces remote signature calls)
684
602
  */
685
-
686
603
  }, {
687
604
  key: "SetRemoteSigner",
688
605
  value: function () {
689
606
  var _SetRemoteSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref8) {
690
607
  var idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth, signer;
691
608
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
692
- while (1) {
693
- switch (_context6.prev = _context6.next) {
694
- case 0:
695
- idToken = _ref8.idToken, authToken = _ref8.authToken, tenantId = _ref8.tenantId, extraData = _ref8.extraData, signerURIs = _ref8.signerURIs, unsignedPublicAuth = _ref8.unsignedPublicAuth;
696
- _context6.t0 = RemoteSigner;
697
- _context6.t1 = signerURIs || this.authServiceURIs;
698
- _context6.t2 = idToken;
699
- _context6.t3 = authToken;
700
- _context6.t4 = tenantId;
701
- _context6.next = 8;
702
- return this.ethClient.Provider();
703
-
704
- case 8:
705
- _context6.t5 = _context6.sent;
706
- _context6.t6 = extraData;
707
- _context6.t7 = unsignedPublicAuth;
708
- _context6.t8 = {
709
- signerURIs: _context6.t1,
710
- idToken: _context6.t2,
711
- authToken: _context6.t3,
712
- tenantId: _context6.t4,
713
- provider: _context6.t5,
714
- extraData: _context6.t6,
715
- unsignedPublicAuth: _context6.t7
716
- };
717
- signer = new _context6.t0(_context6.t8);
718
- _context6.next = 15;
719
- return signer.Initialize();
720
-
721
- case 15:
722
- this.SetSigner({
723
- signer: signer
724
- });
725
-
726
- case 16:
727
- case "end":
728
- return _context6.stop();
729
- }
609
+ while (1) switch (_context6.prev = _context6.next) {
610
+ case 0:
611
+ idToken = _ref8.idToken, authToken = _ref8.authToken, tenantId = _ref8.tenantId, extraData = _ref8.extraData, signerURIs = _ref8.signerURIs, unsignedPublicAuth = _ref8.unsignedPublicAuth;
612
+ _context6.t0 = RemoteSigner;
613
+ _context6.t1 = signerURIs || this.authServiceURIs;
614
+ _context6.t2 = idToken;
615
+ _context6.t3 = authToken;
616
+ _context6.t4 = tenantId;
617
+ _context6.next = 8;
618
+ return this.ethClient.Provider();
619
+ case 8:
620
+ _context6.t5 = _context6.sent;
621
+ _context6.t6 = extraData;
622
+ _context6.t7 = unsignedPublicAuth;
623
+ _context6.t8 = {
624
+ signerURIs: _context6.t1,
625
+ idToken: _context6.t2,
626
+ authToken: _context6.t3,
627
+ tenantId: _context6.t4,
628
+ provider: _context6.t5,
629
+ extraData: _context6.t6,
630
+ unsignedPublicAuth: _context6.t7
631
+ };
632
+ signer = new _context6.t0(_context6.t8);
633
+ _context6.next = 15;
634
+ return signer.Initialize();
635
+ case 15:
636
+ this.SetSigner({
637
+ signer: signer
638
+ });
639
+ case 16:
640
+ case "end":
641
+ return _context6.stop();
730
642
  }
731
643
  }, _callee6, this);
732
644
  }));
733
-
734
645
  function SetRemoteSigner(_x3) {
735
646
  return _SetRemoteSigner.apply(this, arguments);
736
647
  }
737
-
738
648
  return SetRemoteSigner;
739
649
  }()
740
650
  /**
@@ -747,41 +657,34 @@ var ElvClient = /*#__PURE__*/function () {
747
657
  * @namedParams
748
658
  * @param {object} provider - The web3 provider object
749
659
  */
750
-
751
660
  }, {
752
661
  key: "SetSignerFromWeb3Provider",
753
662
  value: function () {
754
663
  var _SetSignerFromWeb3Provider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref9) {
755
664
  var provider, ethProvider;
756
665
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
757
- while (1) {
758
- switch (_context7.prev = _context7.next) {
759
- case 0:
760
- provider = _ref9.provider;
761
- this.staticToken = undefined;
762
- ethProvider = new Ethers.providers.Web3Provider(provider);
763
- ethProvider.pollingInterval = 250;
764
- this.signer = ethProvider.getSigner();
765
- _context7.next = 7;
766
- return this.signer.getAddress();
767
-
768
- case 7:
769
- this.signer.address = _context7.sent;
770
- _context7.next = 10;
771
- return this.InitializeClients();
772
-
773
- case 10:
774
- case "end":
775
- return _context7.stop();
776
- }
666
+ while (1) switch (_context7.prev = _context7.next) {
667
+ case 0:
668
+ provider = _ref9.provider;
669
+ this.staticToken = undefined;
670
+ ethProvider = new Ethers.providers.Web3Provider(provider);
671
+ ethProvider.pollingInterval = 250;
672
+ this.signer = ethProvider.getSigner();
673
+ _context7.next = 7;
674
+ return this.signer.getAddress();
675
+ case 7:
676
+ this.signer.address = _context7.sent;
677
+ _context7.next = 10;
678
+ return this.InitializeClients();
679
+ case 10:
680
+ case "end":
681
+ return _context7.stop();
777
682
  }
778
683
  }, _callee7, this);
779
684
  }));
780
-
781
685
  function SetSignerFromWeb3Provider(_x4) {
782
686
  return _SetSignerFromWeb3Provider.apply(this, arguments);
783
687
  }
784
-
785
688
  return SetSignerFromWeb3Provider;
786
689
  }()
787
690
  /**
@@ -799,86 +702,72 @@ var ElvClient = /*#__PURE__*/function () {
799
702
  *
800
703
  * @return {string} - The address of the user
801
704
  */
802
-
803
705
  }, {
804
706
  key: "CreateAccount",
805
707
  value: function () {
806
708
  var _CreateAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref10) {
807
709
  var tenantId, fundingToken, _ref10$funds, funds, groupToken, wallet, signer;
808
-
809
710
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
810
- while (1) {
811
- switch (_context8.prev = _context8.next) {
812
- case 0:
813
- tenantId = _ref10.tenantId, fundingToken = _ref10.fundingToken, _ref10$funds = _ref10.funds, funds = _ref10$funds === void 0 ? 0.5 : _ref10$funds, groupToken = _ref10.groupToken;
814
-
815
- if (!this.signer) {
816
- wallet = this.GenerateWallet();
817
- signer = wallet.AddAccountFromMnemonic({
818
- mnemonic: wallet.GenerateMnemonic()
819
- });
820
- this.SetSigner({
821
- signer: signer
822
- });
823
- }
824
-
825
- _context8.next = 4;
826
- return this.authClient.MakeKMSRequest({
827
- method: "POST",
828
- path: "/ks/otp/fnd/".concat(tenantId),
829
- body: {
830
- toAddr: this.signer.address,
831
- amtStr: this.utils.EtherToWei(funds)
832
- },
833
- headers: {
834
- Authorization: "Bearer ".concat(fundingToken)
835
- }
711
+ while (1) switch (_context8.prev = _context8.next) {
712
+ case 0:
713
+ tenantId = _ref10.tenantId, fundingToken = _ref10.fundingToken, _ref10$funds = _ref10.funds, funds = _ref10$funds === void 0 ? 0.5 : _ref10$funds, groupToken = _ref10.groupToken;
714
+ if (!this.signer) {
715
+ wallet = this.GenerateWallet();
716
+ signer = wallet.AddAccountFromMnemonic({
717
+ mnemonic: wallet.GenerateMnemonic()
836
718
  });
837
-
838
- case 4:
839
- _context8.next = 6;
840
- return this.userProfileClient.CreateWallet();
841
-
842
- case 6:
843
- _context8.next = 8;
844
- return this.userProfileClient.ReplaceUserMetadata({
845
- metadataSubtree: "tenantContractId",
846
- metadata: tenantId
719
+ this.SetSigner({
720
+ signer: signer
847
721
  });
848
-
849
- case 8:
850
- if (!groupToken) {
851
- _context8.next = 11;
852
- break;
722
+ }
723
+ _context8.next = 4;
724
+ return this.authClient.MakeKMSRequest({
725
+ method: "POST",
726
+ path: "/ks/otp/fnd/".concat(tenantId),
727
+ body: {
728
+ toAddr: this.signer.address,
729
+ amtStr: this.utils.EtherToWei(funds)
730
+ },
731
+ headers: {
732
+ Authorization: "Bearer ".concat(fundingToken)
853
733
  }
854
-
734
+ });
735
+ case 4:
736
+ _context8.next = 6;
737
+ return this.userProfileClient.CreateWallet();
738
+ case 6:
739
+ _context8.next = 8;
740
+ return this.userProfileClient.ReplaceUserMetadata({
741
+ metadataSubtree: "tenantContractId",
742
+ metadata: tenantId
743
+ });
744
+ case 8:
745
+ if (!groupToken) {
855
746
  _context8.next = 11;
856
- return this.authClient.MakeKMSRequest({
857
- method: "POST",
858
- path: "/ks/otp/grp/".concat(tenantId),
859
- body: {
860
- addAddr: this.signer.address
861
- },
862
- headers: {
863
- Authorization: "Bearer ".concat(groupToken)
864
- }
865
- });
866
-
867
- case 11:
868
- return _context8.abrupt("return", this.utils.FormatAddress(this.signer.address));
869
-
870
- case 12:
871
- case "end":
872
- return _context8.stop();
873
- }
747
+ break;
748
+ }
749
+ _context8.next = 11;
750
+ return this.authClient.MakeKMSRequest({
751
+ method: "POST",
752
+ path: "/ks/otp/grp/".concat(tenantId),
753
+ body: {
754
+ addAddr: this.signer.address
755
+ },
756
+ headers: {
757
+ Authorization: "Bearer ".concat(groupToken)
758
+ }
759
+ });
760
+ case 11:
761
+ return _context8.abrupt("return", this.utils.FormatAddress(this.signer.address));
762
+ case 12:
763
+ case "end":
764
+ return _context8.stop();
874
765
  }
875
766
  }, _callee8, this);
876
767
  }));
877
-
878
768
  function CreateAccount(_x5) {
879
769
  return _CreateAccount.apply(this, arguments);
880
770
  }
881
-
882
771
  return CreateAccount;
883
772
  }()
884
773
  /*
@@ -890,65 +779,50 @@ var ElvClient = /*#__PURE__*/function () {
890
779
  PAYLOAD 85b json-compressed
891
780
  json 79b {"adr":"VVf4DQU357tDnZGYQeDrntRJ5rs=","spc":"ispc3ANoVSzNA3P6t7abLR69ho5YPPZU"}
892
781
  */
893
-
894
782
  }, {
895
783
  key: "PersonalSign",
896
784
  value: function () {
897
785
  var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref11) {
898
786
  var _this = this;
899
-
900
787
  var message, addEthereumPrefix, Sign;
901
788
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
902
- while (1) {
903
- switch (_context10.prev = _context10.next) {
904
- case 0:
905
- message = _ref11.message, addEthereumPrefix = _ref11.addEthereumPrefix, Sign = _ref11.Sign;
906
-
907
- if (!Sign) {
908
- Sign = /*#__PURE__*/function () {
909
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(message) {
910
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
911
- while (1) {
912
- switch (_context9.prev = _context9.next) {
913
- case 0:
914
- return _context9.abrupt("return", _this.authClient.Sign(message));
915
-
916
- case 1:
917
- case "end":
918
- return _context9.stop();
919
- }
920
- }
921
- }, _callee9);
922
- }));
923
-
924
- return function Sign(_x7) {
925
- return _ref12.apply(this, arguments);
926
- };
927
- }();
928
- }
929
-
930
- if (addEthereumPrefix) {
931
- message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
932
- }
933
-
934
- _context10.next = 5;
935
- return Sign(message);
936
-
937
- case 5:
938
- return _context10.abrupt("return", _context10.sent);
939
-
940
- case 6:
941
- case "end":
942
- return _context10.stop();
943
- }
789
+ while (1) switch (_context10.prev = _context10.next) {
790
+ case 0:
791
+ message = _ref11.message, addEthereumPrefix = _ref11.addEthereumPrefix, Sign = _ref11.Sign;
792
+ if (!Sign) {
793
+ Sign = /*#__PURE__*/function () {
794
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(message) {
795
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
796
+ while (1) switch (_context9.prev = _context9.next) {
797
+ case 0:
798
+ return _context9.abrupt("return", _this.authClient.Sign(message));
799
+ case 1:
800
+ case "end":
801
+ return _context9.stop();
802
+ }
803
+ }, _callee9);
804
+ }));
805
+ return function Sign(_x7) {
806
+ return _ref12.apply(this, arguments);
807
+ };
808
+ }();
809
+ }
810
+ if (addEthereumPrefix) {
811
+ message = Ethers.utils.keccak256(Buffer.from("\x19Ethereum Signed Message:\n".concat(message.length).concat(message), "utf-8"));
812
+ }
813
+ _context10.next = 5;
814
+ return Sign(message);
815
+ case 5:
816
+ return _context10.abrupt("return", _context10.sent);
817
+ case 6:
818
+ case "end":
819
+ return _context10.stop();
944
820
  }
945
821
  }, _callee10);
946
822
  }));
947
-
948
823
  function PersonalSign(_x6) {
949
824
  return _PersonalSign.apply(this, arguments);
950
825
  }
951
-
952
826
  return PersonalSign;
953
827
  }()
954
828
  /**
@@ -962,77 +836,68 @@ var ElvClient = /*#__PURE__*/function () {
962
836
  * @param {function=} Sign - If specified, this function will be used to produce the signature instead of the client's current signer
963
837
  * @param {boolean=} addEthereumPrefix=true - If specified, the 'Ethereum Signed Message' prefixed hash format will be performed. Disable this if the provided Sign method already does this (e.g. Metamask)
964
838
  */
965
-
966
839
  }, {
967
840
  key: "CreateFabricToken",
968
841
  value: function () {
969
842
  var _CreateFabricToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
970
843
  var _ref13,
971
- _ref13$duration,
972
- duration,
973
- _ref13$spec,
974
- spec,
975
- address,
976
- Sign,
977
- _ref13$addEthereumPre,
978
- addEthereumPrefix,
979
- token,
980
- message,
981
- signature,
982
- compressedToken,
983
- _args11 = arguments;
984
-
844
+ _ref13$duration,
845
+ duration,
846
+ _ref13$spec,
847
+ spec,
848
+ address,
849
+ Sign,
850
+ _ref13$addEthereumPre,
851
+ addEthereumPrefix,
852
+ token,
853
+ message,
854
+ signature,
855
+ compressedToken,
856
+ _args11 = arguments;
985
857
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
986
- while (1) {
987
- switch (_context11.prev = _context11.next) {
988
- case 0:
989
- _ref13 = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {}, _ref13$duration = _ref13.duration, duration = _ref13$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref13$duration, _ref13$spec = _ref13.spec, spec = _ref13$spec === void 0 ? {} : _ref13$spec, address = _ref13.address, Sign = _ref13.Sign, _ref13$addEthereumPre = _ref13.addEthereumPrefix, addEthereumPrefix = _ref13$addEthereumPre === void 0 ? true : _ref13$addEthereumPre;
990
- address = address || this.CurrentAccountAddress();
991
- _context11.t0 = _objectSpread;
992
- _context11.t1 = _objectSpread({}, spec);
993
- _context11.t2 = {};
994
- _context11.t3 = "iusr".concat(Utils.AddressToHash(address));
995
- _context11.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
996
- _context11.next = 9;
997
- return this.ContentSpaceId();
998
-
999
- case 9:
1000
- _context11.t5 = _context11.sent;
1001
- _context11.t6 = Date.now();
1002
- _context11.t7 = Date.now() + duration;
1003
- _context11.t8 = {
1004
- sub: _context11.t3,
1005
- adr: _context11.t4,
1006
- spc: _context11.t5,
1007
- iat: _context11.t6,
1008
- exp: _context11.t7
1009
- };
1010
- token = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t8);
1011
- message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
1012
- _context11.next = 17;
1013
- return this.PersonalSign({
1014
- message: message,
1015
- addEthereumPrefix: addEthereumPrefix,
1016
- Sign: Sign
1017
- });
1018
-
1019
- case 17:
1020
- signature = _context11.sent;
1021
- compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1022
- return _context11.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1023
-
1024
- case 20:
1025
- case "end":
1026
- return _context11.stop();
1027
- }
858
+ while (1) switch (_context11.prev = _context11.next) {
859
+ case 0:
860
+ _ref13 = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {}, _ref13$duration = _ref13.duration, duration = _ref13$duration === void 0 ? 24 * 60 * 60 * 1000 : _ref13$duration, _ref13$spec = _ref13.spec, spec = _ref13$spec === void 0 ? {} : _ref13$spec, address = _ref13.address, Sign = _ref13.Sign, _ref13$addEthereumPre = _ref13.addEthereumPrefix, addEthereumPrefix = _ref13$addEthereumPre === void 0 ? true : _ref13$addEthereumPre;
861
+ address = address || this.CurrentAccountAddress();
862
+ _context11.t0 = _objectSpread;
863
+ _context11.t1 = _objectSpread({}, spec);
864
+ _context11.t2 = {};
865
+ _context11.t3 = "iusr".concat(Utils.AddressToHash(address));
866
+ _context11.t4 = Buffer.from(address.replace(/^0x/, ""), "hex").toString("base64");
867
+ _context11.next = 9;
868
+ return this.ContentSpaceId();
869
+ case 9:
870
+ _context11.t5 = _context11.sent;
871
+ _context11.t6 = Date.now();
872
+ _context11.t7 = Date.now() + duration;
873
+ _context11.t8 = {
874
+ sub: _context11.t3,
875
+ adr: _context11.t4,
876
+ spc: _context11.t5,
877
+ iat: _context11.t6,
878
+ exp: _context11.t7
879
+ };
880
+ token = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t8);
881
+ message = "Eluvio Content Fabric Access Token 1.0\n".concat(JSON.stringify(token));
882
+ _context11.next = 17;
883
+ return this.PersonalSign({
884
+ message: message,
885
+ addEthereumPrefix: addEthereumPrefix,
886
+ Sign: Sign
887
+ });
888
+ case 17:
889
+ signature = _context11.sent;
890
+ compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
891
+ return _context11.abrupt("return", "acspjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
892
+ case 20:
893
+ case "end":
894
+ return _context11.stop();
1028
895
  }
1029
896
  }, _callee11, this);
1030
897
  }));
1031
-
1032
898
  function CreateFabricToken() {
1033
899
  return _CreateFabricToken.apply(this, arguments);
1034
900
  }
1035
-
1036
901
  return CreateFabricToken;
1037
902
  }()
1038
903
  /**
@@ -1051,131 +916,105 @@ var ElvClient = /*#__PURE__*/function () {
1051
916
  * enabling the user of this token to download encrypted content from the specified object
1052
917
  * @param {Object=} context - Additional JSON context
1053
918
  */
1054
-
1055
919
  }, {
1056
920
  key: "CreateSignedToken",
1057
921
  value: function () {
1058
922
  var _CreateSignedToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref14) {
1059
923
  var libraryId, objectId, versionHash, policyId, subject, _ref14$grantType, grantType, _ref14$allowDecryptio, allowDecryption, duration, _ref14$context, context, token, cap, compressedToken, signature;
1060
-
1061
924
  return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1062
- while (1) {
1063
- switch (_context12.prev = _context12.next) {
1064
- case 0:
1065
- libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash, policyId = _ref14.policyId, subject = _ref14.subject, _ref14$grantType = _ref14.grantType, grantType = _ref14$grantType === void 0 ? "read" : _ref14$grantType, _ref14$allowDecryptio = _ref14.allowDecryption, allowDecryption = _ref14$allowDecryptio === void 0 ? false : _ref14$allowDecryptio, duration = _ref14.duration, _ref14$context = _ref14.context, context = _ref14$context === void 0 ? {} : _ref14$context;
1066
-
1067
- if (subject) {
1068
- _context12.next = 9;
1069
- break;
1070
- }
1071
-
1072
- _context12.t0 = "iusr";
1073
- _context12.t1 = this.utils;
1074
- _context12.next = 6;
1075
- return this.CurrentAccountAddress();
1076
-
1077
- case 6:
1078
- _context12.t2 = _context12.sent;
1079
- _context12.t3 = _context12.t1.AddressToHash.call(_context12.t1, _context12.t2);
1080
- subject = _context12.t0.concat.call(_context12.t0, _context12.t3);
1081
-
1082
- case 9:
1083
- if (policyId) {
1084
- context["elv:delegation-id"] = policyId;
1085
- }
1086
-
1087
- _context12.t4 = Buffer;
1088
- _context12.next = 13;
1089
- return this.CurrentAccountAddress().replace(/^0x/, "");
1090
-
1091
- case 13:
1092
- _context12.t5 = _context12.sent;
1093
- _context12.t6 = _context12.t4.from.call(_context12.t4, _context12.t5, "hex").toString("base64");
1094
- _context12.t7 = subject;
1095
- _context12.next = 18;
1096
- return this.ContentSpaceId();
1097
-
1098
- case 18:
1099
- _context12.t8 = _context12.sent;
1100
- _context12.t9 = Date.now();
1101
- _context12.t10 = Date.now() + duration;
1102
- _context12.t11 = grantType;
1103
- _context12.t12 = context;
1104
- token = {
1105
- adr: _context12.t6,
1106
- sub: _context12.t7,
1107
- spc: _context12.t8,
1108
- iat: _context12.t9,
1109
- exp: _context12.t10,
1110
- gra: _context12.t11,
1111
- ctx: _context12.t12
1112
- };
1113
-
1114
- if (versionHash) {
1115
- objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1116
- }
1117
-
1118
- if (!objectId) {
1119
- _context12.next = 31;
1120
- break;
1121
- }
1122
-
1123
- token.qid = objectId;
1124
-
1125
- if (libraryId) {
1126
- _context12.next = 31;
1127
- break;
1128
- }
1129
-
1130
- _context12.next = 30;
1131
- return this.ContentObjectLibraryId({
1132
- objectId: objectId
1133
- });
1134
-
1135
- case 30:
1136
- libraryId = _context12.sent;
1137
-
1138
- case 31:
1139
- if (libraryId) {
1140
- token.lib = libraryId;
1141
- }
1142
-
1143
- if (!allowDecryption) {
1144
- _context12.next = 37;
1145
- break;
1146
- }
1147
-
1148
- _context12.next = 35;
1149
- return this.authClient.ReEncryptionConk({
1150
- libraryId: libraryId,
1151
- objectId: objectId
1152
- });
1153
-
1154
- case 35:
1155
- cap = _context12.sent;
1156
- token.apk = cap.public_key;
1157
-
1158
- case 37:
1159
- compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1160
- _context12.next = 40;
1161
- return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
1162
-
1163
- case 40:
1164
- signature = _context12.sent;
1165
- return _context12.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1166
-
1167
- case 42:
1168
- case "end":
1169
- return _context12.stop();
1170
- }
925
+ while (1) switch (_context12.prev = _context12.next) {
926
+ case 0:
927
+ libraryId = _ref14.libraryId, objectId = _ref14.objectId, versionHash = _ref14.versionHash, policyId = _ref14.policyId, subject = _ref14.subject, _ref14$grantType = _ref14.grantType, grantType = _ref14$grantType === void 0 ? "read" : _ref14$grantType, _ref14$allowDecryptio = _ref14.allowDecryption, allowDecryption = _ref14$allowDecryptio === void 0 ? false : _ref14$allowDecryptio, duration = _ref14.duration, _ref14$context = _ref14.context, context = _ref14$context === void 0 ? {} : _ref14$context;
928
+ if (subject) {
929
+ _context12.next = 9;
930
+ break;
931
+ }
932
+ _context12.t0 = "iusr";
933
+ _context12.t1 = this.utils;
934
+ _context12.next = 6;
935
+ return this.CurrentAccountAddress();
936
+ case 6:
937
+ _context12.t2 = _context12.sent;
938
+ _context12.t3 = _context12.t1.AddressToHash.call(_context12.t1, _context12.t2);
939
+ subject = _context12.t0.concat.call(_context12.t0, _context12.t3);
940
+ case 9:
941
+ if (policyId) {
942
+ context["elv:delegation-id"] = policyId;
943
+ }
944
+ _context12.t4 = Buffer;
945
+ _context12.next = 13;
946
+ return this.CurrentAccountAddress().replace(/^0x/, "");
947
+ case 13:
948
+ _context12.t5 = _context12.sent;
949
+ _context12.t6 = _context12.t4.from.call(_context12.t4, _context12.t5, "hex").toString("base64");
950
+ _context12.t7 = subject;
951
+ _context12.next = 18;
952
+ return this.ContentSpaceId();
953
+ case 18:
954
+ _context12.t8 = _context12.sent;
955
+ _context12.t9 = Date.now();
956
+ _context12.t10 = Date.now() + duration;
957
+ _context12.t11 = grantType;
958
+ _context12.t12 = context;
959
+ token = {
960
+ adr: _context12.t6,
961
+ sub: _context12.t7,
962
+ spc: _context12.t8,
963
+ iat: _context12.t9,
964
+ exp: _context12.t10,
965
+ gra: _context12.t11,
966
+ ctx: _context12.t12
967
+ };
968
+ if (versionHash) {
969
+ objectId = this.utils.DecodeVersionHash(versionHash).objectId;
970
+ }
971
+ if (!objectId) {
972
+ _context12.next = 31;
973
+ break;
974
+ }
975
+ token.qid = objectId;
976
+ if (libraryId) {
977
+ _context12.next = 31;
978
+ break;
979
+ }
980
+ _context12.next = 30;
981
+ return this.ContentObjectLibraryId({
982
+ objectId: objectId
983
+ });
984
+ case 30:
985
+ libraryId = _context12.sent;
986
+ case 31:
987
+ if (libraryId) {
988
+ token.lib = libraryId;
989
+ }
990
+ if (!allowDecryption) {
991
+ _context12.next = 37;
992
+ break;
993
+ }
994
+ _context12.next = 35;
995
+ return this.authClient.ReEncryptionConk({
996
+ libraryId: libraryId,
997
+ objectId: objectId
998
+ });
999
+ case 35:
1000
+ cap = _context12.sent;
1001
+ token.apk = cap.public_key;
1002
+ case 37:
1003
+ compressedToken = Pako.deflateRaw(Buffer.from(JSON.stringify(token), "utf-8"));
1004
+ _context12.next = 40;
1005
+ return this.authClient.Sign(Ethers.utils.keccak256(compressedToken));
1006
+ case 40:
1007
+ signature = _context12.sent;
1008
+ return _context12.abrupt("return", "aessjc".concat(this.utils.B58(Buffer.concat([Buffer.from(signature.replace(/^0x/, ""), "hex"), Buffer.from(compressedToken)]))));
1009
+ case 42:
1010
+ case "end":
1011
+ return _context12.stop();
1171
1012
  }
1172
1013
  }, _callee12, this);
1173
1014
  }));
1174
-
1175
1015
  function CreateSignedToken(_x8) {
1176
1016
  return _CreateSignedToken.apply(this, arguments);
1177
1017
  }
1178
-
1179
1018
  return CreateSignedToken;
1180
1019
  }()
1181
1020
  /**
@@ -1184,12 +1023,12 @@ var ElvClient = /*#__PURE__*/function () {
1184
1023
  * @methodGroup Signers
1185
1024
  * @returns {string} - The address of the current signer
1186
1025
  */
1187
-
1188
1026
  }, {
1189
1027
  key: "CurrentAccountAddress",
1190
1028
  value: function CurrentAccountAddress() {
1191
1029
  return this.signer ? this.utils.FormatAddress(this.signer.address) : "";
1192
1030
  }
1031
+
1193
1032
  /**
1194
1033
  * Set the OAuth token for use in state channel calls
1195
1034
  *
@@ -1197,38 +1036,32 @@ var ElvClient = /*#__PURE__*/function () {
1197
1036
  * @namedParams
1198
1037
  * @param {string} token - The OAuth ID token
1199
1038
  */
1200
-
1201
1039
  }, {
1202
1040
  key: "SetOauthToken",
1203
1041
  value: function () {
1204
1042
  var _SetOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref15) {
1205
1043
  var token, wallet, signer;
1206
1044
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1207
- while (1) {
1208
- switch (_context13.prev = _context13.next) {
1209
- case 0:
1210
- token = _ref15.token;
1211
- this.oauthToken = token;
1212
- wallet = this.GenerateWallet();
1213
- signer = wallet.AddAccountFromMnemonic({
1214
- mnemonic: wallet.GenerateMnemonic()
1215
- });
1216
- this.SetSigner({
1217
- signer: signer
1218
- });
1219
-
1220
- case 5:
1221
- case "end":
1222
- return _context13.stop();
1223
- }
1045
+ while (1) switch (_context13.prev = _context13.next) {
1046
+ case 0:
1047
+ token = _ref15.token;
1048
+ this.oauthToken = token;
1049
+ wallet = this.GenerateWallet();
1050
+ signer = wallet.AddAccountFromMnemonic({
1051
+ mnemonic: wallet.GenerateMnemonic()
1052
+ });
1053
+ this.SetSigner({
1054
+ signer: signer
1055
+ });
1056
+ case 5:
1057
+ case "end":
1058
+ return _context13.stop();
1224
1059
  }
1225
1060
  }, _callee13, this);
1226
1061
  }));
1227
-
1228
1062
  function SetOauthToken(_x9) {
1229
1063
  return _SetOauthToken.apply(this, arguments);
1230
1064
  }
1231
-
1232
1065
  return SetOauthToken;
1233
1066
  }()
1234
1067
  /**
@@ -1241,122 +1074,101 @@ var ElvClient = /*#__PURE__*/function () {
1241
1074
  * @namedParams
1242
1075
  * @param {string} token - The OAuth ID
1243
1076
  */
1244
-
1245
1077
  }, {
1246
1078
  key: "SetSignerFromOauthToken",
1247
1079
  value: function () {
1248
1080
  var _SetSignerFromOauthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref16) {
1249
1081
  var token, wallet, client, _yield$client$authCli, urls, path, httpClient, response, privateKey;
1250
-
1251
1082
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1252
- while (1) {
1253
- switch (_context14.prev = _context14.next) {
1254
- case 0:
1255
- token = _ref16.token;
1256
-
1257
- if (this.trustAuthorityId) {
1258
- _context14.next = 3;
1259
- break;
1260
- }
1261
-
1262
- throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1263
-
1264
- case 3:
1265
- wallet = this.GenerateWallet();
1266
- _context14.prev = 4;
1267
-
1268
- if (this.kmsURIs) {
1269
- _context14.next = 17;
1270
- break;
1271
- }
1272
-
1273
- _context14.next = 8;
1274
- return ElvClient.FromConfigurationUrl({
1275
- configUrl: this.configUrl
1276
- });
1277
-
1278
- case 8:
1279
- client = _context14.sent;
1280
- client.SetSigner({
1281
- signer: wallet.AddAccountFromMnemonic({
1282
- mnemonic: wallet.GenerateMnemonic()
1283
- })
1284
- });
1285
- _context14.next = 12;
1286
- return client.authClient.KMSInfo({
1287
- kmsId: this.trustAuthorityId
1288
- });
1289
-
1290
- case 12:
1291
- _yield$client$authCli = _context14.sent;
1292
- urls = _yield$client$authCli.urls;
1293
-
1294
- if (!(!urls || urls.length === 0)) {
1295
- _context14.next = 16;
1296
- break;
1297
- }
1298
-
1299
- throw Error("Unable to authorize with OAuth token: No KMS URLs set");
1300
-
1301
- case 16:
1302
- this.kmsURIs = urls;
1303
-
1304
- case 17:
1305
- this.oauthToken = token;
1306
- path = "/ks/jwt/wlt";
1307
- httpClient = new HttpClient({
1308
- uris: this.kmsURIs,
1309
- debug: this.debug
1310
- });
1311
- _context14.next = 22;
1312
- return this.utils.ResponseToJson(httpClient.Request({
1313
- headers: {
1314
- Authorization: "Bearer ".concat(token)
1315
- },
1316
- method: "PUT",
1317
- path: path,
1318
- forceFailover: true
1319
- }));
1320
-
1321
- case 22:
1322
- response = _context14.sent;
1323
- privateKey = response["UserSKHex"];
1324
- this.SetSigner({
1325
- signer: wallet.AddAccount({
1326
- privateKey: privateKey
1327
- })
1328
- }); // Ensure wallet is initialized
1329
-
1330
- _context14.next = 27;
1331
- return this.userProfileClient.WalletAddress();
1332
-
1333
- case 27:
1334
- _context14.next = 36;
1083
+ while (1) switch (_context14.prev = _context14.next) {
1084
+ case 0:
1085
+ token = _ref16.token;
1086
+ if (this.trustAuthorityId) {
1087
+ _context14.next = 3;
1335
1088
  break;
1336
-
1337
- case 29:
1338
- _context14.prev = 29;
1339
- _context14.t0 = _context14["catch"](4);
1340
- this.Log("Failed to set signer from OAuth token:", true);
1341
- this.Log(_context14.t0, true);
1342
- _context14.next = 35;
1343
- return this.ClearSigner();
1344
-
1345
- case 35:
1346
- throw _context14.t0;
1347
-
1348
- case 36:
1349
- case "end":
1350
- return _context14.stop();
1351
- }
1089
+ }
1090
+ throw Error("Unable to authorize with OAuth token: No trust authority ID set");
1091
+ case 3:
1092
+ wallet = this.GenerateWallet();
1093
+ _context14.prev = 4;
1094
+ if (this.kmsURIs) {
1095
+ _context14.next = 17;
1096
+ break;
1097
+ }
1098
+ _context14.next = 8;
1099
+ return ElvClient.FromConfigurationUrl({
1100
+ configUrl: this.configUrl
1101
+ });
1102
+ case 8:
1103
+ client = _context14.sent;
1104
+ client.SetSigner({
1105
+ signer: wallet.AddAccountFromMnemonic({
1106
+ mnemonic: wallet.GenerateMnemonic()
1107
+ })
1108
+ });
1109
+ _context14.next = 12;
1110
+ return client.authClient.KMSInfo({
1111
+ kmsId: this.trustAuthorityId
1112
+ });
1113
+ case 12:
1114
+ _yield$client$authCli = _context14.sent;
1115
+ urls = _yield$client$authCli.urls;
1116
+ if (!(!urls || urls.length === 0)) {
1117
+ _context14.next = 16;
1118
+ break;
1119
+ }
1120
+ throw Error("Unable to authorize with OAuth token: No KMS URLs set");
1121
+ case 16:
1122
+ this.kmsURIs = urls;
1123
+ case 17:
1124
+ this.oauthToken = token;
1125
+ path = "/ks/jwt/wlt";
1126
+ httpClient = new HttpClient({
1127
+ uris: this.kmsURIs,
1128
+ debug: this.debug
1129
+ });
1130
+ _context14.next = 22;
1131
+ return this.utils.ResponseToJson(httpClient.Request({
1132
+ headers: {
1133
+ Authorization: "Bearer ".concat(token)
1134
+ },
1135
+ method: "PUT",
1136
+ path: path,
1137
+ forceFailover: true
1138
+ }));
1139
+ case 22:
1140
+ response = _context14.sent;
1141
+ privateKey = response["UserSKHex"];
1142
+ this.SetSigner({
1143
+ signer: wallet.AddAccount({
1144
+ privateKey: privateKey
1145
+ })
1146
+ });
1147
+
1148
+ // Ensure wallet is initialized
1149
+ _context14.next = 27;
1150
+ return this.userProfileClient.WalletAddress();
1151
+ case 27:
1152
+ _context14.next = 36;
1153
+ break;
1154
+ case 29:
1155
+ _context14.prev = 29;
1156
+ _context14.t0 = _context14["catch"](4);
1157
+ this.Log("Failed to set signer from OAuth token:", true);
1158
+ this.Log(_context14.t0, true);
1159
+ _context14.next = 35;
1160
+ return this.ClearSigner();
1161
+ case 35:
1162
+ throw _context14.t0;
1163
+ case 36:
1164
+ case "end":
1165
+ return _context14.stop();
1352
1166
  }
1353
1167
  }, _callee14, this, [[4, 29]]);
1354
1168
  }));
1355
-
1356
1169
  function SetSignerFromOauthToken(_x10) {
1357
1170
  return _SetSignerFromOauthToken.apply(this, arguments);
1358
1171
  }
1359
-
1360
1172
  return SetSignerFromOauthToken;
1361
1173
  }()
1362
1174
  /**
@@ -1366,30 +1178,28 @@ var ElvClient = /*#__PURE__*/function () {
1366
1178
  * @namedParams
1367
1179
  * @param {string=} token - The static token to use. If not provided, the default static token will be set.
1368
1180
  */
1369
-
1370
1181
  }, {
1371
1182
  key: "SetStaticToken",
1372
1183
  value: function SetStaticToken() {
1373
1184
  var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1374
- token = _ref17.token;
1375
-
1185
+ token = _ref17.token;
1376
1186
  if (!token) {
1377
1187
  token = this.utils.B64(JSON.stringify({
1378
1188
  qspace_id: this.contentSpaceId
1379
1189
  }));
1380
1190
  }
1381
-
1382
1191
  this.staticToken = token;
1383
1192
  }
1193
+
1384
1194
  /**
1385
1195
  * Clear the set static token for the client
1386
1196
  */
1387
-
1388
1197
  }, {
1389
1198
  key: "ClearStaticToken",
1390
1199
  value: function ClearStaticToken() {
1391
1200
  this.staticToken = undefined;
1392
1201
  }
1202
+
1393
1203
  /**
1394
1204
  * Authorize the client against the specified policy.
1395
1205
  *
@@ -1399,43 +1209,35 @@ var ElvClient = /*#__PURE__*/function () {
1399
1209
  * @namedParams
1400
1210
  * @param {string} objectId - The ID of the policy object
1401
1211
  */
1402
-
1403
1212
  }, {
1404
1213
  key: "SetPolicyAuthorization",
1405
1214
  value: function () {
1406
1215
  var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref18) {
1407
1216
  var objectId;
1408
1217
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1409
- while (1) {
1410
- switch (_context15.prev = _context15.next) {
1411
- case 0:
1412
- objectId = _ref18.objectId;
1413
- _context15.t0 = this;
1414
- _context15.next = 4;
1415
- return this.GenerateStateChannelToken({
1416
- objectId: objectId
1417
- });
1418
-
1419
- case 4:
1420
- _context15.t1 = _context15.sent;
1421
- _context15.t2 = {
1422
- token: _context15.t1
1423
- };
1424
-
1425
- _context15.t0.SetStaticToken.call(_context15.t0, _context15.t2);
1426
-
1427
- case 7:
1428
- case "end":
1429
- return _context15.stop();
1430
- }
1218
+ while (1) switch (_context15.prev = _context15.next) {
1219
+ case 0:
1220
+ objectId = _ref18.objectId;
1221
+ _context15.t0 = this;
1222
+ _context15.next = 4;
1223
+ return this.GenerateStateChannelToken({
1224
+ objectId: objectId
1225
+ });
1226
+ case 4:
1227
+ _context15.t1 = _context15.sent;
1228
+ _context15.t2 = {
1229
+ token: _context15.t1
1230
+ };
1231
+ _context15.t0.SetStaticToken.call(_context15.t0, _context15.t2);
1232
+ case 7:
1233
+ case "end":
1234
+ return _context15.stop();
1431
1235
  }
1432
1236
  }, _callee15, this);
1433
1237
  }));
1434
-
1435
1238
  function SetPolicyAuthorization(_x11) {
1436
1239
  return _SetPolicyAuthorization.apply(this, arguments);
1437
1240
  }
1438
-
1439
1241
  return SetPolicyAuthorization;
1440
1242
  }()
1441
1243
  /**
@@ -1444,35 +1246,28 @@ var ElvClient = /*#__PURE__*/function () {
1444
1246
  * @param {string} string - The string to sign
1445
1247
  * @return {Promise<string>} - The signed string
1446
1248
  */
1447
-
1448
1249
  }, {
1449
1250
  key: "Sign",
1450
1251
  value: function () {
1451
1252
  var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(string) {
1452
1253
  var signature;
1453
1254
  return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1454
- while (1) {
1455
- switch (_context16.prev = _context16.next) {
1456
- case 0:
1457
- _context16.next = 2;
1458
- return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
1459
-
1460
- case 2:
1461
- signature = _context16.sent;
1462
- return _context16.abrupt("return", this.utils.FormatSignature(signature));
1463
-
1464
- case 4:
1465
- case "end":
1466
- return _context16.stop();
1467
- }
1255
+ while (1) switch (_context16.prev = _context16.next) {
1256
+ case 0:
1257
+ _context16.next = 2;
1258
+ return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
1259
+ case 2:
1260
+ signature = _context16.sent;
1261
+ return _context16.abrupt("return", this.utils.FormatSignature(signature));
1262
+ case 4:
1263
+ case "end":
1264
+ return _context16.stop();
1468
1265
  }
1469
1266
  }, _callee16, this);
1470
1267
  }));
1471
-
1472
1268
  function Sign(_x12) {
1473
1269
  return _Sign.apply(this, arguments);
1474
1270
  }
1475
-
1476
1271
  return Sign;
1477
1272
  }()
1478
1273
  /**
@@ -1484,45 +1279,35 @@ var ElvClient = /*#__PURE__*/function () {
1484
1279
  *
1485
1280
  * @return {Promise<string>} - The encrypted message
1486
1281
  */
1487
-
1488
1282
  }, {
1489
1283
  key: "EncryptECIES",
1490
1284
  value: function () {
1491
1285
  var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref19) {
1492
1286
  var message, publicKey;
1493
1287
  return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1494
- while (1) {
1495
- switch (_context17.prev = _context17.next) {
1496
- case 0:
1497
- message = _ref19.message, publicKey = _ref19.publicKey;
1498
-
1499
- if (this.signer) {
1500
- _context17.next = 3;
1501
- break;
1502
- }
1503
-
1504
- throw "Signer not set";
1505
-
1506
- case 3:
1507
- ValidatePresence("message", message);
1508
- _context17.next = 6;
1509
- return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1510
-
1511
- case 6:
1512
- return _context17.abrupt("return", _context17.sent);
1513
-
1514
- case 7:
1515
- case "end":
1516
- return _context17.stop();
1517
- }
1288
+ while (1) switch (_context17.prev = _context17.next) {
1289
+ case 0:
1290
+ message = _ref19.message, publicKey = _ref19.publicKey;
1291
+ if (this.signer) {
1292
+ _context17.next = 3;
1293
+ break;
1294
+ }
1295
+ throw "Signer not set";
1296
+ case 3:
1297
+ ValidatePresence("message", message);
1298
+ _context17.next = 6;
1299
+ return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1300
+ case 6:
1301
+ return _context17.abrupt("return", _context17.sent);
1302
+ case 7:
1303
+ case "end":
1304
+ return _context17.stop();
1518
1305
  }
1519
1306
  }, _callee17, this);
1520
1307
  }));
1521
-
1522
1308
  function EncryptECIES(_x13) {
1523
1309
  return _EncryptECIES.apply(this, arguments);
1524
1310
  }
1525
-
1526
1311
  return EncryptECIES;
1527
1312
  }()
1528
1313
  /**
@@ -1533,45 +1318,35 @@ var ElvClient = /*#__PURE__*/function () {
1533
1318
  *
1534
1319
  * @return {Promise<string | Object>} - The decrypted string or object
1535
1320
  */
1536
-
1537
1321
  }, {
1538
1322
  key: "DecryptECIES",
1539
1323
  value: function () {
1540
1324
  var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref20) {
1541
1325
  var message;
1542
1326
  return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1543
- while (1) {
1544
- switch (_context18.prev = _context18.next) {
1545
- case 0:
1546
- message = _ref20.message;
1547
-
1548
- if (this.signer) {
1549
- _context18.next = 3;
1550
- break;
1551
- }
1552
-
1553
- throw "Signer not set";
1554
-
1555
- case 3:
1556
- ValidatePresence("message", message);
1557
- _context18.next = 6;
1558
- return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1559
-
1560
- case 6:
1561
- return _context18.abrupt("return", _context18.sent);
1562
-
1563
- case 7:
1564
- case "end":
1565
- return _context18.stop();
1566
- }
1327
+ while (1) switch (_context18.prev = _context18.next) {
1328
+ case 0:
1329
+ message = _ref20.message;
1330
+ if (this.signer) {
1331
+ _context18.next = 3;
1332
+ break;
1333
+ }
1334
+ throw "Signer not set";
1335
+ case 3:
1336
+ ValidatePresence("message", message);
1337
+ _context18.next = 6;
1338
+ return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1339
+ case 6:
1340
+ return _context18.abrupt("return", _context18.sent);
1341
+ case 7:
1342
+ case "end":
1343
+ return _context18.stop();
1567
1344
  }
1568
1345
  }, _callee18, this);
1569
1346
  }));
1570
-
1571
1347
  function DecryptECIES(_x14) {
1572
1348
  return _DecryptECIES.apply(this, arguments);
1573
1349
  }
1574
-
1575
1350
  return DecryptECIES;
1576
1351
  }()
1577
1352
  /**
@@ -1585,157 +1360,129 @@ var ElvClient = /*#__PURE__*/function () {
1585
1360
  *
1586
1361
  * @return {Promise<*>} - Response in the specified format
1587
1362
  */
1588
-
1589
1363
  }, {
1590
1364
  key: "Request",
1591
1365
  value: function () {
1592
1366
  var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref21) {
1593
1367
  var url, _ref21$format, format, _ref21$method, method, _ref21$headers, headers, body;
1594
-
1595
1368
  return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1596
- while (1) {
1597
- switch (_context19.prev = _context19.next) {
1598
- case 0:
1599
- 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;
1600
- return _context19.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1601
- method: method,
1602
- headers: headers,
1603
- body: body
1604
- })));
1605
-
1606
- case 2:
1607
- case "end":
1608
- return _context19.stop();
1609
- }
1369
+ while (1) switch (_context19.prev = _context19.next) {
1370
+ case 0:
1371
+ 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;
1372
+ return _context19.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
1373
+ method: method,
1374
+ headers: headers,
1375
+ body: body
1376
+ })));
1377
+ case 2:
1378
+ case "end":
1379
+ return _context19.stop();
1610
1380
  }
1611
1381
  }, _callee19, this);
1612
1382
  }));
1613
-
1614
1383
  function Request(_x15) {
1615
1384
  return _Request.apply(this, arguments);
1616
1385
  }
1617
-
1618
1386
  return Request;
1619
1387
  }()
1620
1388
  /* FrameClient related */
1621
1389
  // Whitelist of methods allowed to be called using the frame API
1622
-
1623
1390
  }, {
1624
1391
  key: "FrameAllowedMethods",
1625
1392
  value: function FrameAllowedMethods() {
1626
1393
  var _this2 = this;
1627
-
1628
1394
  var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1629
1395
  return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
1630
1396
  return typeof _this2[method] === "function" && !forbiddenMethods.includes(method);
1631
1397
  });
1632
- } // Call a method specified in a message from a frame
1398
+ }
1633
1399
 
1400
+ // Call a method specified in a message from a frame
1634
1401
  }, {
1635
1402
  key: "CallFromFrameMessage",
1636
1403
  value: function () {
1637
1404
  var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(message, Respond) {
1638
1405
  var _this3 = this;
1639
-
1640
1406
  var callback, method, methodResults, responseError;
1641
1407
  return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1642
- while (1) {
1643
- switch (_context20.prev = _context20.next) {
1644
- case 0:
1645
- if (!(message.type !== "ElvFrameRequest")) {
1646
- _context20.next = 2;
1647
- break;
1648
- }
1649
-
1650
- return _context20.abrupt("return");
1651
-
1652
- case 2:
1653
- if (message.callbackId) {
1654
- callback = function callback(result) {
1655
- Respond(_this3.utils.MakeClonable({
1656
- type: "ElvFrameResponse",
1657
- requestId: message.callbackId,
1658
- response: result
1659
- }));
1660
- };
1661
-
1662
- message.args.callback = callback;
1663
- }
1664
-
1665
- _context20.prev = 3;
1666
- method = message.calledMethod;
1667
-
1668
- if (!(message.module === "userProfileClient")) {
1669
- _context20.next = 13;
1670
- break;
1671
- }
1672
-
1673
- if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1674
- _context20.next = 8;
1675
- break;
1676
- }
1677
-
1678
- throw Error("Invalid user profile method: " + method);
1679
-
1680
- case 8:
1681
- _context20.next = 10;
1682
- return this.userProfileClient[method](message.args);
1683
-
1684
- case 10:
1685
- methodResults = _context20.sent;
1686
- _context20.next = 18;
1408
+ while (1) switch (_context20.prev = _context20.next) {
1409
+ case 0:
1410
+ if (!(message.type !== "ElvFrameRequest")) {
1411
+ _context20.next = 2;
1687
1412
  break;
1688
-
1689
- case 13:
1690
- if (this.FrameAllowedMethods().includes(method)) {
1691
- _context20.next = 15;
1692
- break;
1693
- }
1694
-
1695
- throw Error("Invalid method: " + method);
1696
-
1697
- case 15:
1698
- _context20.next = 17;
1699
- return this[method](message.args);
1700
-
1701
- case 17:
1702
- methodResults = _context20.sent;
1703
-
1704
- case 18:
1705
- Respond(this.utils.MakeClonable({
1706
- type: "ElvFrameResponse",
1707
- requestId: message.requestId,
1708
- response: methodResults
1709
- }));
1710
- _context20.next = 27;
1413
+ }
1414
+ return _context20.abrupt("return");
1415
+ case 2:
1416
+ if (message.callbackId) {
1417
+ callback = function callback(result) {
1418
+ Respond(_this3.utils.MakeClonable({
1419
+ type: "ElvFrameResponse",
1420
+ requestId: message.callbackId,
1421
+ response: result
1422
+ }));
1423
+ };
1424
+ message.args.callback = callback;
1425
+ }
1426
+ _context20.prev = 3;
1427
+ method = message.calledMethod;
1428
+ if (!(message.module === "userProfileClient")) {
1429
+ _context20.next = 13;
1711
1430
  break;
1712
-
1713
- case 21:
1714
- _context20.prev = 21;
1715
- _context20.t0 = _context20["catch"](3);
1716
- // eslint-disable-next-line no-console
1717
- this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context20.t0) === "object" ? JSON.stringify(_context20.t0, null, 2) : _context20.t0), true); // eslint-disable-next-line no-console
1718
-
1719
- console.error(_context20.t0);
1720
- responseError = _context20.t0 instanceof Error ? _context20.t0.message : _context20.t0;
1721
- Respond(this.utils.MakeClonable({
1722
- type: "ElvFrameResponse",
1723
- requestId: message.requestId,
1724
- error: responseError
1725
- }));
1726
-
1727
- case 27:
1728
- case "end":
1729
- return _context20.stop();
1730
- }
1431
+ }
1432
+ if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1433
+ _context20.next = 8;
1434
+ break;
1435
+ }
1436
+ throw Error("Invalid user profile method: " + method);
1437
+ case 8:
1438
+ _context20.next = 10;
1439
+ return this.userProfileClient[method](message.args);
1440
+ case 10:
1441
+ methodResults = _context20.sent;
1442
+ _context20.next = 18;
1443
+ break;
1444
+ case 13:
1445
+ if (this.FrameAllowedMethods().includes(method)) {
1446
+ _context20.next = 15;
1447
+ break;
1448
+ }
1449
+ throw Error("Invalid method: " + method);
1450
+ case 15:
1451
+ _context20.next = 17;
1452
+ return this[method](message.args);
1453
+ case 17:
1454
+ methodResults = _context20.sent;
1455
+ case 18:
1456
+ Respond(this.utils.MakeClonable({
1457
+ type: "ElvFrameResponse",
1458
+ requestId: message.requestId,
1459
+ response: methodResults
1460
+ }));
1461
+ _context20.next = 27;
1462
+ break;
1463
+ case 21:
1464
+ _context20.prev = 21;
1465
+ _context20.t0 = _context20["catch"](3);
1466
+ // eslint-disable-next-line no-console
1467
+ this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context20.t0) === "object" ? JSON.stringify(_context20.t0, null, 2) : _context20.t0), true);
1468
+
1469
+ // eslint-disable-next-line no-console
1470
+ console.error(_context20.t0);
1471
+ responseError = _context20.t0 instanceof Error ? _context20.t0.message : _context20.t0;
1472
+ Respond(this.utils.MakeClonable({
1473
+ type: "ElvFrameResponse",
1474
+ requestId: message.requestId,
1475
+ error: responseError
1476
+ }));
1477
+ case 27:
1478
+ case "end":
1479
+ return _context20.stop();
1731
1480
  }
1732
1481
  }, _callee20, this, [[3, 21]]);
1733
1482
  }));
1734
-
1735
1483
  function CallFromFrameMessage(_x16, _x17) {
1736
1484
  return _CallFromFrameMessage.apply(this, arguments);
1737
1485
  }
1738
-
1739
1486
  return CallFromFrameMessage;
1740
1487
  }()
1741
1488
  }], [{
@@ -1743,85 +1490,67 @@ var ElvClient = /*#__PURE__*/function () {
1743
1490
  value: function () {
1744
1491
  var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref22) {
1745
1492
  var configUrl, _ref22$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1746
-
1747
1493
  return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1748
- while (1) {
1749
- switch (_context21.prev = _context21.next) {
1750
- case 0:
1751
- configUrl = _ref22.configUrl, _ref22$kmsUrls = _ref22.kmsUrls, kmsUrls = _ref22$kmsUrls === void 0 ? [] : _ref22$kmsUrls, region = _ref22.region;
1752
- _context21.prev = 1;
1753
- uri = new URI(configUrl);
1754
- uri.pathname("/config");
1755
-
1756
- if (region) {
1757
- uri.addSearch("elvgeo", region);
1758
- }
1759
-
1760
- _context21.next = 7;
1761
- return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
1762
-
1763
- case 7:
1764
- fabricInfo = _context21.sent;
1765
-
1766
- // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1767
- filterHTTPS = function filterHTTPS(uri) {
1768
- return uri.toLowerCase().startsWith("https");
1769
- };
1770
-
1771
- fabricURIs = fabricInfo.network.services.fabric_api;
1772
-
1773
- if (fabricURIs.find(filterHTTPS)) {
1774
- fabricURIs = fabricURIs.filter(filterHTTPS);
1775
- }
1776
-
1777
- ethereumURIs = fabricInfo.network.services.ethereum_api;
1778
-
1779
- if (ethereumURIs.find(filterHTTPS)) {
1780
- ethereumURIs = ethereumURIs.filter(filterHTTPS);
1781
- }
1782
-
1783
- authServiceURIs = fabricInfo.network.services.authority_service || [];
1784
-
1785
- if (authServiceURIs.find(filterHTTPS)) {
1786
- authServiceURIs = authServiceURIs.filter(filterHTTPS);
1787
- }
1788
-
1789
- searchURIs = fabricInfo.network.services.search || [];
1790
- fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1791
- return _context21.abrupt("return", {
1792
- nodeId: fabricInfo.node_id,
1793
- contentSpaceId: fabricInfo.qspace.id,
1794
- networkId: (fabricInfo.qspace.ethereum || {}).network_id,
1795
- networkName: ((fabricInfo.qspace || {}).names || [])[0],
1796
- fabricURIs: fabricURIs,
1797
- ethereumURIs: ethereumURIs,
1798
- authServiceURIs: authServiceURIs,
1799
- kmsURIs: kmsUrls,
1800
- searchURIs: searchURIs,
1801
- fabricVersion: fabricVersion
1802
- });
1803
-
1804
- case 20:
1805
- _context21.prev = 20;
1806
- _context21.t0 = _context21["catch"](1);
1807
- // eslint-disable-next-line no-console
1808
- console.error("Error retrieving fabric configuration:"); // eslint-disable-next-line no-console
1809
-
1810
- console.error(_context21.t0);
1811
- throw _context21.t0;
1812
-
1813
- case 25:
1814
- case "end":
1815
- return _context21.stop();
1816
- }
1494
+ while (1) switch (_context21.prev = _context21.next) {
1495
+ case 0:
1496
+ configUrl = _ref22.configUrl, _ref22$kmsUrls = _ref22.kmsUrls, kmsUrls = _ref22$kmsUrls === void 0 ? [] : _ref22$kmsUrls, region = _ref22.region;
1497
+ _context21.prev = 1;
1498
+ uri = new URI(configUrl);
1499
+ uri.pathname("/config");
1500
+ if (region) {
1501
+ uri.addSearch("elvgeo", region);
1502
+ }
1503
+ _context21.next = 7;
1504
+ return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
1505
+ case 7:
1506
+ fabricInfo = _context21.sent;
1507
+ // If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
1508
+ filterHTTPS = function filterHTTPS(uri) {
1509
+ return uri.toLowerCase().startsWith("https");
1510
+ };
1511
+ fabricURIs = fabricInfo.network.services.fabric_api;
1512
+ if (fabricURIs.find(filterHTTPS)) {
1513
+ fabricURIs = fabricURIs.filter(filterHTTPS);
1514
+ }
1515
+ ethereumURIs = fabricInfo.network.services.ethereum_api;
1516
+ if (ethereumURIs.find(filterHTTPS)) {
1517
+ ethereumURIs = ethereumURIs.filter(filterHTTPS);
1518
+ }
1519
+ authServiceURIs = fabricInfo.network.services.authority_service || [];
1520
+ if (authServiceURIs.find(filterHTTPS)) {
1521
+ authServiceURIs = authServiceURIs.filter(filterHTTPS);
1522
+ }
1523
+ searchURIs = fabricInfo.network.services.search || [];
1524
+ fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1525
+ return _context21.abrupt("return", {
1526
+ nodeId: fabricInfo.node_id,
1527
+ contentSpaceId: fabricInfo.qspace.id,
1528
+ networkId: (fabricInfo.qspace.ethereum || {}).network_id,
1529
+ networkName: ((fabricInfo.qspace || {}).names || [])[0],
1530
+ fabricURIs: fabricURIs,
1531
+ ethereumURIs: ethereumURIs,
1532
+ authServiceURIs: authServiceURIs,
1533
+ kmsURIs: kmsUrls,
1534
+ searchURIs: searchURIs,
1535
+ fabricVersion: fabricVersion
1536
+ });
1537
+ case 20:
1538
+ _context21.prev = 20;
1539
+ _context21.t0 = _context21["catch"](1);
1540
+ // eslint-disable-next-line no-console
1541
+ console.error("Error retrieving fabric configuration:");
1542
+ // eslint-disable-next-line no-console
1543
+ console.error(_context21.t0);
1544
+ throw _context21.t0;
1545
+ case 25:
1546
+ case "end":
1547
+ return _context21.stop();
1817
1548
  }
1818
1549
  }, _callee21, null, [[1, 20]]);
1819
1550
  }));
1820
-
1821
1551
  function Configuration(_x18) {
1822
1552
  return _Configuration.apply(this, arguments);
1823
1553
  }
1824
-
1825
1554
  return Configuration;
1826
1555
  }()
1827
1556
  /**
@@ -1839,55 +1568,44 @@ var ElvClient = /*#__PURE__*/function () {
1839
1568
  *
1840
1569
  * @return {Promise<ElvClient>} - New ElvClient connected to the specified content fabric and blockchain
1841
1570
  */
1842
-
1843
1571
  }, {
1844
1572
  key: "FromNetworkName",
1845
1573
  value: function () {
1846
1574
  var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref23) {
1847
1575
  var networkName, region, trustAuthorityId, staticToken, _ref23$ethereumContra, ethereumContractTimeout, _ref23$noCache, noCache, _ref23$noAuth, noAuth, assumeV3, configUrl;
1848
-
1849
1576
  return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1850
- while (1) {
1851
- switch (_context22.prev = _context22.next) {
1852
- case 0:
1853
- 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;
1854
- configUrl = networks[networkName];
1855
-
1856
- if (configUrl) {
1857
- _context22.next = 4;
1858
- break;
1859
- }
1860
-
1861
- throw Error("Invalid network name: " + networkName);
1862
-
1863
- case 4:
1864
- _context22.next = 6;
1865
- return this.FromConfigurationUrl({
1866
- configUrl: configUrl,
1867
- region: region,
1868
- trustAuthorityId: trustAuthorityId,
1869
- staticToken: staticToken,
1870
- ethereumContractTimeout: ethereumContractTimeout,
1871
- noCache: noCache,
1872
- noAuth: noAuth,
1873
- assumeV3: assumeV3
1874
- });
1875
-
1876
- case 6:
1877
- return _context22.abrupt("return", _context22.sent);
1878
-
1879
- case 7:
1880
- case "end":
1881
- return _context22.stop();
1882
- }
1577
+ while (1) switch (_context22.prev = _context22.next) {
1578
+ case 0:
1579
+ 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;
1580
+ configUrl = networks[networkName];
1581
+ if (configUrl) {
1582
+ _context22.next = 4;
1583
+ break;
1584
+ }
1585
+ throw Error("Invalid network name: " + networkName);
1586
+ case 4:
1587
+ _context22.next = 6;
1588
+ return this.FromConfigurationUrl({
1589
+ configUrl: configUrl,
1590
+ region: region,
1591
+ trustAuthorityId: trustAuthorityId,
1592
+ staticToken: staticToken,
1593
+ ethereumContractTimeout: ethereumContractTimeout,
1594
+ noCache: noCache,
1595
+ noAuth: noAuth,
1596
+ assumeV3: assumeV3
1597
+ });
1598
+ case 6:
1599
+ return _context22.abrupt("return", _context22.sent);
1600
+ case 7:
1601
+ case "end":
1602
+ return _context22.stop();
1883
1603
  }
1884
1604
  }, _callee22, this);
1885
1605
  }));
1886
-
1887
1606
  function FromNetworkName(_x19) {
1888
1607
  return _FromNetworkName.apply(this, arguments);
1889
1608
  }
1890
-
1891
1609
  return FromNetworkName;
1892
1610
  }()
1893
1611
  /**
@@ -1905,72 +1623,62 @@ var ElvClient = /*#__PURE__*/function () {
1905
1623
  *
1906
1624
  * @return {Promise<ElvClient>} - New ElvClient connected to the specified content fabric and blockchain
1907
1625
  */
1908
-
1909
1626
  }, {
1910
1627
  key: "FromConfigurationUrl",
1911
1628
  value: function () {
1912
1629
  var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref24) {
1913
1630
  var configUrl, region, trustAuthorityId, staticToken, _ref24$ethereumContra, ethereumContractTimeout, _ref24$noCache, noCache, _ref24$noAuth, noAuth, _ref24$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1914
-
1915
1631
  return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1916
- while (1) {
1917
- switch (_context23.prev = _context23.next) {
1918
- case 0:
1919
- 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;
1920
- _context23.next = 3;
1921
- return ElvClient.Configuration({
1922
- configUrl: configUrl,
1923
- region: region
1924
- });
1925
-
1926
- case 3:
1927
- _yield$ElvClient$Conf3 = _context23.sent;
1928
- contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
1929
- networkId = _yield$ElvClient$Conf3.networkId;
1930
- networkName = _yield$ElvClient$Conf3.networkName;
1931
- fabricURIs = _yield$ElvClient$Conf3.fabricURIs;
1932
- ethereumURIs = _yield$ElvClient$Conf3.ethereumURIs;
1933
- authServiceURIs = _yield$ElvClient$Conf3.authServiceURIs;
1934
- searchURIs = _yield$ElvClient$Conf3.searchURIs;
1935
- fabricVersion = _yield$ElvClient$Conf3.fabricVersion;
1936
- client = new ElvClient({
1937
- contentSpaceId: contentSpaceId,
1938
- networkId: networkId,
1939
- networkName: networkName,
1940
- fabricVersion: fabricVersion,
1941
- fabricURIs: fabricURIs,
1942
- ethereumURIs: ethereumURIs,
1943
- authServiceURIs: authServiceURIs,
1944
- searchURIs: searchURIs,
1945
- ethereumContractTimeout: ethereumContractTimeout,
1946
- trustAuthorityId: trustAuthorityId,
1947
- staticToken: staticToken,
1948
- noCache: noCache,
1949
- noAuth: noAuth,
1950
- assumeV3: assumeV3
1951
- });
1952
- client.configUrl = configUrl;
1953
- return _context23.abrupt("return", client);
1954
-
1955
- case 15:
1956
- case "end":
1957
- return _context23.stop();
1958
- }
1632
+ while (1) switch (_context23.prev = _context23.next) {
1633
+ case 0:
1634
+ 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;
1635
+ _context23.next = 3;
1636
+ return ElvClient.Configuration({
1637
+ configUrl: configUrl,
1638
+ region: region
1639
+ });
1640
+ case 3:
1641
+ _yield$ElvClient$Conf3 = _context23.sent;
1642
+ contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
1643
+ networkId = _yield$ElvClient$Conf3.networkId;
1644
+ networkName = _yield$ElvClient$Conf3.networkName;
1645
+ fabricURIs = _yield$ElvClient$Conf3.fabricURIs;
1646
+ ethereumURIs = _yield$ElvClient$Conf3.ethereumURIs;
1647
+ authServiceURIs = _yield$ElvClient$Conf3.authServiceURIs;
1648
+ searchURIs = _yield$ElvClient$Conf3.searchURIs;
1649
+ fabricVersion = _yield$ElvClient$Conf3.fabricVersion;
1650
+ client = new ElvClient({
1651
+ contentSpaceId: contentSpaceId,
1652
+ networkId: networkId,
1653
+ networkName: networkName,
1654
+ fabricVersion: fabricVersion,
1655
+ fabricURIs: fabricURIs,
1656
+ ethereumURIs: ethereumURIs,
1657
+ authServiceURIs: authServiceURIs,
1658
+ searchURIs: searchURIs,
1659
+ ethereumContractTimeout: ethereumContractTimeout,
1660
+ trustAuthorityId: trustAuthorityId,
1661
+ staticToken: staticToken,
1662
+ noCache: noCache,
1663
+ noAuth: noAuth,
1664
+ assumeV3: assumeV3
1665
+ });
1666
+ client.configUrl = configUrl;
1667
+ return _context23.abrupt("return", client);
1668
+ case 15:
1669
+ case "end":
1670
+ return _context23.stop();
1959
1671
  }
1960
1672
  }, _callee23);
1961
1673
  }));
1962
-
1963
1674
  function FromConfigurationUrl(_x20) {
1964
1675
  return _FromConfigurationUrl.apply(this, arguments);
1965
1676
  }
1966
-
1967
1677
  return FromConfigurationUrl;
1968
1678
  }()
1969
1679
  }]);
1970
-
1971
1680
  return ElvClient;
1972
1681
  }();
1973
-
1974
1682
  Object.assign(ElvClient.prototype, require("./client/AccessGroups"));
1975
1683
  Object.assign(ElvClient.prototype, require("./client/ContentAccess"));
1976
1684
  Object.assign(ElvClient.prototype, require("./client/Contracts"));