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