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