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