@eluvio/elv-client-js 4.0.4 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +12 -11
- package/dist/ElvClient-node-min.js +12 -17
- package/dist/ElvFrameClient-min.js +12 -11
- package/dist/ElvPermissionsClient-min.js +10 -9
- package/dist/ElvWalletClient-min.js +11 -10
- package/dist/ElvWalletClient-node-min.js +12 -17
- package/dist/src/AuthorizationClient.js +1556 -2077
- package/dist/src/ContentObjectVerification.js +134 -185
- package/dist/src/Crypto.js +225 -322
- package/dist/src/ElvClient.js +823 -1117
- package/dist/src/ElvWallet.js +64 -106
- package/dist/src/EthClient.js +719 -974
- package/dist/src/FrameClient.js +222 -318
- package/dist/src/HttpClient.js +112 -154
- package/dist/src/Id.js +1 -6
- package/dist/src/LogMessage.js +4 -8
- package/dist/src/PermissionsClient.js +973 -1271
- package/dist/src/RemoteSigner.js +161 -232
- package/dist/src/UserProfileClient.js +781 -1038
- package/dist/src/Utils.js +160 -302
- package/dist/src/Validation.js +2 -17
- package/dist/src/client/ABRPublishing.js +772 -942
- package/dist/src/client/AccessGroups.js +849 -1095
- package/dist/src/client/ContentAccess.js +3263 -4132
- package/dist/src/client/ContentManagement.js +1811 -2283
- package/dist/src/client/Contracts.js +468 -614
- package/dist/src/client/Files.js +1505 -1845
- package/dist/src/client/NFT.js +94 -116
- package/dist/src/client/NTP.js +326 -425
- package/dist/src/index.js +2 -5
- package/dist/src/walletClient/ClientMethods.js +1412 -1551
- package/dist/src/walletClient/Configuration.js +4 -2
- package/dist/src/walletClient/Notifications.js +98 -127
- package/dist/src/walletClient/Profile.js +184 -246
- package/dist/src/walletClient/Utils.js +76 -122
- package/dist/src/walletClient/index.js +1169 -1493
- package/package.json +3 -2
- package/src/Crypto.js +1 -1
- package/src/ElvClient.js +1 -3
- package/src/Utils.js +1 -1
- package/src/walletClient/ClientMethods.js +133 -11
- package/src/walletClient/index.js +1 -0
- package/testScripts/Test.js +0 -1
- package/utilities/NFTIngest.js +527 -0
- package/utilities/lib/concerns/LocalFile.js +2 -1
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
2
|
-
|
|
3
2
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
|
|
5
3
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
6
|
-
|
|
7
4
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
8
|
-
|
|
9
5
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
10
|
-
|
|
11
6
|
var _v, _v2;
|
|
12
|
-
|
|
13
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
9
|
var HttpClient = require("./HttpClient");
|
|
18
|
-
|
|
19
10
|
var Ethers = require("ethers");
|
|
20
|
-
|
|
21
11
|
var Utils = require("./Utils");
|
|
22
|
-
|
|
23
12
|
var UrlJoin = require("url-join");
|
|
24
|
-
|
|
25
13
|
var _require = require("./LogMessage"),
|
|
26
|
-
|
|
14
|
+
LogMessage = _require.LogMessage;
|
|
15
|
+
|
|
27
16
|
/*
|
|
28
17
|
// -- Contract javascript files built using build/BuildContracts.js
|
|
29
18
|
const SpaceContract = require("./contracts/BaseContentSpace");
|
|
@@ -36,7 +25,6 @@ const AccessibleContract = require("./contracts/Accessible");
|
|
|
36
25
|
const EditableContract = require("./contracts/Editable");
|
|
37
26
|
*/
|
|
38
27
|
|
|
39
|
-
|
|
40
28
|
var ACCESS_TYPES = {
|
|
41
29
|
SPACE: "space",
|
|
42
30
|
LIBRARY: "library",
|
|
@@ -53,22 +41,19 @@ var CONTRACTS = {
|
|
|
53
41
|
v2: (_v = {}, _defineProperty(_v, ACCESS_TYPES.SPACE, require("./contracts/v2/BaseContentSpace")), _defineProperty(_v, ACCESS_TYPES.LIBRARY, require("./contracts/v2/BaseLibrary")), _defineProperty(_v, ACCESS_TYPES.TYPE, require("./contracts/v2/BaseContentType")), _defineProperty(_v, ACCESS_TYPES.OBJECT, require("./contracts/v2/BaseContent")), _defineProperty(_v, ACCESS_TYPES.WALLET, require("./contracts/v2/BaseAccessWallet")), _defineProperty(_v, ACCESS_TYPES.GROUP, require("./contracts/v2/BaseAccessControlGroup")), _defineProperty(_v, ACCESS_TYPES.ACCESSIBLE, require("./contracts/v2/Accessible")), _defineProperty(_v, ACCESS_TYPES.EDITABLE, require("./contracts/v2/Editable")), _v),
|
|
54
42
|
v3: (_v2 = {}, _defineProperty(_v2, ACCESS_TYPES.SPACE, require("./contracts/v3/BaseContentSpace")), _defineProperty(_v2, ACCESS_TYPES.LIBRARY, require("./contracts/v3/BaseLibrary")), _defineProperty(_v2, ACCESS_TYPES.TYPE, require("./contracts/v3/BaseContentType")), _defineProperty(_v2, ACCESS_TYPES.OBJECT, require("./contracts/v3/BaseContent")), _defineProperty(_v2, ACCESS_TYPES.WALLET, require("./contracts/v3/BaseAccessWallet")), _defineProperty(_v2, ACCESS_TYPES.GROUP, require("./contracts/v3/BaseAccessControlGroup")), _defineProperty(_v2, ACCESS_TYPES.ACCESSIBLE, require("./contracts/v3/Accessible")), _defineProperty(_v2, ACCESS_TYPES.EDITABLE, require("./contracts/v3/Editable")), _defineProperty(_v2, ACCESS_TYPES.TENANT, require("./contracts/v3/BaseTenantSpace")), _v2)
|
|
55
43
|
};
|
|
56
|
-
|
|
57
44
|
var AuthorizationClient = /*#__PURE__*/function () {
|
|
58
45
|
"use strict";
|
|
59
46
|
|
|
60
47
|
function AuthorizationClient(_ref) {
|
|
61
48
|
var client = _ref.client,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
contentSpaceId = _ref.contentSpaceId,
|
|
50
|
+
_ref$debug = _ref.debug,
|
|
51
|
+
debug = _ref$debug === void 0 ? false : _ref$debug,
|
|
52
|
+
_ref$noCache = _ref.noCache,
|
|
53
|
+
noCache = _ref$noCache === void 0 ? false : _ref$noCache,
|
|
54
|
+
_ref$noAuth = _ref.noAuth,
|
|
55
|
+
noAuth = _ref$noAuth === void 0 ? false : _ref$noAuth;
|
|
70
56
|
_classCallCheck(this, AuthorizationClient);
|
|
71
|
-
|
|
72
57
|
this.ACCESS_TYPES = ACCESS_TYPES;
|
|
73
58
|
this.CONTRACTS = CONTRACTS;
|
|
74
59
|
this.client = client;
|
|
@@ -88,7 +73,6 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
88
73
|
this.requestIds = {};
|
|
89
74
|
this.providers = {};
|
|
90
75
|
}
|
|
91
|
-
|
|
92
76
|
_createClass(AuthorizationClient, [{
|
|
93
77
|
key: "Log",
|
|
94
78
|
value: function Log(message) {
|
|
@@ -102,50 +86,41 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
102
86
|
var token = {
|
|
103
87
|
qspace_id: this.client.contentSpaceId
|
|
104
88
|
};
|
|
105
|
-
|
|
106
89
|
if (libraryId) {
|
|
107
90
|
token.qlib_id = libraryId;
|
|
108
91
|
}
|
|
109
|
-
|
|
110
92
|
return Utils.B64(JSON.stringify(token));
|
|
111
|
-
}
|
|
93
|
+
}
|
|
112
94
|
|
|
95
|
+
// Return authorization token in appropriate headers
|
|
113
96
|
}, {
|
|
114
97
|
key: "AuthorizationHeader",
|
|
115
98
|
value: function () {
|
|
116
99
|
var _AuthorizationHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
117
100
|
var authorizationToken, headers;
|
|
118
101
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
119
|
-
while (1) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return _context.abrupt("return", headers);
|
|
136
|
-
|
|
137
|
-
case 6:
|
|
138
|
-
case "end":
|
|
139
|
-
return _context.stop();
|
|
140
|
-
}
|
|
102
|
+
while (1) switch (_context.prev = _context.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
_context.next = 2;
|
|
105
|
+
return this.AuthorizationToken(params);
|
|
106
|
+
case 2:
|
|
107
|
+
authorizationToken = _context.sent;
|
|
108
|
+
headers = {
|
|
109
|
+
Authorization: "Bearer " + authorizationToken
|
|
110
|
+
};
|
|
111
|
+
if (params.encryption && params.encryption !== "none") {
|
|
112
|
+
headers["X-Content-Fabric-Encryption-Scheme"] = params.encryption;
|
|
113
|
+
}
|
|
114
|
+
return _context.abrupt("return", headers);
|
|
115
|
+
case 6:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
141
118
|
}
|
|
142
119
|
}, _callee, this);
|
|
143
120
|
}));
|
|
144
|
-
|
|
145
121
|
function AuthorizationHeader(_x) {
|
|
146
122
|
return _AuthorizationHeader.apply(this, arguments);
|
|
147
123
|
}
|
|
148
|
-
|
|
149
124
|
return AuthorizationHeader;
|
|
150
125
|
}()
|
|
151
126
|
}, {
|
|
@@ -153,127 +128,100 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
153
128
|
value: function () {
|
|
154
129
|
var _AuthorizationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
155
130
|
var libraryId, objectId, versionHash, partHash, encryption, audienceData, context, _ref3$update, update, _ref3$channelAuth, channelAuth, oauthToken, _ref3$noCache, noCache, _ref3$noAuth, noAuth, isWalletRequest, initialNoCache, authorizationToken;
|
|
156
|
-
|
|
157
131
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
158
|
-
while (1) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
_context2.t0 = objectId && this.client.signer;
|
|
168
|
-
|
|
169
|
-
if (!_context2.t0) {
|
|
170
|
-
_context2.next = 10;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
_context2.t1 = this.client.utils;
|
|
175
|
-
_context2.next = 7;
|
|
176
|
-
return this.client.userProfileClient.WalletAddress(false);
|
|
177
|
-
|
|
178
|
-
case 7:
|
|
179
|
-
_context2.t2 = _context2.sent;
|
|
180
|
-
_context2.t3 = this.client.utils.HashToAddress(objectId);
|
|
181
|
-
_context2.t0 = _context2.t1.EqualAddress.call(_context2.t1, _context2.t2, _context2.t3);
|
|
182
|
-
|
|
183
|
-
case 10:
|
|
184
|
-
isWalletRequest = _context2.t0;
|
|
185
|
-
|
|
186
|
-
if (!(this.client.staticToken && !isWalletRequest)) {
|
|
187
|
-
_context2.next = 13;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return _context2.abrupt("return", this.client.staticToken);
|
|
192
|
-
|
|
193
|
-
case 13:
|
|
194
|
-
initialNoCache = this.noCache;
|
|
195
|
-
_context2.prev = 14;
|
|
196
|
-
|
|
197
|
-
// noCache enabled for this call
|
|
198
|
-
if (noCache && !this.noCache) {
|
|
199
|
-
this.noCache = true;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (channelAuth && this.client.signer && this.client.signer.remoteSigner) {
|
|
203
|
-
// Channel auth not supported for remote signer, use a self-signed no-auth token instead
|
|
204
|
-
noAuth = true;
|
|
205
|
-
channelAuth = false;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (!channelAuth) {
|
|
209
|
-
_context2.next = 23;
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
_context2.next = 20;
|
|
214
|
-
return this.GenerateChannelContentToken({
|
|
215
|
-
objectId: objectId,
|
|
216
|
-
versionHash: versionHash,
|
|
217
|
-
audienceData: audienceData,
|
|
218
|
-
context: context,
|
|
219
|
-
oauthToken: oauthToken
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
case 20:
|
|
223
|
-
authorizationToken = _context2.sent;
|
|
224
|
-
_context2.next = 28;
|
|
132
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
libraryId = _ref3.libraryId, objectId = _ref3.objectId, versionHash = _ref3.versionHash, partHash = _ref3.partHash, encryption = _ref3.encryption, audienceData = _ref3.audienceData, context = _ref3.context, _ref3$update = _ref3.update, update = _ref3$update === void 0 ? false : _ref3$update, _ref3$channelAuth = _ref3.channelAuth, channelAuth = _ref3$channelAuth === void 0 ? false : _ref3$channelAuth, oauthToken = _ref3.oauthToken, _ref3$noCache = _ref3.noCache, noCache = _ref3$noCache === void 0 ? false : _ref3$noCache, _ref3$noAuth = _ref3.noAuth, noAuth = _ref3$noAuth === void 0 ? false : _ref3$noAuth;
|
|
135
|
+
if (versionHash) {
|
|
136
|
+
objectId = this.client.utils.DecodeVersionHash(versionHash).objectId;
|
|
137
|
+
}
|
|
138
|
+
_context2.t0 = objectId && this.client.signer;
|
|
139
|
+
if (!_context2.t0) {
|
|
140
|
+
_context2.next = 10;
|
|
225
141
|
break;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
142
|
+
}
|
|
143
|
+
_context2.t1 = this.client.utils;
|
|
144
|
+
_context2.next = 7;
|
|
145
|
+
return this.client.userProfileClient.WalletAddress(false);
|
|
146
|
+
case 7:
|
|
147
|
+
_context2.t2 = _context2.sent;
|
|
148
|
+
_context2.t3 = this.client.utils.HashToAddress(objectId);
|
|
149
|
+
_context2.t0 = _context2.t1.EqualAddress.call(_context2.t1, _context2.t2, _context2.t3);
|
|
150
|
+
case 10:
|
|
151
|
+
isWalletRequest = _context2.t0;
|
|
152
|
+
if (!(this.client.staticToken && !isWalletRequest)) {
|
|
153
|
+
_context2.next = 13;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
return _context2.abrupt("return", this.client.staticToken);
|
|
157
|
+
case 13:
|
|
158
|
+
initialNoCache = this.noCache;
|
|
159
|
+
_context2.prev = 14;
|
|
160
|
+
// noCache enabled for this call
|
|
161
|
+
if (noCache && !this.noCache) {
|
|
162
|
+
this.noCache = true;
|
|
163
|
+
}
|
|
164
|
+
if (channelAuth && this.client.signer && this.client.signer.remoteSigner) {
|
|
165
|
+
// Channel auth not supported for remote signer, use a self-signed no-auth token instead
|
|
166
|
+
noAuth = true;
|
|
167
|
+
channelAuth = false;
|
|
168
|
+
}
|
|
169
|
+
if (!channelAuth) {
|
|
170
|
+
_context2.next = 23;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
_context2.next = 20;
|
|
174
|
+
return this.GenerateChannelContentToken({
|
|
175
|
+
objectId: objectId,
|
|
176
|
+
versionHash: versionHash,
|
|
177
|
+
audienceData: audienceData,
|
|
178
|
+
context: context,
|
|
179
|
+
oauthToken: oauthToken
|
|
180
|
+
});
|
|
181
|
+
case 20:
|
|
182
|
+
authorizationToken = _context2.sent;
|
|
183
|
+
_context2.next = 28;
|
|
184
|
+
break;
|
|
185
|
+
case 23:
|
|
186
|
+
if (!(noAuth && this.client.signer && this.client.signer.remoteSigner && this.client.signer.unsignedPublicAuth)) {
|
|
187
|
+
_context2.next = 25;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return _context2.abrupt("return", this.CreateStaticToken({
|
|
191
|
+
libraryId: libraryId
|
|
192
|
+
}));
|
|
193
|
+
case 25:
|
|
194
|
+
_context2.next = 27;
|
|
195
|
+
return this.GenerateAuthorizationToken({
|
|
196
|
+
libraryId: libraryId,
|
|
197
|
+
objectId: objectId,
|
|
198
|
+
versionHash: versionHash,
|
|
199
|
+
partHash: partHash,
|
|
200
|
+
encryption: encryption,
|
|
201
|
+
update: update,
|
|
202
|
+
noAuth: noAuth
|
|
203
|
+
});
|
|
204
|
+
case 27:
|
|
205
|
+
authorizationToken = _context2.sent;
|
|
206
|
+
case 28:
|
|
207
|
+
return _context2.abrupt("return", authorizationToken);
|
|
208
|
+
case 31:
|
|
209
|
+
_context2.prev = 31;
|
|
210
|
+
_context2.t4 = _context2["catch"](14);
|
|
211
|
+
throw _context2.t4;
|
|
212
|
+
case 34:
|
|
213
|
+
_context2.prev = 34;
|
|
214
|
+
this.noCache = initialNoCache;
|
|
215
|
+
return _context2.finish(34);
|
|
216
|
+
case 37:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context2.stop();
|
|
269
219
|
}
|
|
270
220
|
}, _callee2, this, [[14, 31, 34, 37]]);
|
|
271
221
|
}));
|
|
272
|
-
|
|
273
222
|
function AuthorizationToken(_x2) {
|
|
274
223
|
return _AuthorizationToken.apply(this, arguments);
|
|
275
224
|
}
|
|
276
|
-
|
|
277
225
|
return AuthorizationToken;
|
|
278
226
|
}()
|
|
279
227
|
}, {
|
|
@@ -281,136 +229,109 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
281
229
|
value: function () {
|
|
282
230
|
var _GenerateAuthorizationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
283
231
|
var libraryId, objectId, versionHash, partHash, encryption, _ref4$update, update, _ref4$noAuth, noAuth, publicKey, owner, ownerCapKey, ownerCap, cap, token, _yield$this$MakeAcces, transactionHash, signature, multiSig;
|
|
284
|
-
|
|
285
232
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
286
|
-
while (1) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
_context3.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
_context3.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
token.qlib_id = libraryId;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (partHash) {
|
|
386
|
-
token.qphash = partHash;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (publicKey) {
|
|
390
|
-
token.afgh_pk = publicKey;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
token = Utils.B64(JSON.stringify(token));
|
|
394
|
-
_context3.next = 35;
|
|
395
|
-
return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(token)));
|
|
396
|
-
|
|
397
|
-
case 35:
|
|
398
|
-
signature = _context3.sent;
|
|
399
|
-
multiSig = Utils.FormatSignature(signature);
|
|
400
|
-
return _context3.abrupt("return", "".concat(token, ".").concat(Utils.B64(multiSig)));
|
|
401
|
-
|
|
402
|
-
case 38:
|
|
403
|
-
case "end":
|
|
404
|
-
return _context3.stop();
|
|
405
|
-
}
|
|
233
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
libraryId = _ref4.libraryId, objectId = _ref4.objectId, versionHash = _ref4.versionHash, partHash = _ref4.partHash, encryption = _ref4.encryption, _ref4$update = _ref4.update, update = _ref4$update === void 0 ? false : _ref4$update, _ref4$noAuth = _ref4.noAuth, noAuth = _ref4$noAuth === void 0 ? false : _ref4$noAuth;
|
|
236
|
+
if (versionHash) {
|
|
237
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Generate AFGH public key if encryption is specified
|
|
241
|
+
_context3.t0 = encryption && encryption !== "none" && objectId;
|
|
242
|
+
if (!_context3.t0) {
|
|
243
|
+
_context3.next = 9;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
_context3.next = 6;
|
|
247
|
+
return this.AccessType(objectId);
|
|
248
|
+
case 6:
|
|
249
|
+
_context3.t1 = _context3.sent;
|
|
250
|
+
_context3.t2 = ACCESS_TYPES.OBJECT;
|
|
251
|
+
_context3.t0 = _context3.t1 === _context3.t2;
|
|
252
|
+
case 9:
|
|
253
|
+
if (!_context3.t0) {
|
|
254
|
+
_context3.next = 22;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
_context3.next = 12;
|
|
258
|
+
return this.Owner({
|
|
259
|
+
id: objectId
|
|
260
|
+
});
|
|
261
|
+
case 12:
|
|
262
|
+
owner = _context3.sent;
|
|
263
|
+
ownerCapKey = "eluv.caps.iusr".concat(Utils.AddressToHash(this.client.signer.address));
|
|
264
|
+
_context3.next = 16;
|
|
265
|
+
return this.client.ContentObjectMetadata({
|
|
266
|
+
libraryId: libraryId,
|
|
267
|
+
objectId: objectId,
|
|
268
|
+
metadataSubtree: ownerCapKey
|
|
269
|
+
});
|
|
270
|
+
case 16:
|
|
271
|
+
ownerCap = _context3.sent;
|
|
272
|
+
if (!(!Utils.EqualAddress(owner, this.client.signer.address) && !ownerCap)) {
|
|
273
|
+
_context3.next = 22;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
_context3.next = 20;
|
|
277
|
+
return this.ReEncryptionConk({
|
|
278
|
+
libraryId: libraryId,
|
|
279
|
+
objectId: objectId
|
|
280
|
+
});
|
|
281
|
+
case 20:
|
|
282
|
+
cap = _context3.sent;
|
|
283
|
+
publicKey = cap.public_key;
|
|
284
|
+
case 22:
|
|
285
|
+
token = {
|
|
286
|
+
qspace_id: this.contentSpaceId,
|
|
287
|
+
addr: Utils.FormatAddress(this.client.signer && this.client.signer.address || "")
|
|
288
|
+
};
|
|
289
|
+
if (!update) {
|
|
290
|
+
_context3.next = 29;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
_context3.next = 26;
|
|
294
|
+
return this.MakeAccessRequest({
|
|
295
|
+
libraryId: libraryId,
|
|
296
|
+
objectId: objectId,
|
|
297
|
+
versionHash: versionHash,
|
|
298
|
+
update: update,
|
|
299
|
+
publicKey: publicKey,
|
|
300
|
+
noCache: this.noCache,
|
|
301
|
+
noAuth: this.noAuth || noAuth
|
|
302
|
+
});
|
|
303
|
+
case 26:
|
|
304
|
+
_yield$this$MakeAcces = _context3.sent;
|
|
305
|
+
transactionHash = _yield$this$MakeAcces.transactionHash;
|
|
306
|
+
if (transactionHash) {
|
|
307
|
+
token.tx_id = transactionHash;
|
|
308
|
+
}
|
|
309
|
+
case 29:
|
|
310
|
+
if (libraryId) {
|
|
311
|
+
token.qlib_id = libraryId;
|
|
312
|
+
}
|
|
313
|
+
if (partHash) {
|
|
314
|
+
token.qphash = partHash;
|
|
315
|
+
}
|
|
316
|
+
if (publicKey) {
|
|
317
|
+
token.afgh_pk = publicKey;
|
|
318
|
+
}
|
|
319
|
+
token = Utils.B64(JSON.stringify(token));
|
|
320
|
+
_context3.next = 35;
|
|
321
|
+
return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(token)));
|
|
322
|
+
case 35:
|
|
323
|
+
signature = _context3.sent;
|
|
324
|
+
multiSig = Utils.FormatSignature(signature);
|
|
325
|
+
return _context3.abrupt("return", "".concat(token, ".").concat(Utils.B64(multiSig)));
|
|
326
|
+
case 38:
|
|
327
|
+
case "end":
|
|
328
|
+
return _context3.stop();
|
|
406
329
|
}
|
|
407
330
|
}, _callee3, this);
|
|
408
331
|
}));
|
|
409
|
-
|
|
410
332
|
function GenerateAuthorizationToken(_x3) {
|
|
411
333
|
return _GenerateAuthorizationToken.apply(this, arguments);
|
|
412
334
|
}
|
|
413
|
-
|
|
414
335
|
return GenerateAuthorizationToken;
|
|
415
336
|
}()
|
|
416
337
|
}, {
|
|
@@ -418,226 +339,180 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
418
339
|
value: function () {
|
|
419
340
|
var _MakeAccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
|
|
420
341
|
var _this = this;
|
|
421
|
-
|
|
422
342
|
var libraryId, objectId, versionHash, _ref5$args, args, _ref5$publicKey, publicKey, _ref5$update, update, _ref5$skipCache, skipCache, _ref5$noCache, noCache, cacheOnly, walletContractAddress, walletCreated, id, _yield$this$ContractI, isV3, accessType, abi, _yield$this$AccessInf, accessArgs, checkAccessCharge, address, elapsed, _cache, accessRequest, cache;
|
|
423
|
-
|
|
424
343
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
425
|
-
while (1) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
if (this.client.signer) {
|
|
431
|
-
_context4.next = 3;
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
return _context4.abrupt("return", {
|
|
436
|
-
transactionHash: ""
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
case 3:
|
|
440
|
-
_context4.next = 5;
|
|
441
|
-
return this.client.userProfileClient.UserWalletAddress({
|
|
442
|
-
address: this.client.signer.address
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
case 5:
|
|
446
|
-
walletContractAddress = _context4.sent;
|
|
447
|
-
|
|
448
|
-
if (walletContractAddress) {
|
|
449
|
-
_context4.next = 12;
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
_context4.next = 9;
|
|
454
|
-
return this.client.userProfileClient.WalletAddress();
|
|
455
|
-
|
|
456
|
-
case 9:
|
|
457
|
-
walletCreated = _context4.sent;
|
|
458
|
-
|
|
459
|
-
if (walletCreated) {
|
|
460
|
-
_context4.next = 12;
|
|
461
|
-
break;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
throw Error("User wallet contract is required to make access requests");
|
|
465
|
-
|
|
466
|
-
case 12:
|
|
467
|
-
if (versionHash) {
|
|
468
|
-
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
id = objectId || libraryId || this.contentSpaceId;
|
|
472
|
-
_context4.next = 16;
|
|
473
|
-
return this.ContractInfo({
|
|
474
|
-
id: id
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
case 16:
|
|
478
|
-
_yield$this$ContractI = _context4.sent;
|
|
479
|
-
isV3 = _yield$this$ContractI.isV3;
|
|
480
|
-
accessType = _yield$this$ContractI.accessType;
|
|
481
|
-
abi = _yield$this$ContractI.abi;
|
|
482
|
-
|
|
483
|
-
if (!(typeof accessType === "undefined")) {
|
|
484
|
-
_context4.next = 22;
|
|
485
|
-
break;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
throw Error("Unable to determine contract info for ".concat(id, " (").concat(this.client.utils.HashToAddress(id), ") - Wrong network?"));
|
|
489
|
-
|
|
490
|
-
case 22:
|
|
491
|
-
_context4.next = 24;
|
|
492
|
-
return this.AccessInfo({
|
|
493
|
-
accessType: accessType,
|
|
494
|
-
publicKey: publicKey,
|
|
495
|
-
update: update,
|
|
496
|
-
args: args,
|
|
497
|
-
isV3: isV3
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
case 24:
|
|
501
|
-
_yield$this$AccessInf = _context4.sent;
|
|
502
|
-
accessArgs = _yield$this$AccessInf.accessArgs;
|
|
503
|
-
checkAccessCharge = _yield$this$AccessInf.checkAccessCharge;
|
|
504
|
-
address = Utils.HashToAddress(id);
|
|
505
|
-
elapsed = 0;
|
|
506
|
-
|
|
507
|
-
case 29:
|
|
508
|
-
if (!this.transactionLocks[id]) {
|
|
509
|
-
_context4.next = 36;
|
|
510
|
-
break;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
_context4.next = 32;
|
|
514
|
-
return new Promise(function (resolve) {
|
|
515
|
-
return setTimeout(resolve, 100);
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
case 32:
|
|
519
|
-
elapsed += 100;
|
|
520
|
-
|
|
521
|
-
if (elapsed > 15000) {
|
|
522
|
-
this.Log("Lock never released for ".concat(id, " - releasing lock"));
|
|
523
|
-
delete this.transactionLocks[id];
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
_context4.next = 29;
|
|
344
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
345
|
+
case 0:
|
|
346
|
+
libraryId = _ref5.libraryId, objectId = _ref5.objectId, versionHash = _ref5.versionHash, _ref5$args = _ref5.args, args = _ref5$args === void 0 ? [] : _ref5$args, _ref5$publicKey = _ref5.publicKey, publicKey = _ref5$publicKey === void 0 ? "" : _ref5$publicKey, _ref5$update = _ref5.update, update = _ref5$update === void 0 ? false : _ref5$update, _ref5$skipCache = _ref5.skipCache, skipCache = _ref5$skipCache === void 0 ? false : _ref5$skipCache, _ref5$noCache = _ref5.noCache, noCache = _ref5$noCache === void 0 ? false : _ref5$noCache, cacheOnly = _ref5.cacheOnly;
|
|
347
|
+
if (this.client.signer) {
|
|
348
|
+
_context4.next = 3;
|
|
527
349
|
break;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
_context4.next = 46;
|
|
542
|
-
break;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
if (!(_cache[address].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
546
|
-
_context4.next = 45;
|
|
547
|
-
break;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
return _context4.abrupt("return", _cache[address]);
|
|
551
|
-
|
|
552
|
-
case 45:
|
|
553
|
-
// Token expired
|
|
554
|
-
delete _cache[address];
|
|
555
|
-
|
|
556
|
-
case 46:
|
|
557
|
-
if (!cacheOnly) {
|
|
558
|
-
_context4.next = 48;
|
|
559
|
-
break;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
return _context4.abrupt("return");
|
|
563
|
-
|
|
564
|
-
case 48:
|
|
565
|
-
if (!update) {
|
|
566
|
-
_context4.next = 55;
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
this.Log("Making update request on ".concat(accessType, " ").concat(id));
|
|
571
|
-
_context4.next = 52;
|
|
572
|
-
return this.UpdateRequest({
|
|
573
|
-
id: id,
|
|
574
|
-
abi: abi
|
|
575
|
-
});
|
|
576
|
-
|
|
577
|
-
case 52:
|
|
578
|
-
accessRequest = _context4.sent;
|
|
579
|
-
_context4.next = 59;
|
|
350
|
+
}
|
|
351
|
+
return _context4.abrupt("return", {
|
|
352
|
+
transactionHash: ""
|
|
353
|
+
});
|
|
354
|
+
case 3:
|
|
355
|
+
_context4.next = 5;
|
|
356
|
+
return this.client.userProfileClient.UserWalletAddress({
|
|
357
|
+
address: this.client.signer.address
|
|
358
|
+
});
|
|
359
|
+
case 5:
|
|
360
|
+
walletContractAddress = _context4.sent;
|
|
361
|
+
if (walletContractAddress) {
|
|
362
|
+
_context4.next = 12;
|
|
580
363
|
break;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
364
|
+
}
|
|
365
|
+
_context4.next = 9;
|
|
366
|
+
return this.client.userProfileClient.WalletAddress();
|
|
367
|
+
case 9:
|
|
368
|
+
walletCreated = _context4.sent;
|
|
369
|
+
if (walletCreated) {
|
|
370
|
+
_context4.next = 12;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
throw Error("User wallet contract is required to make access requests");
|
|
374
|
+
case 12:
|
|
375
|
+
if (versionHash) {
|
|
376
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
377
|
+
}
|
|
378
|
+
id = objectId || libraryId || this.contentSpaceId;
|
|
379
|
+
_context4.next = 16;
|
|
380
|
+
return this.ContractInfo({
|
|
381
|
+
id: id
|
|
382
|
+
});
|
|
383
|
+
case 16:
|
|
384
|
+
_yield$this$ContractI = _context4.sent;
|
|
385
|
+
isV3 = _yield$this$ContractI.isV3;
|
|
386
|
+
accessType = _yield$this$ContractI.accessType;
|
|
387
|
+
abi = _yield$this$ContractI.abi;
|
|
388
|
+
if (!(typeof accessType === "undefined")) {
|
|
389
|
+
_context4.next = 22;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
throw Error("Unable to determine contract info for ".concat(id, " (").concat(this.client.utils.HashToAddress(id), ") - Wrong network?"));
|
|
393
|
+
case 22:
|
|
394
|
+
_context4.next = 24;
|
|
395
|
+
return this.AccessInfo({
|
|
396
|
+
accessType: accessType,
|
|
397
|
+
publicKey: publicKey,
|
|
398
|
+
update: update,
|
|
399
|
+
args: args,
|
|
400
|
+
isV3: isV3
|
|
401
|
+
});
|
|
402
|
+
case 24:
|
|
403
|
+
_yield$this$AccessInf = _context4.sent;
|
|
404
|
+
accessArgs = _yield$this$AccessInf.accessArgs;
|
|
405
|
+
checkAccessCharge = _yield$this$AccessInf.checkAccessCharge;
|
|
406
|
+
address = Utils.HashToAddress(id);
|
|
407
|
+
elapsed = 0;
|
|
408
|
+
case 29:
|
|
409
|
+
if (!this.transactionLocks[id]) {
|
|
410
|
+
_context4.next = 36;
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
_context4.next = 32;
|
|
414
|
+
return new Promise(function (resolve) {
|
|
415
|
+
return setTimeout(resolve, 100);
|
|
416
|
+
});
|
|
417
|
+
case 32:
|
|
418
|
+
elapsed += 100;
|
|
419
|
+
if (elapsed > 15000) {
|
|
420
|
+
this.Log("Lock never released for ".concat(id, " - releasing lock"));
|
|
626
421
|
delete this.transactionLocks[id];
|
|
627
|
-
|
|
422
|
+
}
|
|
423
|
+
_context4.next = 29;
|
|
424
|
+
break;
|
|
425
|
+
case 36:
|
|
426
|
+
_context4.prev = 36;
|
|
427
|
+
this.transactionLocks[id] = true;
|
|
428
|
+
|
|
429
|
+
// Check cache for existing transaction
|
|
430
|
+
if (!(!noCache && !skipCache)) {
|
|
431
|
+
_context4.next = 46;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
_cache = update ? this.modifyTransactions : this.accessTransactions;
|
|
435
|
+
if (!_cache[address]) {
|
|
436
|
+
_context4.next = 46;
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
if (!(_cache[address].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
440
|
+
_context4.next = 45;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
return _context4.abrupt("return", _cache[address]);
|
|
444
|
+
case 45:
|
|
445
|
+
// Token expired
|
|
446
|
+
delete _cache[address];
|
|
447
|
+
case 46:
|
|
448
|
+
if (!cacheOnly) {
|
|
449
|
+
_context4.next = 48;
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
return _context4.abrupt("return");
|
|
453
|
+
case 48:
|
|
454
|
+
if (!update) {
|
|
455
|
+
_context4.next = 55;
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
this.Log("Making update request on ".concat(accessType, " ").concat(id));
|
|
459
|
+
_context4.next = 52;
|
|
460
|
+
return this.UpdateRequest({
|
|
461
|
+
id: id,
|
|
462
|
+
abi: abi
|
|
463
|
+
});
|
|
464
|
+
case 52:
|
|
465
|
+
accessRequest = _context4.sent;
|
|
466
|
+
_context4.next = 59;
|
|
467
|
+
break;
|
|
468
|
+
case 55:
|
|
469
|
+
this.Log("Making access request on ".concat(accessType, " ").concat(id));
|
|
470
|
+
_context4.next = 58;
|
|
471
|
+
return this.AccessRequest({
|
|
472
|
+
id: id,
|
|
473
|
+
args: accessArgs,
|
|
474
|
+
checkAccessCharge: checkAccessCharge
|
|
475
|
+
});
|
|
476
|
+
case 58:
|
|
477
|
+
accessRequest = _context4.sent;
|
|
478
|
+
case 59:
|
|
479
|
+
cache = update ? this.modifyTransactions : this.accessTransactions;
|
|
480
|
+
_context4.prev = 60;
|
|
481
|
+
if (!noCache) {
|
|
482
|
+
cache[address] = {
|
|
483
|
+
issuedAt: Date.now(),
|
|
484
|
+
transactionHash: accessRequest.transactionHash
|
|
485
|
+
};
|
|
628
486
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
487
|
+
// Save request ID if present
|
|
488
|
+
accessRequest.logs.some(function (log) {
|
|
489
|
+
if (log.args && (log.args.requestID || log.args.requestNonce)) {
|
|
490
|
+
_this.requestIds[address] = (log.args.requestID || log.args.requestNonce || "").toString().replace(/^0x/, "");
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
return _context4.abrupt("return", accessRequest);
|
|
496
|
+
case 65:
|
|
497
|
+
_context4.prev = 65;
|
|
498
|
+
_context4.t0 = _context4["catch"](60);
|
|
499
|
+
if (!noCache) {
|
|
500
|
+
delete cache[address];
|
|
501
|
+
}
|
|
502
|
+
throw _context4.t0;
|
|
503
|
+
case 69:
|
|
504
|
+
_context4.prev = 69;
|
|
505
|
+
delete this.transactionLocks[id];
|
|
506
|
+
return _context4.finish(69);
|
|
507
|
+
case 72:
|
|
508
|
+
case "end":
|
|
509
|
+
return _context4.stop();
|
|
633
510
|
}
|
|
634
511
|
}, _callee4, this, [[36,, 69, 72], [60, 65]]);
|
|
635
512
|
}));
|
|
636
|
-
|
|
637
513
|
function MakeAccessRequest(_x4) {
|
|
638
514
|
return _MakeAccessRequest.apply(this, arguments);
|
|
639
515
|
}
|
|
640
|
-
|
|
641
516
|
return MakeAccessRequest;
|
|
642
517
|
}()
|
|
643
518
|
}, {
|
|
@@ -645,134 +520,108 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
645
520
|
value: function () {
|
|
646
521
|
var _AccessRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref6) {
|
|
647
522
|
var id, _ref6$args, args, _ref6$checkAccessChar, checkAccessCharge, _yield$this$ContractI2, isV3, accessType, abi, accessCharge, owner, accessChargeArgs, event, methodName, contractAddress;
|
|
648
|
-
|
|
649
523
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
650
|
-
while (1) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
accessCharge = 0;
|
|
666
|
-
|
|
667
|
-
if (!(checkAccessCharge && accessType === ACCESS_TYPES.OBJECT)) {
|
|
668
|
-
_context5.next = 26;
|
|
669
|
-
break;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
_context5.next = 11;
|
|
673
|
-
return this.Owner({
|
|
674
|
-
id: id,
|
|
675
|
-
abi: abi
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
case 11:
|
|
679
|
-
owner = _context5.sent;
|
|
680
|
-
|
|
681
|
-
if (Utils.EqualAddress(this.client.signer.address, owner)) {
|
|
682
|
-
_context5.next = 26;
|
|
683
|
-
break;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
_context5.prev = 13;
|
|
687
|
-
// Extract level, custom values and stakeholders from accessRequest arguments
|
|
688
|
-
accessChargeArgs = isV3 ? [0, [], []] : [args[0], args[3], args[4]]; // Access charge is in wei, but methods take ether - convert to charge to ether
|
|
689
|
-
|
|
690
|
-
_context5.t0 = Utils;
|
|
691
|
-
_context5.next = 18;
|
|
692
|
-
return this.GetAccessCharge({
|
|
693
|
-
objectId: id,
|
|
694
|
-
args: accessChargeArgs
|
|
695
|
-
});
|
|
696
|
-
|
|
697
|
-
case 18:
|
|
698
|
-
_context5.t1 = _context5.sent;
|
|
699
|
-
accessCharge = _context5.t0.WeiToEther.call(_context5.t0, _context5.t1);
|
|
524
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
525
|
+
case 0:
|
|
526
|
+
id = _ref6.id, _ref6$args = _ref6.args, args = _ref6$args === void 0 ? [] : _ref6$args, _ref6$checkAccessChar = _ref6.checkAccessCharge, checkAccessCharge = _ref6$checkAccessChar === void 0 ? false : _ref6$checkAccessChar;
|
|
527
|
+
_context5.next = 3;
|
|
528
|
+
return this.ContractInfo({
|
|
529
|
+
id: id
|
|
530
|
+
});
|
|
531
|
+
case 3:
|
|
532
|
+
_yield$this$ContractI2 = _context5.sent;
|
|
533
|
+
isV3 = _yield$this$ContractI2.isV3;
|
|
534
|
+
accessType = _yield$this$ContractI2.accessType;
|
|
535
|
+
abi = _yield$this$ContractI2.abi;
|
|
536
|
+
// Send some bux if access charge is required
|
|
537
|
+
accessCharge = 0;
|
|
538
|
+
if (!(checkAccessCharge && accessType === ACCESS_TYPES.OBJECT)) {
|
|
700
539
|
_context5.next = 26;
|
|
701
540
|
break;
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
this.Log("
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
541
|
+
}
|
|
542
|
+
_context5.next = 11;
|
|
543
|
+
return this.Owner({
|
|
544
|
+
id: id,
|
|
545
|
+
abi: abi
|
|
546
|
+
});
|
|
547
|
+
case 11:
|
|
548
|
+
owner = _context5.sent;
|
|
549
|
+
if (Utils.EqualAddress(this.client.signer.address, owner)) {
|
|
550
|
+
_context5.next = 26;
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
_context5.prev = 13;
|
|
554
|
+
// Extract level, custom values and stakeholders from accessRequest arguments
|
|
555
|
+
accessChargeArgs = isV3 ? [0, [], []] : [args[0], args[3], args[4]]; // Access charge is in wei, but methods take ether - convert to charge to ether
|
|
556
|
+
_context5.t0 = Utils;
|
|
557
|
+
_context5.next = 18;
|
|
558
|
+
return this.GetAccessCharge({
|
|
559
|
+
objectId: id,
|
|
560
|
+
args: accessChargeArgs
|
|
561
|
+
});
|
|
562
|
+
case 18:
|
|
563
|
+
_context5.t1 = _context5.sent;
|
|
564
|
+
accessCharge = _context5.t0.WeiToEther.call(_context5.t0, _context5.t1);
|
|
565
|
+
_context5.next = 26;
|
|
566
|
+
break;
|
|
567
|
+
case 22:
|
|
568
|
+
_context5.prev = 22;
|
|
569
|
+
_context5.t2 = _context5["catch"](13);
|
|
570
|
+
this.Log("Failed to get access charge for", id);
|
|
571
|
+
this.Log(_context5.t2);
|
|
572
|
+
case 26:
|
|
573
|
+
if (accessCharge > 0) {
|
|
574
|
+
this.Log("Access charge: ".concat(accessCharge));
|
|
575
|
+
}
|
|
576
|
+
contractAddress = Utils.HashToAddress(id);
|
|
577
|
+
if (isV3) {
|
|
578
|
+
methodName = "accessRequestV3";
|
|
579
|
+
} else {
|
|
580
|
+
methodName = "accessRequest";
|
|
581
|
+
}
|
|
582
|
+
_context5.next = 31;
|
|
583
|
+
return this.ContractHasMethod({
|
|
584
|
+
contractAddress: contractAddress,
|
|
585
|
+
abi: abi,
|
|
586
|
+
methodName: methodName
|
|
587
|
+
});
|
|
588
|
+
case 31:
|
|
589
|
+
if (_context5.sent) {
|
|
590
|
+
_context5.next = 34;
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
this.Log("".concat(accessType, " ").concat(id, " has no ").concat(methodName, " method. Skipping"));
|
|
594
|
+
return _context5.abrupt("return", {
|
|
595
|
+
transactionHash: "",
|
|
596
|
+
logs: []
|
|
597
|
+
});
|
|
598
|
+
case 34:
|
|
599
|
+
_context5.next = 36;
|
|
600
|
+
return this.client.CallContractMethodAndWait({
|
|
601
|
+
contractAddress: contractAddress,
|
|
602
|
+
abi: abi,
|
|
603
|
+
methodName: methodName,
|
|
604
|
+
methodArgs: args,
|
|
605
|
+
value: accessCharge
|
|
606
|
+
});
|
|
607
|
+
case 36:
|
|
608
|
+
event = _context5.sent;
|
|
609
|
+
if (!(event.logs.length === 0)) {
|
|
610
|
+
_context5.next = 39;
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
throw Error("Access denied (".concat(id, ")"));
|
|
614
|
+
case 39:
|
|
615
|
+
return _context5.abrupt("return", event);
|
|
616
|
+
case 40:
|
|
617
|
+
case "end":
|
|
618
|
+
return _context5.stop();
|
|
768
619
|
}
|
|
769
620
|
}, _callee5, this, [[13, 22]]);
|
|
770
621
|
}));
|
|
771
|
-
|
|
772
622
|
function AccessRequest(_x5) {
|
|
773
623
|
return _AccessRequest.apply(this, arguments);
|
|
774
624
|
}
|
|
775
|
-
|
|
776
625
|
return AccessRequest;
|
|
777
626
|
}()
|
|
778
627
|
}, {
|
|
@@ -781,69 +630,58 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
781
630
|
var _UpdateRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref7) {
|
|
782
631
|
var id, abi, event, updateRequestEvent;
|
|
783
632
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
784
|
-
while (1) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
case 7:
|
|
812
|
-
return _context6.abrupt("return", event);
|
|
813
|
-
|
|
814
|
-
case 8:
|
|
815
|
-
case "end":
|
|
816
|
-
return _context6.stop();
|
|
817
|
-
}
|
|
633
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
634
|
+
case 0:
|
|
635
|
+
id = _ref7.id, abi = _ref7.abi;
|
|
636
|
+
_context6.next = 3;
|
|
637
|
+
return this.client.CallContractMethodAndWait({
|
|
638
|
+
contractAddress: Utils.HashToAddress(id),
|
|
639
|
+
abi: abi,
|
|
640
|
+
methodName: "updateRequest",
|
|
641
|
+
methodArgs: []
|
|
642
|
+
});
|
|
643
|
+
case 3:
|
|
644
|
+
event = _context6.sent;
|
|
645
|
+
updateRequestEvent = this.client.ExtractEventFromLogs({
|
|
646
|
+
abi: abi,
|
|
647
|
+
event: event,
|
|
648
|
+
eventName: "UpdateRequest"
|
|
649
|
+
});
|
|
650
|
+
if (!(event.logs.length === 0 || !updateRequestEvent)) {
|
|
651
|
+
_context6.next = 7;
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
throw Error("Update request denied for ".concat(id));
|
|
655
|
+
case 7:
|
|
656
|
+
return _context6.abrupt("return", event);
|
|
657
|
+
case 8:
|
|
658
|
+
case "end":
|
|
659
|
+
return _context6.stop();
|
|
818
660
|
}
|
|
819
661
|
}, _callee6, this);
|
|
820
662
|
}));
|
|
821
|
-
|
|
822
663
|
function UpdateRequest(_x6) {
|
|
823
664
|
return _UpdateRequest.apply(this, arguments);
|
|
824
665
|
}
|
|
825
|
-
|
|
826
666
|
return UpdateRequest;
|
|
827
667
|
}()
|
|
828
668
|
}, {
|
|
829
669
|
key: "AudienceData",
|
|
830
670
|
value: function AudienceData(_ref8) {
|
|
831
671
|
var objectId = _ref8.objectId,
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
672
|
+
versionHash = _ref8.versionHash,
|
|
673
|
+
_ref8$protocols = _ref8.protocols,
|
|
674
|
+
protocols = _ref8$protocols === void 0 ? [] : _ref8$protocols,
|
|
675
|
+
_ref8$drms = _ref8.drms,
|
|
676
|
+
drms = _ref8$drms === void 0 ? [] : _ref8$drms,
|
|
677
|
+
context = _ref8.context;
|
|
838
678
|
this.Log("Retrieving audience data: ".concat(objectId));
|
|
839
679
|
context = context || this.client.authContext || {};
|
|
840
|
-
|
|
841
680
|
if (Object.values(context).find(function (value) {
|
|
842
681
|
return typeof value !== "string";
|
|
843
682
|
})) {
|
|
844
683
|
throw Error("Context must be a map of string->string");
|
|
845
684
|
}
|
|
846
|
-
|
|
847
685
|
var data = _objectSpread({
|
|
848
686
|
user_address: Utils.FormatAddress(this.client.signer.address),
|
|
849
687
|
content_id: objectId || Utils.DecodeVersionHash(versionHash).id,
|
|
@@ -853,12 +691,10 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
853
691
|
format: protocols.join(","),
|
|
854
692
|
drm: drms.join(",")
|
|
855
693
|
}, context);
|
|
856
|
-
|
|
857
694
|
if (typeof window !== "undefined" && window.navigator) {
|
|
858
695
|
data.user_string = window.navigator.userAgent;
|
|
859
696
|
data.language = window.navigator.language;
|
|
860
697
|
}
|
|
861
|
-
|
|
862
698
|
this.Log(data);
|
|
863
699
|
return data;
|
|
864
700
|
}
|
|
@@ -867,180 +703,147 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
867
703
|
value: function () {
|
|
868
704
|
var _GenerateChannelContentToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref9) {
|
|
869
705
|
var objectId, versionHash, issuer, code, email, audienceData, context, oauthToken, _ref9$value, value, token, tenantId, kmsAddress, stateChannelApi, additionalParams, payload, signature, multiSig;
|
|
870
|
-
|
|
871
706
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
872
|
-
while (1) {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
if (!oauthToken) {
|
|
878
|
-
_context7.next = 5;
|
|
879
|
-
break;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
_context7.next = 4;
|
|
883
|
-
return this.GenerateOauthChannelToken({
|
|
884
|
-
objectId: objectId,
|
|
885
|
-
token: oauthToken
|
|
886
|
-
});
|
|
887
|
-
|
|
888
|
-
case 4:
|
|
889
|
-
return _context7.abrupt("return", _context7.sent);
|
|
890
|
-
|
|
891
|
-
case 5:
|
|
892
|
-
if (!(!this.noCache && this.channelContentTokens[objectId])) {
|
|
893
|
-
_context7.next = 11;
|
|
894
|
-
break;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
898
|
-
_context7.next = 10;
|
|
899
|
-
break;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
return _context7.abrupt("return", this.channelContentTokens[objectId].token);
|
|
903
|
-
|
|
904
|
-
case 10:
|
|
905
|
-
// Token expired
|
|
906
|
-
delete this.channelContentTokens[objectId];
|
|
907
|
-
|
|
908
|
-
case 11:
|
|
909
|
-
this.Log("Making state channel access request: ".concat(objectId));
|
|
910
|
-
|
|
911
|
-
if (!issuer) {
|
|
912
|
-
_context7.next = 43;
|
|
913
|
-
break;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// Ticket API
|
|
917
|
-
tenantId = issuer.replace(/^\//, "").split("/")[2];
|
|
918
|
-
_context7.prev = 14;
|
|
919
|
-
_context7.next = 17;
|
|
920
|
-
return this.client.CallContractMethod({
|
|
921
|
-
contractAddress: Utils.HashToAddress(tenantId),
|
|
922
|
-
methodName: "addressKMS"
|
|
923
|
-
});
|
|
924
|
-
|
|
925
|
-
case 17:
|
|
926
|
-
kmsAddress = _context7.sent;
|
|
927
|
-
|
|
928
|
-
if (kmsAddress) {
|
|
929
|
-
_context7.next = 20;
|
|
930
|
-
break;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
throw "";
|
|
934
|
-
|
|
935
|
-
case 20:
|
|
936
|
-
_context7.next = 27;
|
|
707
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
708
|
+
case 0:
|
|
709
|
+
objectId = _ref9.objectId, versionHash = _ref9.versionHash, issuer = _ref9.issuer, code = _ref9.code, email = _ref9.email, audienceData = _ref9.audienceData, context = _ref9.context, oauthToken = _ref9.oauthToken, _ref9$value = _ref9.value, value = _ref9$value === void 0 ? 0 : _ref9$value;
|
|
710
|
+
if (!oauthToken) {
|
|
711
|
+
_context7.next = 5;
|
|
937
712
|
break;
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
_context7.prev = 27;
|
|
950
|
-
_context7.next = 30;
|
|
951
|
-
return Utils.ResponseToFormat("text", this.MakeAuthServiceRequest({
|
|
952
|
-
kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
|
|
953
|
-
method: "POST",
|
|
954
|
-
path: UrlJoin("as", issuer),
|
|
955
|
-
body: {
|
|
956
|
-
"_PASSWORD": code,
|
|
957
|
-
"_EMAIL": email
|
|
958
|
-
}
|
|
959
|
-
}));
|
|
960
|
-
|
|
961
|
-
case 30:
|
|
962
|
-
token = _context7.sent;
|
|
963
|
-
_context7.next = 40;
|
|
713
|
+
}
|
|
714
|
+
_context7.next = 4;
|
|
715
|
+
return this.GenerateOauthChannelToken({
|
|
716
|
+
objectId: objectId,
|
|
717
|
+
token: oauthToken
|
|
718
|
+
});
|
|
719
|
+
case 4:
|
|
720
|
+
return _context7.abrupt("return", _context7.sent);
|
|
721
|
+
case 5:
|
|
722
|
+
if (!(!this.noCache && this.channelContentTokens[objectId])) {
|
|
723
|
+
_context7.next = 11;
|
|
964
724
|
break;
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
_context7.
|
|
968
|
-
_context7.t1 = _context7["catch"](27);
|
|
969
|
-
this.Log("/as token redemption failed:", true);
|
|
970
|
-
this.Log(_context7.t1, true);
|
|
971
|
-
_context7.next = 39;
|
|
972
|
-
return Utils.ResponseToFormat("text", this.MakeKMSRequest({
|
|
973
|
-
kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
|
|
974
|
-
method: "POST",
|
|
975
|
-
path: UrlJoin("ks", issuer),
|
|
976
|
-
body: {
|
|
977
|
-
"_PASSWORD": code,
|
|
978
|
-
"_EMAIL": email
|
|
979
|
-
}
|
|
980
|
-
}));
|
|
981
|
-
|
|
982
|
-
case 39:
|
|
983
|
-
token = _context7.sent;
|
|
984
|
-
|
|
985
|
-
case 40:
|
|
986
|
-
// Pull target object from token so token can be cached
|
|
987
|
-
objectId = JSON.parse(Utils.FromB64(token)).qid;
|
|
988
|
-
_context7.next = 54;
|
|
725
|
+
}
|
|
726
|
+
if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
727
|
+
_context7.next = 10;
|
|
989
728
|
break;
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
729
|
+
}
|
|
730
|
+
return _context7.abrupt("return", this.channelContentTokens[objectId].token);
|
|
731
|
+
case 10:
|
|
732
|
+
// Token expired
|
|
733
|
+
delete this.channelContentTokens[objectId];
|
|
734
|
+
case 11:
|
|
735
|
+
this.Log("Making state channel access request: ".concat(objectId));
|
|
736
|
+
if (!issuer) {
|
|
737
|
+
_context7.next = 43;
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
// Ticket API
|
|
741
|
+
tenantId = issuer.replace(/^\//, "").split("/")[2];
|
|
742
|
+
_context7.prev = 14;
|
|
743
|
+
_context7.next = 17;
|
|
744
|
+
return this.client.CallContractMethod({
|
|
745
|
+
contractAddress: Utils.HashToAddress(tenantId),
|
|
746
|
+
methodName: "addressKMS"
|
|
747
|
+
});
|
|
748
|
+
case 17:
|
|
749
|
+
kmsAddress = _context7.sent;
|
|
750
|
+
if (kmsAddress) {
|
|
751
|
+
_context7.next = 20;
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
throw "";
|
|
755
|
+
case 20:
|
|
756
|
+
_context7.next = 27;
|
|
757
|
+
break;
|
|
758
|
+
case 22:
|
|
759
|
+
_context7.prev = 22;
|
|
760
|
+
_context7.t0 = _context7["catch"](14);
|
|
761
|
+
_context7.next = 26;
|
|
762
|
+
return this.client.DefaultKMSAddress();
|
|
763
|
+
case 26:
|
|
764
|
+
kmsAddress = _context7.sent;
|
|
765
|
+
case 27:
|
|
766
|
+
_context7.prev = 27;
|
|
767
|
+
_context7.next = 30;
|
|
768
|
+
return Utils.ResponseToFormat("text", this.MakeAuthServiceRequest({
|
|
769
|
+
kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
|
|
770
|
+
method: "POST",
|
|
771
|
+
path: UrlJoin("as", issuer),
|
|
772
|
+
body: {
|
|
773
|
+
"_PASSWORD": code,
|
|
774
|
+
"_EMAIL": email
|
|
775
|
+
}
|
|
776
|
+
}));
|
|
777
|
+
case 30:
|
|
778
|
+
token = _context7.sent;
|
|
779
|
+
_context7.next = 40;
|
|
780
|
+
break;
|
|
781
|
+
case 33:
|
|
782
|
+
_context7.prev = 33;
|
|
783
|
+
_context7.t1 = _context7["catch"](27);
|
|
784
|
+
this.Log("/as token redemption failed:", true);
|
|
785
|
+
this.Log(_context7.t1, true);
|
|
786
|
+
_context7.next = 39;
|
|
787
|
+
return Utils.ResponseToFormat("text", this.MakeKMSRequest({
|
|
788
|
+
kmsId: "ikms" + Utils.AddressToHash(kmsAddress),
|
|
789
|
+
method: "POST",
|
|
790
|
+
path: UrlJoin("ks", issuer),
|
|
791
|
+
body: {
|
|
792
|
+
"_PASSWORD": code,
|
|
793
|
+
"_EMAIL": email
|
|
794
|
+
}
|
|
795
|
+
}));
|
|
796
|
+
case 39:
|
|
797
|
+
token = _context7.sent;
|
|
798
|
+
case 40:
|
|
799
|
+
// Pull target object from token so token can be cached
|
|
800
|
+
objectId = JSON.parse(Utils.FromB64(token)).qid;
|
|
801
|
+
_context7.next = 54;
|
|
802
|
+
break;
|
|
803
|
+
case 43:
|
|
804
|
+
// State channel API
|
|
805
|
+
if (!audienceData) {
|
|
806
|
+
audienceData = this.AudienceData({
|
|
1005
807
|
objectId: objectId,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
808
|
+
versionHash: versionHash,
|
|
809
|
+
context: context
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
stateChannelApi = "elv_channelContentRequestContext";
|
|
813
|
+
additionalParams = [JSON.stringify(audienceData)];
|
|
814
|
+
_context7.next = 48;
|
|
815
|
+
return this.MakeKMSCall({
|
|
816
|
+
objectId: objectId,
|
|
817
|
+
methodName: stateChannelApi,
|
|
818
|
+
paramTypes: ["address", "address", "uint", "uint"],
|
|
819
|
+
params: [this.client.signer.address, Utils.HashToAddress(objectId), value, Date.now()],
|
|
820
|
+
additionalParams: additionalParams
|
|
821
|
+
});
|
|
822
|
+
case 48:
|
|
823
|
+
payload = _context7.sent;
|
|
824
|
+
_context7.next = 51;
|
|
825
|
+
return this.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(payload)));
|
|
826
|
+
case 51:
|
|
827
|
+
signature = _context7.sent;
|
|
828
|
+
multiSig = Utils.FormatSignature(signature);
|
|
829
|
+
token = "".concat(payload, ".").concat(Utils.B64(multiSig));
|
|
830
|
+
case 54:
|
|
831
|
+
if (!this.noCache) {
|
|
832
|
+
this.channelContentTokens[objectId] = {
|
|
833
|
+
token: token,
|
|
834
|
+
issuedAt: Date.now()
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
return _context7.abrupt("return", token);
|
|
838
|
+
case 56:
|
|
839
|
+
case "end":
|
|
840
|
+
return _context7.stop();
|
|
1036
841
|
}
|
|
1037
842
|
}, _callee7, this, [[14, 22], [27, 33]]);
|
|
1038
843
|
}));
|
|
1039
|
-
|
|
1040
844
|
function GenerateChannelContentToken(_x7) {
|
|
1041
845
|
return _GenerateChannelContentToken.apply(this, arguments);
|
|
1042
846
|
}
|
|
1043
|
-
|
|
1044
847
|
return GenerateChannelContentToken;
|
|
1045
848
|
}()
|
|
1046
849
|
}, {
|
|
@@ -1048,42 +851,35 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1048
851
|
value: function () {
|
|
1049
852
|
var _ChannelContentFinalize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref10) {
|
|
1050
853
|
var objectId, versionHash, _ref10$percent, percent, result;
|
|
1051
|
-
|
|
1052
854
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
1053
|
-
while (1) {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
855
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
856
|
+
case 0:
|
|
857
|
+
objectId = _ref10.objectId, versionHash = _ref10.versionHash, _ref10$percent = _ref10.percent, percent = _ref10$percent === void 0 ? 0 : _ref10$percent;
|
|
858
|
+
this.Log("Making state channel finalize request: ".concat(objectId));
|
|
859
|
+
_context8.next = 4;
|
|
860
|
+
return this.MakeKMSCall({
|
|
861
|
+
objectId: objectId,
|
|
862
|
+
methodName: "elv_channelContentFinalizeContext",
|
|
863
|
+
paramTypes: ["address", "address", "uint", "uint"],
|
|
864
|
+
params: [this.client.signer.address, Utils.HashToAddress(objectId), percent, Date.now()],
|
|
865
|
+
additionalParams: [JSON.stringify(this.AudienceData({
|
|
1060
866
|
objectId: objectId,
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
result = _context8.sent;
|
|
1072
|
-
this.channelContentTokens[objectId] = undefined;
|
|
1073
|
-
return _context8.abrupt("return", result);
|
|
1074
|
-
|
|
1075
|
-
case 7:
|
|
1076
|
-
case "end":
|
|
1077
|
-
return _context8.stop();
|
|
1078
|
-
}
|
|
867
|
+
versionHash: versionHash
|
|
868
|
+
}))]
|
|
869
|
+
});
|
|
870
|
+
case 4:
|
|
871
|
+
result = _context8.sent;
|
|
872
|
+
this.channelContentTokens[objectId] = undefined;
|
|
873
|
+
return _context8.abrupt("return", result);
|
|
874
|
+
case 7:
|
|
875
|
+
case "end":
|
|
876
|
+
return _context8.stop();
|
|
1079
877
|
}
|
|
1080
878
|
}, _callee8, this);
|
|
1081
879
|
}));
|
|
1082
|
-
|
|
1083
880
|
function ChannelContentFinalize(_x8) {
|
|
1084
881
|
return _ChannelContentFinalize.apply(this, arguments);
|
|
1085
882
|
}
|
|
1086
|
-
|
|
1087
883
|
return ChannelContentFinalize;
|
|
1088
884
|
}()
|
|
1089
885
|
}, {
|
|
@@ -1092,72 +888,57 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1092
888
|
var _GenerateOauthChannelToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref11) {
|
|
1093
889
|
var objectId, versionHash, token, fabricToken;
|
|
1094
890
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
1095
|
-
while (1) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (!this.noCache) {
|
|
1141
|
-
this.channelContentTokens[objectId] = {
|
|
1142
|
-
token: fabricToken,
|
|
1143
|
-
issuedAt: Date.now()
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
return _context9.abrupt("return", fabricToken);
|
|
1148
|
-
|
|
1149
|
-
case 13:
|
|
1150
|
-
case "end":
|
|
1151
|
-
return _context9.stop();
|
|
1152
|
-
}
|
|
891
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
892
|
+
case 0:
|
|
893
|
+
objectId = _ref11.objectId, versionHash = _ref11.versionHash, token = _ref11.token;
|
|
894
|
+
if (versionHash) {
|
|
895
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
896
|
+
}
|
|
897
|
+
if (!(!this.noCache && this.channelContentTokens[objectId])) {
|
|
898
|
+
_context9.next = 6;
|
|
899
|
+
break;
|
|
900
|
+
}
|
|
901
|
+
if (!(this.channelContentTokens[objectId].issuedAt > Date.now() - 12 * 60 * 60 * 1000)) {
|
|
902
|
+
_context9.next = 5;
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
return _context9.abrupt("return", this.channelContentTokens[objectId].token);
|
|
906
|
+
case 5:
|
|
907
|
+
// Token expired
|
|
908
|
+
this.channelContentTokens[objectId] = undefined;
|
|
909
|
+
case 6:
|
|
910
|
+
_context9.next = 8;
|
|
911
|
+
return this.MakeKMSRequest({
|
|
912
|
+
objectId: objectId,
|
|
913
|
+
versionHash: versionHash,
|
|
914
|
+
method: "GET",
|
|
915
|
+
path: UrlJoin("ks", "jwt", "q", objectId),
|
|
916
|
+
bodyType: "NONE",
|
|
917
|
+
headers: {
|
|
918
|
+
Authorization: "Bearer ".concat(token)
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
case 8:
|
|
922
|
+
_context9.next = 10;
|
|
923
|
+
return _context9.sent.text();
|
|
924
|
+
case 10:
|
|
925
|
+
fabricToken = _context9.sent;
|
|
926
|
+
if (!this.noCache) {
|
|
927
|
+
this.channelContentTokens[objectId] = {
|
|
928
|
+
token: fabricToken,
|
|
929
|
+
issuedAt: Date.now()
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
return _context9.abrupt("return", fabricToken);
|
|
933
|
+
case 13:
|
|
934
|
+
case "end":
|
|
935
|
+
return _context9.stop();
|
|
1153
936
|
}
|
|
1154
937
|
}, _callee9, this);
|
|
1155
938
|
}));
|
|
1156
|
-
|
|
1157
939
|
function GenerateOauthChannelToken(_x9) {
|
|
1158
940
|
return _GenerateOauthChannelToken.apply(this, arguments);
|
|
1159
941
|
}
|
|
1160
|
-
|
|
1161
942
|
return GenerateOauthChannelToken;
|
|
1162
943
|
}()
|
|
1163
944
|
}, {
|
|
@@ -1166,51 +947,39 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1166
947
|
var _IsV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref12) {
|
|
1167
948
|
var id, contractName;
|
|
1168
949
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
1169
|
-
while (1) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
_context10.next = 9;
|
|
1197
|
-
return this.accessVersions[contractName];
|
|
1198
|
-
|
|
1199
|
-
case 9:
|
|
1200
|
-
return _context10.abrupt("return", _context10.sent);
|
|
1201
|
-
|
|
1202
|
-
case 10:
|
|
1203
|
-
case "end":
|
|
1204
|
-
return _context10.stop();
|
|
1205
|
-
}
|
|
950
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
951
|
+
case 0:
|
|
952
|
+
id = _ref12.id;
|
|
953
|
+
if (!this.client.assumeV3) {
|
|
954
|
+
_context10.next = 3;
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
return _context10.abrupt("return", true);
|
|
958
|
+
case 3:
|
|
959
|
+
_context10.next = 5;
|
|
960
|
+
return this.client.ethClient.ContractName(Utils.HashToAddress(id), true);
|
|
961
|
+
case 5:
|
|
962
|
+
contractName = _context10.sent;
|
|
963
|
+
if (!this.accessVersions[contractName]) {
|
|
964
|
+
this.accessVersions[contractName] = this.ContractHasMethod({
|
|
965
|
+
contractAddress: this.client.utils.HashToAddress(id),
|
|
966
|
+
abi: this.CONTRACTS.v3[this.ACCESS_TYPES.ACCESSIBLE].abi,
|
|
967
|
+
methodName: "accessRequestV3"
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
_context10.next = 9;
|
|
971
|
+
return this.accessVersions[contractName];
|
|
972
|
+
case 9:
|
|
973
|
+
return _context10.abrupt("return", _context10.sent);
|
|
974
|
+
case 10:
|
|
975
|
+
case "end":
|
|
976
|
+
return _context10.stop();
|
|
1206
977
|
}
|
|
1207
978
|
}, _callee10, this);
|
|
1208
979
|
}));
|
|
1209
|
-
|
|
1210
980
|
function IsV3(_x10) {
|
|
1211
981
|
return _IsV.apply(this, arguments);
|
|
1212
982
|
}
|
|
1213
|
-
|
|
1214
983
|
return IsV3;
|
|
1215
984
|
}()
|
|
1216
985
|
}, {
|
|
@@ -1219,130 +988,108 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1219
988
|
var _AccessInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref13) {
|
|
1220
989
|
var accessType, publicKey, args, isV3, checkAccessCharge;
|
|
1221
990
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
1222
|
-
while (1) {
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
if (
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
991
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
992
|
+
case 0:
|
|
993
|
+
accessType = _ref13.accessType, publicKey = _ref13.publicKey, args = _ref13.args, isV3 = _ref13.isV3;
|
|
994
|
+
checkAccessCharge = false;
|
|
995
|
+
if (accessType === ACCESS_TYPES.OBJECT) {
|
|
996
|
+
checkAccessCharge = true;
|
|
997
|
+
if (!isV3) {
|
|
998
|
+
if (args && args.length > 0) {
|
|
999
|
+
// Inject public key of requester
|
|
1000
|
+
args[1] = this.client.signer._signingKey ? this.client.signer._signingKey().publicKey : "";
|
|
1001
|
+
} else {
|
|
1002
|
+
// Set default args
|
|
1003
|
+
args = [0,
|
|
1004
|
+
// Access level
|
|
1005
|
+
this.client.signer._signingKey ? this.client.signer._signingKey().publicKey : "",
|
|
1006
|
+
// Public key of requester
|
|
1007
|
+
publicKey,
|
|
1008
|
+
//cap.public_key,
|
|
1009
|
+
[],
|
|
1010
|
+
// Custom values
|
|
1011
|
+
[] // Stakeholders
|
|
1012
|
+
];
|
|
1244
1013
|
}
|
|
1245
1014
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
}
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
if (isV3 && (!args || args.length === 0)) {
|
|
1018
|
+
args = [[],
|
|
1019
|
+
// customValues
|
|
1020
|
+
[] // stakeholders
|
|
1021
|
+
];
|
|
1022
|
+
}
|
|
1023
|
+
return _context11.abrupt("return", {
|
|
1024
|
+
accessArgs: args,
|
|
1025
|
+
checkAccessCharge: checkAccessCharge
|
|
1026
|
+
});
|
|
1027
|
+
case 5:
|
|
1028
|
+
case "end":
|
|
1029
|
+
return _context11.stop();
|
|
1262
1030
|
}
|
|
1263
1031
|
}, _callee11, this);
|
|
1264
1032
|
}));
|
|
1265
|
-
|
|
1266
1033
|
function AccessInfo(_x11) {
|
|
1267
1034
|
return _AccessInfo.apply(this, arguments);
|
|
1268
1035
|
}
|
|
1269
|
-
|
|
1270
1036
|
return AccessInfo;
|
|
1271
1037
|
}() // Determine type of ID based on contract version string
|
|
1272
|
-
|
|
1273
1038
|
}, {
|
|
1274
1039
|
key: "AccessType",
|
|
1275
1040
|
value: function () {
|
|
1276
1041
|
var _AccessType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id) {
|
|
1277
1042
|
var contractName, accessType;
|
|
1278
1043
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
1279
|
-
while (1) {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
if (this.accessTypes[id]) {
|
|
1289
|
-
_context12.next = 23;
|
|
1290
|
-
break;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
_context12.t0 = contractName;
|
|
1294
|
-
_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;
|
|
1044
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1045
|
+
case 0:
|
|
1046
|
+
_context12.next = 2;
|
|
1047
|
+
return this.client.ethClient.ContractName(Utils.HashToAddress(id));
|
|
1048
|
+
case 2:
|
|
1049
|
+
contractName = _context12.sent;
|
|
1050
|
+
if (this.accessTypes[id]) {
|
|
1051
|
+
_context12.next = 23;
|
|
1295
1052
|
break;
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
case 23:
|
|
1332
|
-
return _context12.abrupt("return", this.accessTypes[id]);
|
|
1333
|
-
|
|
1334
|
-
case 24:
|
|
1335
|
-
case "end":
|
|
1336
|
-
return _context12.stop();
|
|
1337
|
-
}
|
|
1053
|
+
}
|
|
1054
|
+
_context12.t0 = contractName;
|
|
1055
|
+
_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;
|
|
1056
|
+
break;
|
|
1057
|
+
case 7:
|
|
1058
|
+
accessType = ACCESS_TYPES.SPACE;
|
|
1059
|
+
return _context12.abrupt("break", 22);
|
|
1060
|
+
case 9:
|
|
1061
|
+
accessType = ACCESS_TYPES.LIBRARY;
|
|
1062
|
+
return _context12.abrupt("break", 22);
|
|
1063
|
+
case 11:
|
|
1064
|
+
accessType = ACCESS_TYPES.TYPE;
|
|
1065
|
+
return _context12.abrupt("break", 22);
|
|
1066
|
+
case 13:
|
|
1067
|
+
accessType = ACCESS_TYPES.WALLET;
|
|
1068
|
+
return _context12.abrupt("break", 22);
|
|
1069
|
+
case 15:
|
|
1070
|
+
accessType = ACCESS_TYPES.GROUP;
|
|
1071
|
+
return _context12.abrupt("break", 22);
|
|
1072
|
+
case 17:
|
|
1073
|
+
accessType = ACCESS_TYPES.OBJECT;
|
|
1074
|
+
return _context12.abrupt("break", 22);
|
|
1075
|
+
case 19:
|
|
1076
|
+
accessType = ACCESS_TYPES.TENANT;
|
|
1077
|
+
return _context12.abrupt("break", 22);
|
|
1078
|
+
case 21:
|
|
1079
|
+
accessType = ACCESS_TYPES.OTHER;
|
|
1080
|
+
case 22:
|
|
1081
|
+
this.accessTypes[id] = accessType;
|
|
1082
|
+
case 23:
|
|
1083
|
+
return _context12.abrupt("return", this.accessTypes[id]);
|
|
1084
|
+
case 24:
|
|
1085
|
+
case "end":
|
|
1086
|
+
return _context12.stop();
|
|
1338
1087
|
}
|
|
1339
1088
|
}, _callee12, this);
|
|
1340
1089
|
}));
|
|
1341
|
-
|
|
1342
1090
|
function AccessType(_x12) {
|
|
1343
1091
|
return _AccessType.apply(this, arguments);
|
|
1344
1092
|
}
|
|
1345
|
-
|
|
1346
1093
|
return AccessType;
|
|
1347
1094
|
}()
|
|
1348
1095
|
}, {
|
|
@@ -1350,143 +1097,113 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1350
1097
|
value: function () {
|
|
1351
1098
|
var _AccessComplete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref14) {
|
|
1352
1099
|
var id, score, _yield$this$ContractI3, abi, isV3, address, requestId, event;
|
|
1353
|
-
|
|
1354
1100
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1355
|
-
while (1) {
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
if (requestId) {
|
|
1373
|
-
_context13.next = 11;
|
|
1374
|
-
break;
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
throw Error("Unknown request ID for " + id);
|
|
1378
|
-
|
|
1379
|
-
case 11:
|
|
1380
|
-
if (!isV3) {
|
|
1381
|
-
_context13.next = 17;
|
|
1382
|
-
break;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
_context13.next = 14;
|
|
1386
|
-
return this.client.CallContractMethodAndWait({
|
|
1387
|
-
contractAddress: address,
|
|
1388
|
-
abi: abi,
|
|
1389
|
-
methodName: "accessCompleteV3",
|
|
1390
|
-
methodArgs: [requestId, [], []]
|
|
1391
|
-
});
|
|
1392
|
-
|
|
1393
|
-
case 14:
|
|
1394
|
-
event = _context13.sent;
|
|
1395
|
-
_context13.next = 20;
|
|
1101
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1102
|
+
case 0:
|
|
1103
|
+
id = _ref14.id, score = _ref14.score;
|
|
1104
|
+
this.Log("Calling access complete on ".concat(id, " with score ").concat(score));
|
|
1105
|
+
_context13.next = 4;
|
|
1106
|
+
return this.ContractInfo({
|
|
1107
|
+
id: id
|
|
1108
|
+
});
|
|
1109
|
+
case 4:
|
|
1110
|
+
_yield$this$ContractI3 = _context13.sent;
|
|
1111
|
+
abi = _yield$this$ContractI3.abi;
|
|
1112
|
+
isV3 = _yield$this$ContractI3.isV3;
|
|
1113
|
+
address = Utils.HashToAddress(id);
|
|
1114
|
+
requestId = this.requestIds[address];
|
|
1115
|
+
if (requestId) {
|
|
1116
|
+
_context13.next = 11;
|
|
1396
1117
|
break;
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1118
|
+
}
|
|
1119
|
+
throw Error("Unknown request ID for " + id);
|
|
1120
|
+
case 11:
|
|
1121
|
+
if (!isV3) {
|
|
1122
|
+
_context13.next = 17;
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
_context13.next = 14;
|
|
1126
|
+
return this.client.CallContractMethodAndWait({
|
|
1127
|
+
contractAddress: address,
|
|
1128
|
+
abi: abi,
|
|
1129
|
+
methodName: "accessCompleteV3",
|
|
1130
|
+
methodArgs: [requestId, [], []]
|
|
1131
|
+
});
|
|
1132
|
+
case 14:
|
|
1133
|
+
event = _context13.sent;
|
|
1134
|
+
_context13.next = 20;
|
|
1135
|
+
break;
|
|
1136
|
+
case 17:
|
|
1137
|
+
_context13.next = 19;
|
|
1138
|
+
return this.client.CallContractMethodAndWait({
|
|
1139
|
+
contractAddress: address,
|
|
1140
|
+
abi: abi,
|
|
1141
|
+
methodName: isV3 ? "accessCompleteV3" : "accessComplete",
|
|
1142
|
+
methodArgs: [requestId, score, ""]
|
|
1143
|
+
});
|
|
1144
|
+
case 19:
|
|
1145
|
+
event = _context13.sent;
|
|
1146
|
+
case 20:
|
|
1147
|
+
delete this.requestIds[address];
|
|
1148
|
+
delete this.accessTransactions[address];
|
|
1149
|
+
return _context13.abrupt("return", event);
|
|
1150
|
+
case 23:
|
|
1151
|
+
case "end":
|
|
1152
|
+
return _context13.stop();
|
|
1419
1153
|
}
|
|
1420
1154
|
}, _callee13, this);
|
|
1421
1155
|
}));
|
|
1422
|
-
|
|
1423
1156
|
function AccessComplete(_x13) {
|
|
1424
1157
|
return _AccessComplete.apply(this, arguments);
|
|
1425
1158
|
}
|
|
1426
|
-
|
|
1427
1159
|
return AccessComplete;
|
|
1428
|
-
}()
|
|
1429
|
-
/* Utility methods */
|
|
1430
|
-
|
|
1160
|
+
}() /* Utility methods */
|
|
1431
1161
|
}, {
|
|
1432
1162
|
key: "ContractInfo",
|
|
1433
1163
|
value: function () {
|
|
1434
1164
|
var _ContractInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref15) {
|
|
1435
1165
|
var id, address, isV3, version, accessType;
|
|
1436
1166
|
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
1437
|
-
while (1) {
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
_context14.next =
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
case 12:
|
|
1472
|
-
return _context14.abrupt("return", {
|
|
1473
|
-
isV3: isV3,
|
|
1474
|
-
accessType: accessType,
|
|
1475
|
-
abi: this.CONTRACTS[version][accessType].abi
|
|
1476
|
-
});
|
|
1477
|
-
|
|
1478
|
-
case 13:
|
|
1479
|
-
case "end":
|
|
1480
|
-
return _context14.stop();
|
|
1481
|
-
}
|
|
1167
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1168
|
+
case 0:
|
|
1169
|
+
id = _ref15.id, address = _ref15.address;
|
|
1170
|
+
if (!address) {
|
|
1171
|
+
address = Utils.HashToAddress(id);
|
|
1172
|
+
}
|
|
1173
|
+
if (!id) {
|
|
1174
|
+
id = Utils.AddressToObjectId(address);
|
|
1175
|
+
}
|
|
1176
|
+
_context14.next = 5;
|
|
1177
|
+
return this.IsV3({
|
|
1178
|
+
id: id
|
|
1179
|
+
});
|
|
1180
|
+
case 5:
|
|
1181
|
+
isV3 = _context14.sent;
|
|
1182
|
+
version = isV3 ? "v3" : "v2";
|
|
1183
|
+
_context14.next = 9;
|
|
1184
|
+
return this.AccessType(id);
|
|
1185
|
+
case 9:
|
|
1186
|
+
accessType = _context14.sent;
|
|
1187
|
+
if (!(accessType === this.ACCESS_TYPES.OTHER)) {
|
|
1188
|
+
_context14.next = 12;
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
return _context14.abrupt("return", {});
|
|
1192
|
+
case 12:
|
|
1193
|
+
return _context14.abrupt("return", {
|
|
1194
|
+
isV3: isV3,
|
|
1195
|
+
accessType: accessType,
|
|
1196
|
+
abi: this.CONTRACTS[version][accessType].abi
|
|
1197
|
+
});
|
|
1198
|
+
case 13:
|
|
1199
|
+
case "end":
|
|
1200
|
+
return _context14.stop();
|
|
1482
1201
|
}
|
|
1483
1202
|
}, _callee14, this);
|
|
1484
1203
|
}));
|
|
1485
|
-
|
|
1486
1204
|
function ContractInfo(_x14) {
|
|
1487
1205
|
return _ContractInfo.apply(this, arguments);
|
|
1488
1206
|
}
|
|
1489
|
-
|
|
1490
1207
|
return ContractInfo;
|
|
1491
1208
|
}()
|
|
1492
1209
|
}, {
|
|
@@ -1494,44 +1211,36 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1494
1211
|
value: function () {
|
|
1495
1212
|
var _GetAccessCharge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref16) {
|
|
1496
1213
|
var objectId, args, _yield$this$ContractI4, abi, info;
|
|
1497
|
-
|
|
1498
1214
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
1499
|
-
while (1) {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
case 9:
|
|
1524
|
-
case "end":
|
|
1525
|
-
return _context15.stop();
|
|
1526
|
-
}
|
|
1215
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1216
|
+
case 0:
|
|
1217
|
+
objectId = _ref16.objectId, args = _ref16.args;
|
|
1218
|
+
_context15.next = 3;
|
|
1219
|
+
return this.ContractInfo({
|
|
1220
|
+
id: objectId
|
|
1221
|
+
});
|
|
1222
|
+
case 3:
|
|
1223
|
+
_yield$this$ContractI4 = _context15.sent;
|
|
1224
|
+
abi = _yield$this$ContractI4.abi;
|
|
1225
|
+
_context15.next = 7;
|
|
1226
|
+
return this.client.CallContractMethod({
|
|
1227
|
+
contractAddress: Utils.HashToAddress(objectId),
|
|
1228
|
+
abi: abi,
|
|
1229
|
+
methodName: "getAccessInfo",
|
|
1230
|
+
methodArgs: args
|
|
1231
|
+
});
|
|
1232
|
+
case 7:
|
|
1233
|
+
info = _context15.sent;
|
|
1234
|
+
return _context15.abrupt("return", info[1] === 0 ? 0 : info[2]);
|
|
1235
|
+
case 9:
|
|
1236
|
+
case "end":
|
|
1237
|
+
return _context15.stop();
|
|
1527
1238
|
}
|
|
1528
1239
|
}, _callee15, this);
|
|
1529
1240
|
}));
|
|
1530
|
-
|
|
1531
1241
|
function GetAccessCharge(_x15) {
|
|
1532
1242
|
return _GetAccessCharge.apply(this, arguments);
|
|
1533
1243
|
}
|
|
1534
|
-
|
|
1535
1244
|
return GetAccessCharge;
|
|
1536
1245
|
}()
|
|
1537
1246
|
}, {
|
|
@@ -1540,46 +1249,36 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1540
1249
|
var _Owner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref17) {
|
|
1541
1250
|
var id, address, ownerAddress;
|
|
1542
1251
|
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1543
|
-
while (1) {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
case 6:
|
|
1568
|
-
ownerAddress = _context16.sent;
|
|
1569
|
-
return _context16.abrupt("return", Utils.FormatAddress(ownerAddress));
|
|
1570
|
-
|
|
1571
|
-
case 8:
|
|
1572
|
-
case "end":
|
|
1573
|
-
return _context16.stop();
|
|
1574
|
-
}
|
|
1252
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1253
|
+
case 0:
|
|
1254
|
+
id = _ref17.id, address = _ref17.address;
|
|
1255
|
+
if (this.client.signer) {
|
|
1256
|
+
_context16.next = 3;
|
|
1257
|
+
break;
|
|
1258
|
+
}
|
|
1259
|
+
return _context16.abrupt("return", false);
|
|
1260
|
+
case 3:
|
|
1261
|
+
if (id) {
|
|
1262
|
+
address = Utils.HashToAddress(id);
|
|
1263
|
+
}
|
|
1264
|
+
_context16.next = 6;
|
|
1265
|
+
return this.client.CallContractMethod({
|
|
1266
|
+
contractAddress: address,
|
|
1267
|
+
methodName: "owner",
|
|
1268
|
+
methodArgs: []
|
|
1269
|
+
});
|
|
1270
|
+
case 6:
|
|
1271
|
+
ownerAddress = _context16.sent;
|
|
1272
|
+
return _context16.abrupt("return", Utils.FormatAddress(ownerAddress));
|
|
1273
|
+
case 8:
|
|
1274
|
+
case "end":
|
|
1275
|
+
return _context16.stop();
|
|
1575
1276
|
}
|
|
1576
1277
|
}, _callee16, this);
|
|
1577
1278
|
}));
|
|
1578
|
-
|
|
1579
1279
|
function Owner(_x16) {
|
|
1580
1280
|
return _Owner.apply(this, arguments);
|
|
1581
1281
|
}
|
|
1582
|
-
|
|
1583
1282
|
return Owner;
|
|
1584
1283
|
}()
|
|
1585
1284
|
}, {
|
|
@@ -1587,51 +1286,39 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1587
1286
|
value: function () {
|
|
1588
1287
|
var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(message) {
|
|
1589
1288
|
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1590
|
-
while (1) {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
if (!this.client.signer.signDigest) {
|
|
1596
|
-
_context17.next = 7;
|
|
1597
|
-
break;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
_context17.next = 4;
|
|
1601
|
-
return this.client.signer.signDigest(message);
|
|
1602
|
-
|
|
1603
|
-
case 4:
|
|
1604
|
-
_context17.t1 = _context17.sent;
|
|
1605
|
-
_context17.next = 10;
|
|
1289
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1290
|
+
case 0:
|
|
1291
|
+
_context17.t0 = Ethers.utils;
|
|
1292
|
+
if (!this.client.signer.signDigest) {
|
|
1293
|
+
_context17.next = 7;
|
|
1606
1294
|
break;
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1295
|
+
}
|
|
1296
|
+
_context17.next = 4;
|
|
1297
|
+
return this.client.signer.signDigest(message);
|
|
1298
|
+
case 4:
|
|
1299
|
+
_context17.t1 = _context17.sent;
|
|
1300
|
+
_context17.next = 10;
|
|
1301
|
+
break;
|
|
1302
|
+
case 7:
|
|
1303
|
+
_context17.next = 9;
|
|
1304
|
+
return this.client.signer._signingKey().signDigest(message);
|
|
1305
|
+
case 9:
|
|
1306
|
+
_context17.t1 = _context17.sent;
|
|
1307
|
+
case 10:
|
|
1308
|
+
_context17.t2 = _context17.t1;
|
|
1309
|
+
_context17.next = 13;
|
|
1310
|
+
return _context17.t0.joinSignature.call(_context17.t0, _context17.t2);
|
|
1311
|
+
case 13:
|
|
1312
|
+
return _context17.abrupt("return", _context17.sent);
|
|
1313
|
+
case 14:
|
|
1314
|
+
case "end":
|
|
1315
|
+
return _context17.stop();
|
|
1627
1316
|
}
|
|
1628
1317
|
}, _callee17, this);
|
|
1629
1318
|
}));
|
|
1630
|
-
|
|
1631
1319
|
function Sign(_x17) {
|
|
1632
1320
|
return _Sign.apply(this, arguments);
|
|
1633
1321
|
}
|
|
1634
|
-
|
|
1635
1322
|
return Sign;
|
|
1636
1323
|
}()
|
|
1637
1324
|
}, {
|
|
@@ -1639,554 +1326,441 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
1639
1326
|
value: function () {
|
|
1640
1327
|
var _KMSAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref18) {
|
|
1641
1328
|
var objectId, versionHash, _yield$this$ContractI5, abi;
|
|
1642
|
-
|
|
1643
1329
|
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1644
|
-
while (1) {
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
methodName: "addressKMS"
|
|
1675
|
-
});
|
|
1676
|
-
|
|
1677
|
-
case 10:
|
|
1678
|
-
return _context18.abrupt("return", _context18.sent);
|
|
1679
|
-
|
|
1680
|
-
case 11:
|
|
1681
|
-
case "end":
|
|
1682
|
-
return _context18.stop();
|
|
1683
|
-
}
|
|
1330
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1331
|
+
case 0:
|
|
1332
|
+
objectId = _ref18.objectId, versionHash = _ref18.versionHash;
|
|
1333
|
+
if (versionHash) {
|
|
1334
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1335
|
+
}
|
|
1336
|
+
_context18.next = 4;
|
|
1337
|
+
return this.ContractInfo({
|
|
1338
|
+
id: objectId
|
|
1339
|
+
});
|
|
1340
|
+
case 4:
|
|
1341
|
+
_yield$this$ContractI5 = _context18.sent;
|
|
1342
|
+
abi = _yield$this$ContractI5.abi;
|
|
1343
|
+
if (abi) {
|
|
1344
|
+
_context18.next = 8;
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
throw Error("Unable to determine contract info for ".concat(objectId, " - wrong network?"));
|
|
1348
|
+
case 8:
|
|
1349
|
+
_context18.next = 10;
|
|
1350
|
+
return this.client.CallContractMethod({
|
|
1351
|
+
contractAddress: Utils.HashToAddress(objectId),
|
|
1352
|
+
abi: abi,
|
|
1353
|
+
methodName: "addressKMS"
|
|
1354
|
+
});
|
|
1355
|
+
case 10:
|
|
1356
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1357
|
+
case 11:
|
|
1358
|
+
case "end":
|
|
1359
|
+
return _context18.stop();
|
|
1684
1360
|
}
|
|
1685
1361
|
}, _callee18, this);
|
|
1686
1362
|
}));
|
|
1687
|
-
|
|
1688
1363
|
function KMSAddress(_x18) {
|
|
1689
1364
|
return _KMSAddress.apply(this, arguments);
|
|
1690
1365
|
}
|
|
1691
|
-
|
|
1692
1366
|
return KMSAddress;
|
|
1693
|
-
}()
|
|
1694
|
-
}, {
|
|
1695
|
-
key: "KMSInfo",
|
|
1696
|
-
value: function () {
|
|
1697
|
-
var _KMSInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref19) {
|
|
1698
|
-
var objectId, versionHash, kmsId, KMSInfo, _yield$this$ContractI6, abi, _yield$this$ContractI7, _abi, publicKey;
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
case 19:
|
|
1759
|
-
// Public key is compressed and hashed
|
|
1760
|
-
publicKey = Ethers.utils.computePublicKey(Utils.HashToAddress(KMSInfo[1]), false);
|
|
1761
|
-
return _context19.abrupt("return", {
|
|
1762
|
-
urls: KMSInfo[0].split(","),
|
|
1763
|
-
publicKey: publicKey
|
|
1764
|
-
});
|
|
1765
|
-
|
|
1766
|
-
case 21:
|
|
1767
|
-
case "end":
|
|
1768
|
-
return _context19.stop();
|
|
1769
|
-
}
|
|
1367
|
+
}()
|
|
1368
|
+
}, {
|
|
1369
|
+
key: "KMSInfo",
|
|
1370
|
+
value: function () {
|
|
1371
|
+
var _KMSInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref19) {
|
|
1372
|
+
var objectId, versionHash, kmsId, KMSInfo, _yield$this$ContractI6, abi, _yield$this$ContractI7, _abi, publicKey;
|
|
1373
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1374
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1375
|
+
case 0:
|
|
1376
|
+
objectId = _ref19.objectId, versionHash = _ref19.versionHash, kmsId = _ref19.kmsId;
|
|
1377
|
+
if (!kmsId) {
|
|
1378
|
+
_context19.next = 11;
|
|
1379
|
+
break;
|
|
1380
|
+
}
|
|
1381
|
+
_context19.next = 4;
|
|
1382
|
+
return this.ContractInfo({
|
|
1383
|
+
address: this.client.contentSpaceAddress
|
|
1384
|
+
});
|
|
1385
|
+
case 4:
|
|
1386
|
+
_yield$this$ContractI6 = _context19.sent;
|
|
1387
|
+
abi = _yield$this$ContractI6.abi;
|
|
1388
|
+
_context19.next = 8;
|
|
1389
|
+
return this.client.CallContractMethod({
|
|
1390
|
+
contractAddress: this.client.contentSpaceAddress,
|
|
1391
|
+
abi: abi,
|
|
1392
|
+
methodName: "getKMSInfo",
|
|
1393
|
+
methodArgs: [kmsId, []],
|
|
1394
|
+
formatArguments: false
|
|
1395
|
+
});
|
|
1396
|
+
case 8:
|
|
1397
|
+
KMSInfo = _context19.sent;
|
|
1398
|
+
_context19.next = 19;
|
|
1399
|
+
break;
|
|
1400
|
+
case 11:
|
|
1401
|
+
if (versionHash) {
|
|
1402
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1403
|
+
}
|
|
1404
|
+
_context19.next = 14;
|
|
1405
|
+
return this.ContractInfo({
|
|
1406
|
+
id: objectId
|
|
1407
|
+
});
|
|
1408
|
+
case 14:
|
|
1409
|
+
_yield$this$ContractI7 = _context19.sent;
|
|
1410
|
+
_abi = _yield$this$ContractI7.abi;
|
|
1411
|
+
_context19.next = 18;
|
|
1412
|
+
return this.client.CallContractMethod({
|
|
1413
|
+
contractAddress: Utils.HashToAddress(objectId),
|
|
1414
|
+
abi: _abi,
|
|
1415
|
+
methodName: "getKMSInfo",
|
|
1416
|
+
methodArgs: [[]],
|
|
1417
|
+
formatArguments: false
|
|
1418
|
+
});
|
|
1419
|
+
case 18:
|
|
1420
|
+
KMSInfo = _context19.sent;
|
|
1421
|
+
case 19:
|
|
1422
|
+
// Public key is compressed and hashed
|
|
1423
|
+
publicKey = Ethers.utils.computePublicKey(Utils.HashToAddress(KMSInfo[1]), false);
|
|
1424
|
+
return _context19.abrupt("return", {
|
|
1425
|
+
urls: KMSInfo[0].split(","),
|
|
1426
|
+
publicKey: publicKey
|
|
1427
|
+
});
|
|
1428
|
+
case 21:
|
|
1429
|
+
case "end":
|
|
1430
|
+
return _context19.stop();
|
|
1770
1431
|
}
|
|
1771
1432
|
}, _callee19, this);
|
|
1772
1433
|
}));
|
|
1773
|
-
|
|
1774
1434
|
function KMSInfo(_x19) {
|
|
1775
1435
|
return _KMSInfo.apply(this, arguments);
|
|
1776
1436
|
}
|
|
1777
|
-
|
|
1778
1437
|
return KMSInfo;
|
|
1779
1438
|
}() // Retrieve symmetric key for object
|
|
1780
|
-
|
|
1781
1439
|
}, {
|
|
1782
1440
|
key: "RetrieveConk",
|
|
1783
1441
|
value: function () {
|
|
1784
1442
|
var _RetrieveConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref20) {
|
|
1785
1443
|
var libraryId, objectId, kmsAddress, kmsCapId, kmsCap, cap;
|
|
1786
1444
|
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1787
|
-
while (1) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
methodName: "elv_getEncryptionKey",
|
|
1836
|
-
paramTypes: ["string", "string", "string", "string", "string"],
|
|
1837
|
-
params: [this.client.contentSpaceId, libraryId, objectId, kmsCap || "", ""]
|
|
1838
|
-
});
|
|
1839
|
-
|
|
1840
|
-
case 16:
|
|
1841
|
-
cap = _context20.sent;
|
|
1842
|
-
return _context20.abrupt("return", JSON.parse(Utils.FromB58(cap.replace(/^kp__/, "")).toString("utf-8")));
|
|
1843
|
-
|
|
1844
|
-
case 18:
|
|
1845
|
-
case "end":
|
|
1846
|
-
return _context20.stop();
|
|
1847
|
-
}
|
|
1445
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1446
|
+
case 0:
|
|
1447
|
+
libraryId = _ref20.libraryId, objectId = _ref20.objectId;
|
|
1448
|
+
if (libraryId) {
|
|
1449
|
+
_context20.next = 5;
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
_context20.next = 4;
|
|
1453
|
+
return this.client.ContentObjectLibraryId({
|
|
1454
|
+
objectId: objectId
|
|
1455
|
+
});
|
|
1456
|
+
case 4:
|
|
1457
|
+
libraryId = _context20.sent;
|
|
1458
|
+
case 5:
|
|
1459
|
+
_context20.next = 7;
|
|
1460
|
+
return this.KMSAddress({
|
|
1461
|
+
objectId: objectId
|
|
1462
|
+
});
|
|
1463
|
+
case 7:
|
|
1464
|
+
kmsAddress = _context20.sent;
|
|
1465
|
+
kmsCapId = "eluv.caps.ikms".concat(Utils.AddressToHash(kmsAddress));
|
|
1466
|
+
_context20.next = 11;
|
|
1467
|
+
return this.client.ContentObjectMetadata({
|
|
1468
|
+
libraryId: libraryId,
|
|
1469
|
+
objectId: objectId,
|
|
1470
|
+
metadataSubtree: kmsCapId
|
|
1471
|
+
});
|
|
1472
|
+
case 11:
|
|
1473
|
+
kmsCap = _context20.sent;
|
|
1474
|
+
if (kmsCap) {
|
|
1475
|
+
_context20.next = 14;
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
throw Error("No KMS key set for this object");
|
|
1479
|
+
case 14:
|
|
1480
|
+
_context20.next = 16;
|
|
1481
|
+
return this.MakeKMSCall({
|
|
1482
|
+
objectId: objectId,
|
|
1483
|
+
methodName: "elv_getEncryptionKey",
|
|
1484
|
+
paramTypes: ["string", "string", "string", "string", "string"],
|
|
1485
|
+
params: [this.client.contentSpaceId, libraryId, objectId, kmsCap || "", ""]
|
|
1486
|
+
});
|
|
1487
|
+
case 16:
|
|
1488
|
+
cap = _context20.sent;
|
|
1489
|
+
return _context20.abrupt("return", JSON.parse(Utils.FromB58(cap.replace(/^kp__/, "")).toString("utf-8")));
|
|
1490
|
+
case 18:
|
|
1491
|
+
case "end":
|
|
1492
|
+
return _context20.stop();
|
|
1848
1493
|
}
|
|
1849
1494
|
}, _callee20, this);
|
|
1850
1495
|
}));
|
|
1851
|
-
|
|
1852
1496
|
function RetrieveConk(_x20) {
|
|
1853
1497
|
return _RetrieveConk.apply(this, arguments);
|
|
1854
1498
|
}
|
|
1855
|
-
|
|
1856
1499
|
return RetrieveConk;
|
|
1857
1500
|
}() // Retrieve symmetric key for object
|
|
1858
|
-
|
|
1859
1501
|
}, {
|
|
1860
1502
|
key: "RetrieveReencryptionSymmetricKey",
|
|
1861
1503
|
value: function () {
|
|
1862
1504
|
var _RetrieveReencryptionSymmetricKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref21) {
|
|
1863
1505
|
var libraryId, objectId, kmsAddress, kmsCapId, kmsCap;
|
|
1864
1506
|
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1865
|
-
while (1) {
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
objectId: objectId,
|
|
1913
|
-
methodName: "elv_getSymmetricKeyAuth",
|
|
1914
|
-
paramTypes: ["string", "string", "string", "string", "string"],
|
|
1915
|
-
params: [this.client.contentSpaceId, libraryId, objectId, kmsCap || "", ""]
|
|
1916
|
-
});
|
|
1917
|
-
|
|
1918
|
-
case 16:
|
|
1919
|
-
return _context21.abrupt("return", _context21.sent);
|
|
1920
|
-
|
|
1921
|
-
case 17:
|
|
1922
|
-
case "end":
|
|
1923
|
-
return _context21.stop();
|
|
1924
|
-
}
|
|
1507
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1508
|
+
case 0:
|
|
1509
|
+
libraryId = _ref21.libraryId, objectId = _ref21.objectId;
|
|
1510
|
+
if (libraryId) {
|
|
1511
|
+
_context21.next = 5;
|
|
1512
|
+
break;
|
|
1513
|
+
}
|
|
1514
|
+
_context21.next = 4;
|
|
1515
|
+
return this.client.ContentObjectLibraryId({
|
|
1516
|
+
objectId: objectId
|
|
1517
|
+
});
|
|
1518
|
+
case 4:
|
|
1519
|
+
libraryId = _context21.sent;
|
|
1520
|
+
case 5:
|
|
1521
|
+
_context21.next = 7;
|
|
1522
|
+
return this.KMSAddress({
|
|
1523
|
+
objectId: objectId
|
|
1524
|
+
});
|
|
1525
|
+
case 7:
|
|
1526
|
+
kmsAddress = _context21.sent;
|
|
1527
|
+
kmsCapId = "eluv.caps.ikms".concat(Utils.AddressToHash(kmsAddress));
|
|
1528
|
+
_context21.next = 11;
|
|
1529
|
+
return this.client.ContentObjectMetadata({
|
|
1530
|
+
libraryId: libraryId,
|
|
1531
|
+
objectId: objectId,
|
|
1532
|
+
metadataSubtree: kmsCapId
|
|
1533
|
+
});
|
|
1534
|
+
case 11:
|
|
1535
|
+
kmsCap = _context21.sent;
|
|
1536
|
+
if (kmsCap) {
|
|
1537
|
+
_context21.next = 14;
|
|
1538
|
+
break;
|
|
1539
|
+
}
|
|
1540
|
+
throw Error("No KMS key set for this object");
|
|
1541
|
+
case 14:
|
|
1542
|
+
_context21.next = 16;
|
|
1543
|
+
return this.MakeKMSCall({
|
|
1544
|
+
objectId: objectId,
|
|
1545
|
+
methodName: "elv_getSymmetricKeyAuth",
|
|
1546
|
+
paramTypes: ["string", "string", "string", "string", "string"],
|
|
1547
|
+
params: [this.client.contentSpaceId, libraryId, objectId, kmsCap || "", ""]
|
|
1548
|
+
});
|
|
1549
|
+
case 16:
|
|
1550
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1551
|
+
case 17:
|
|
1552
|
+
case "end":
|
|
1553
|
+
return _context21.stop();
|
|
1925
1554
|
}
|
|
1926
1555
|
}, _callee21, this);
|
|
1927
1556
|
}));
|
|
1928
|
-
|
|
1929
1557
|
function RetrieveReencryptionSymmetricKey(_x21) {
|
|
1930
1558
|
return _RetrieveReencryptionSymmetricKey.apply(this, arguments);
|
|
1931
1559
|
}
|
|
1932
|
-
|
|
1933
1560
|
return RetrieveReencryptionSymmetricKey;
|
|
1934
1561
|
}() // Make an RPC call to the KMS with signed parameters
|
|
1935
|
-
|
|
1936
1562
|
}, {
|
|
1937
1563
|
key: "MakeKMSCall",
|
|
1938
1564
|
value: function () {
|
|
1939
1565
|
var _MakeKMSCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref22) {
|
|
1940
1566
|
var kmsId, tenantId, objectId, versionHash, methodName, params, paramTypes, _ref22$additionalPara, additionalParams, _ref22$signature, signature, packedHash, KMSUrls, i, kmsUrl;
|
|
1941
|
-
|
|
1942
1567
|
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1943
|
-
while (1) {
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
if (objectId) {
|
|
1953
|
-
_context22.next = 10;
|
|
1954
|
-
break;
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
_context22.t0 = "ikms";
|
|
1958
|
-
_context22.t1 = Utils;
|
|
1959
|
-
_context22.next = 7;
|
|
1960
|
-
return this.client.DefaultKMSAddress({
|
|
1961
|
-
tenantId: tenantId
|
|
1962
|
-
});
|
|
1963
|
-
|
|
1964
|
-
case 7:
|
|
1965
|
-
_context22.t2 = _context22.sent;
|
|
1966
|
-
_context22.t3 = _context22.t1.AddressToHash.call(_context22.t1, _context22.t2);
|
|
1967
|
-
kmsId = _context22.t0.concat.call(_context22.t0, _context22.t3);
|
|
1968
|
-
|
|
1969
|
-
case 10:
|
|
1970
|
-
if (!signature) {
|
|
1971
|
-
_context22.next = 17;
|
|
1972
|
-
break;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
packedHash = Ethers.utils.solidityKeccak256(paramTypes, params);
|
|
1976
|
-
_context22.t4 = params;
|
|
1977
|
-
_context22.next = 15;
|
|
1978
|
-
return this.Sign(packedHash);
|
|
1979
|
-
|
|
1980
|
-
case 15:
|
|
1981
|
-
_context22.t5 = _context22.sent;
|
|
1982
|
-
|
|
1983
|
-
_context22.t4.push.call(_context22.t4, _context22.t5);
|
|
1984
|
-
|
|
1985
|
-
case 17:
|
|
1986
|
-
params = params.concat(additionalParams);
|
|
1987
|
-
_context22.next = 20;
|
|
1988
|
-
return this.KMSInfo({
|
|
1989
|
-
kmsId: kmsId,
|
|
1990
|
-
objectId: objectId,
|
|
1991
|
-
versionHash: versionHash
|
|
1992
|
-
});
|
|
1993
|
-
|
|
1994
|
-
case 20:
|
|
1995
|
-
KMSUrls = _context22.sent.urls;
|
|
1996
|
-
i = 0;
|
|
1997
|
-
|
|
1998
|
-
case 22:
|
|
1999
|
-
if (!(i < KMSUrls.length)) {
|
|
2000
|
-
_context22.next = 40;
|
|
2001
|
-
break;
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
_context22.prev = 23;
|
|
2005
|
-
this.Log("Making KMS request:\n URL: ".concat(KMSUrls[i], "\n Method: ").concat(methodName, "\n Params: ").concat(params.join(", ")));
|
|
2006
|
-
kmsUrl = KMSUrls[i];
|
|
2007
|
-
|
|
2008
|
-
if (!this.providers[kmsUrl]) {
|
|
2009
|
-
this.providers[kmsUrl] = new Ethers.providers.JsonRpcProvider(kmsUrl, this.client.networkId);
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
_context22.next = 29;
|
|
2013
|
-
return this.providers[kmsUrl].send(methodName, params);
|
|
2014
|
-
|
|
2015
|
-
case 29:
|
|
2016
|
-
return _context22.abrupt("return", _context22.sent);
|
|
2017
|
-
|
|
2018
|
-
case 32:
|
|
2019
|
-
_context22.prev = 32;
|
|
2020
|
-
_context22.t6 = _context22["catch"](23);
|
|
2021
|
-
this.Log("KMS Call Error: ".concat(_context22.t6), true); // If the request has been attempted on all KMS urls, throw the error
|
|
2022
|
-
|
|
2023
|
-
if (!(i === KMSUrls.length - 1)) {
|
|
2024
|
-
_context22.next = 37;
|
|
2025
|
-
break;
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
throw _context22.t6;
|
|
2029
|
-
|
|
2030
|
-
case 37:
|
|
2031
|
-
i++;
|
|
2032
|
-
_context22.next = 22;
|
|
1568
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1569
|
+
case 0:
|
|
1570
|
+
kmsId = _ref22.kmsId, tenantId = _ref22.tenantId, objectId = _ref22.objectId, versionHash = _ref22.versionHash, methodName = _ref22.methodName, params = _ref22.params, paramTypes = _ref22.paramTypes, _ref22$additionalPara = _ref22.additionalParams, additionalParams = _ref22$additionalPara === void 0 ? [] : _ref22$additionalPara, _ref22$signature = _ref22.signature, signature = _ref22$signature === void 0 ? true : _ref22$signature;
|
|
1571
|
+
if (versionHash) {
|
|
1572
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1573
|
+
}
|
|
1574
|
+
if (objectId) {
|
|
1575
|
+
_context22.next = 10;
|
|
2033
1576
|
break;
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
1577
|
+
}
|
|
1578
|
+
_context22.t0 = "ikms";
|
|
1579
|
+
_context22.t1 = Utils;
|
|
1580
|
+
_context22.next = 7;
|
|
1581
|
+
return this.client.DefaultKMSAddress({
|
|
1582
|
+
tenantId: tenantId
|
|
1583
|
+
});
|
|
1584
|
+
case 7:
|
|
1585
|
+
_context22.t2 = _context22.sent;
|
|
1586
|
+
_context22.t3 = _context22.t1.AddressToHash.call(_context22.t1, _context22.t2);
|
|
1587
|
+
kmsId = _context22.t0.concat.call(_context22.t0, _context22.t3);
|
|
1588
|
+
case 10:
|
|
1589
|
+
if (!signature) {
|
|
1590
|
+
_context22.next = 17;
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
packedHash = Ethers.utils.solidityKeccak256(paramTypes, params);
|
|
1594
|
+
_context22.t4 = params;
|
|
1595
|
+
_context22.next = 15;
|
|
1596
|
+
return this.Sign(packedHash);
|
|
1597
|
+
case 15:
|
|
1598
|
+
_context22.t5 = _context22.sent;
|
|
1599
|
+
_context22.t4.push.call(_context22.t4, _context22.t5);
|
|
1600
|
+
case 17:
|
|
1601
|
+
params = params.concat(additionalParams);
|
|
1602
|
+
_context22.next = 20;
|
|
1603
|
+
return this.KMSInfo({
|
|
1604
|
+
kmsId: kmsId,
|
|
1605
|
+
objectId: objectId,
|
|
1606
|
+
versionHash: versionHash
|
|
1607
|
+
});
|
|
1608
|
+
case 20:
|
|
1609
|
+
KMSUrls = _context22.sent.urls;
|
|
1610
|
+
i = 0;
|
|
1611
|
+
case 22:
|
|
1612
|
+
if (!(i < KMSUrls.length)) {
|
|
1613
|
+
_context22.next = 40;
|
|
1614
|
+
break;
|
|
1615
|
+
}
|
|
1616
|
+
_context22.prev = 23;
|
|
1617
|
+
this.Log("Making KMS request:\n URL: ".concat(KMSUrls[i], "\n Method: ").concat(methodName, "\n Params: ").concat(params.join(", ")));
|
|
1618
|
+
kmsUrl = KMSUrls[i];
|
|
1619
|
+
if (!this.providers[kmsUrl]) {
|
|
1620
|
+
this.providers[kmsUrl] = new Ethers.providers.JsonRpcProvider(kmsUrl, this.client.networkId);
|
|
1621
|
+
}
|
|
1622
|
+
_context22.next = 29;
|
|
1623
|
+
return this.providers[kmsUrl].send(methodName, params);
|
|
1624
|
+
case 29:
|
|
1625
|
+
return _context22.abrupt("return", _context22.sent);
|
|
1626
|
+
case 32:
|
|
1627
|
+
_context22.prev = 32;
|
|
1628
|
+
_context22.t6 = _context22["catch"](23);
|
|
1629
|
+
this.Log("KMS Call Error: ".concat(_context22.t6), true);
|
|
1630
|
+
|
|
1631
|
+
// If the request has been attempted on all KMS urls, throw the error
|
|
1632
|
+
if (!(i === KMSUrls.length - 1)) {
|
|
1633
|
+
_context22.next = 37;
|
|
1634
|
+
break;
|
|
1635
|
+
}
|
|
1636
|
+
throw _context22.t6;
|
|
1637
|
+
case 37:
|
|
1638
|
+
i++;
|
|
1639
|
+
_context22.next = 22;
|
|
1640
|
+
break;
|
|
1641
|
+
case 40:
|
|
1642
|
+
case "end":
|
|
1643
|
+
return _context22.stop();
|
|
2039
1644
|
}
|
|
2040
1645
|
}, _callee22, this, [[23, 32]]);
|
|
2041
1646
|
}));
|
|
2042
|
-
|
|
2043
1647
|
function MakeKMSCall(_x22) {
|
|
2044
1648
|
return _MakeKMSCall.apply(this, arguments);
|
|
2045
1649
|
}
|
|
2046
|
-
|
|
2047
1650
|
return MakeKMSCall;
|
|
2048
1651
|
}() // Make an arbitrary HTTP call to an authority server
|
|
2049
|
-
|
|
2050
1652
|
}, {
|
|
2051
1653
|
key: "MakeAuthServiceRequest",
|
|
2052
1654
|
value: function () {
|
|
2053
1655
|
var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref23) {
|
|
2054
1656
|
var kmsId, objectId, versionHash, _ref23$method, method, path, bodyType, _ref23$body, body, _ref23$queryParams, queryParams, headers;
|
|
2055
|
-
|
|
2056
1657
|
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
2057
|
-
while (1) {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
case 7:
|
|
2095
|
-
return _context23.abrupt("return", _context23.sent);
|
|
2096
|
-
|
|
2097
|
-
case 8:
|
|
2098
|
-
case "end":
|
|
2099
|
-
return _context23.stop();
|
|
2100
|
-
}
|
|
1658
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1659
|
+
case 0:
|
|
1660
|
+
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;
|
|
1661
|
+
if (!(this.client.authServiceURIs.length === 0)) {
|
|
1662
|
+
_context23.next = 5;
|
|
1663
|
+
break;
|
|
1664
|
+
}
|
|
1665
|
+
_context23.next = 4;
|
|
1666
|
+
return this.MakeKMSRequest({
|
|
1667
|
+
kmsId: kmsId,
|
|
1668
|
+
objectId: objectId,
|
|
1669
|
+
versionHash: versionHash,
|
|
1670
|
+
method: method,
|
|
1671
|
+
path: path,
|
|
1672
|
+
bodyType: bodyType,
|
|
1673
|
+
body: body,
|
|
1674
|
+
queryParams: queryParams,
|
|
1675
|
+
headers: headers
|
|
1676
|
+
});
|
|
1677
|
+
case 4:
|
|
1678
|
+
return _context23.abrupt("return", _context23.sent);
|
|
1679
|
+
case 5:
|
|
1680
|
+
_context23.next = 7;
|
|
1681
|
+
return this.client.AuthHttpClient.Request({
|
|
1682
|
+
method: method,
|
|
1683
|
+
path: path,
|
|
1684
|
+
bodyType: bodyType,
|
|
1685
|
+
body: body,
|
|
1686
|
+
headers: headers,
|
|
1687
|
+
queryParams: queryParams
|
|
1688
|
+
});
|
|
1689
|
+
case 7:
|
|
1690
|
+
return _context23.abrupt("return", _context23.sent);
|
|
1691
|
+
case 8:
|
|
1692
|
+
case "end":
|
|
1693
|
+
return _context23.stop();
|
|
2101
1694
|
}
|
|
2102
1695
|
}, _callee23, this);
|
|
2103
1696
|
}));
|
|
2104
|
-
|
|
2105
1697
|
function MakeAuthServiceRequest(_x23) {
|
|
2106
1698
|
return _MakeAuthServiceRequest.apply(this, arguments);
|
|
2107
1699
|
}
|
|
2108
|
-
|
|
2109
1700
|
return MakeAuthServiceRequest;
|
|
2110
1701
|
}() // Make an arbitrary HTTP call to the KMS
|
|
2111
|
-
|
|
2112
1702
|
}, {
|
|
2113
1703
|
key: "MakeKMSRequest",
|
|
2114
1704
|
value: function () {
|
|
2115
1705
|
var _MakeKMSRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref24) {
|
|
2116
1706
|
var kmsId, objectId, versionHash, _ref24$method, method, path, bodyType, _ref24$body, body, _ref24$queryParams, queryParams, headers, kmsUrls, kmsHttpClient;
|
|
2117
|
-
|
|
2118
1707
|
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
2119
|
-
while (1) {
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
bodyType: bodyType,
|
|
2170
|
-
body: body,
|
|
2171
|
-
headers: headers,
|
|
2172
|
-
queryParams: queryParams
|
|
2173
|
-
});
|
|
2174
|
-
|
|
2175
|
-
case 18:
|
|
2176
|
-
return _context24.abrupt("return", _context24.sent);
|
|
2177
|
-
|
|
2178
|
-
case 19:
|
|
2179
|
-
case "end":
|
|
2180
|
-
return _context24.stop();
|
|
2181
|
-
}
|
|
1708
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1709
|
+
case 0:
|
|
1710
|
+
kmsId = _ref24.kmsId, objectId = _ref24.objectId, versionHash = _ref24.versionHash, _ref24$method = _ref24.method, method = _ref24$method === void 0 ? "GET" : _ref24$method, path = _ref24.path, bodyType = _ref24.bodyType, _ref24$body = _ref24.body, body = _ref24$body === void 0 ? {} : _ref24$body, _ref24$queryParams = _ref24.queryParams, queryParams = _ref24$queryParams === void 0 ? {} : _ref24$queryParams, headers = _ref24.headers;
|
|
1711
|
+
if (versionHash) {
|
|
1712
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1713
|
+
}
|
|
1714
|
+
if (!(!objectId && !kmsId)) {
|
|
1715
|
+
_context24.next = 10;
|
|
1716
|
+
break;
|
|
1717
|
+
}
|
|
1718
|
+
_context24.t0 = "ikms";
|
|
1719
|
+
_context24.t1 = Utils;
|
|
1720
|
+
_context24.next = 7;
|
|
1721
|
+
return this.client.DefaultKMSAddress();
|
|
1722
|
+
case 7:
|
|
1723
|
+
_context24.t2 = _context24.sent;
|
|
1724
|
+
_context24.t3 = _context24.t1.AddressToHash.call(_context24.t1, _context24.t2);
|
|
1725
|
+
kmsId = _context24.t0.concat.call(_context24.t0, _context24.t3);
|
|
1726
|
+
case 10:
|
|
1727
|
+
_context24.next = 12;
|
|
1728
|
+
return this.KMSInfo({
|
|
1729
|
+
kmsId: kmsId,
|
|
1730
|
+
objectId: objectId,
|
|
1731
|
+
versionHash: versionHash
|
|
1732
|
+
});
|
|
1733
|
+
case 12:
|
|
1734
|
+
kmsUrls = _context24.sent.urls;
|
|
1735
|
+
if (!(!kmsUrls || !kmsUrls[0])) {
|
|
1736
|
+
_context24.next = 15;
|
|
1737
|
+
break;
|
|
1738
|
+
}
|
|
1739
|
+
throw Error("No KMS info set for ".concat(versionHash || objectId || "default KMS"));
|
|
1740
|
+
case 15:
|
|
1741
|
+
kmsHttpClient = new HttpClient({
|
|
1742
|
+
uris: kmsUrls
|
|
1743
|
+
});
|
|
1744
|
+
_context24.next = 18;
|
|
1745
|
+
return kmsHttpClient.Request({
|
|
1746
|
+
method: method,
|
|
1747
|
+
path: path,
|
|
1748
|
+
bodyType: bodyType,
|
|
1749
|
+
body: body,
|
|
1750
|
+
headers: headers,
|
|
1751
|
+
queryParams: queryParams
|
|
1752
|
+
});
|
|
1753
|
+
case 18:
|
|
1754
|
+
return _context24.abrupt("return", _context24.sent);
|
|
1755
|
+
case 19:
|
|
1756
|
+
case "end":
|
|
1757
|
+
return _context24.stop();
|
|
2182
1758
|
}
|
|
2183
1759
|
}, _callee24, this);
|
|
2184
1760
|
}));
|
|
2185
|
-
|
|
2186
1761
|
function MakeKMSRequest(_x24) {
|
|
2187
1762
|
return _MakeKMSRequest.apply(this, arguments);
|
|
2188
1763
|
}
|
|
2189
|
-
|
|
2190
1764
|
return MakeKMSRequest;
|
|
2191
1765
|
}()
|
|
2192
1766
|
}, {
|
|
@@ -2195,82 +1769,64 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2195
1769
|
var _ContractHasMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref25) {
|
|
2196
1770
|
var contractAddress, abi, methodName, key, method, methodSignature, methodId;
|
|
2197
1771
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
2198
|
-
while (1) {
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
_context25.next = 18;
|
|
2251
|
-
return this.MakeElvMasterCall({
|
|
2252
|
-
methodName: "elv_deployedContractHasMethod",
|
|
2253
|
-
params: [contractAddress, methodId]
|
|
2254
|
-
});
|
|
2255
|
-
|
|
2256
|
-
case 18:
|
|
2257
|
-
this.methodAvailability[key] = _context25.sent;
|
|
2258
|
-
|
|
2259
|
-
case 19:
|
|
2260
|
-
return _context25.abrupt("return", this.methodAvailability[key]);
|
|
2261
|
-
|
|
2262
|
-
case 20:
|
|
2263
|
-
case "end":
|
|
2264
|
-
return _context25.stop();
|
|
2265
|
-
}
|
|
1772
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1773
|
+
case 0:
|
|
1774
|
+
contractAddress = _ref25.contractAddress, abi = _ref25.abi, methodName = _ref25.methodName;
|
|
1775
|
+
contractAddress = Utils.FormatAddress(contractAddress);
|
|
1776
|
+
key = "".concat(contractAddress, "-").concat(methodName);
|
|
1777
|
+
if (!(this.methodAvailability[key] === undefined)) {
|
|
1778
|
+
_context25.next = 19;
|
|
1779
|
+
break;
|
|
1780
|
+
}
|
|
1781
|
+
this.Log("Checking method availability: ".concat(contractAddress, " ").concat(methodName));
|
|
1782
|
+
if (abi) {
|
|
1783
|
+
_context25.next = 9;
|
|
1784
|
+
break;
|
|
1785
|
+
}
|
|
1786
|
+
_context25.next = 8;
|
|
1787
|
+
return this.ContractInfo({
|
|
1788
|
+
address: contractAddress
|
|
1789
|
+
});
|
|
1790
|
+
case 8:
|
|
1791
|
+
abi = _context25.sent.abi;
|
|
1792
|
+
case 9:
|
|
1793
|
+
if (abi) {
|
|
1794
|
+
_context25.next = 11;
|
|
1795
|
+
break;
|
|
1796
|
+
}
|
|
1797
|
+
throw Error("No ABI for contract ".concat(contractAddress, " - Wrong network or deleted item?"));
|
|
1798
|
+
case 11:
|
|
1799
|
+
method = abi.find(function (method) {
|
|
1800
|
+
return method.name === methodName;
|
|
1801
|
+
});
|
|
1802
|
+
if (method) {
|
|
1803
|
+
_context25.next = 14;
|
|
1804
|
+
break;
|
|
1805
|
+
}
|
|
1806
|
+
return _context25.abrupt("return", false);
|
|
1807
|
+
case 14:
|
|
1808
|
+
methodSignature = "".concat(method.name, "(").concat(method.inputs.map(function (i) {
|
|
1809
|
+
return i.type;
|
|
1810
|
+
}).join(","), ")");
|
|
1811
|
+
methodId = Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(methodSignature)).replace("0x", "").slice(0, 8);
|
|
1812
|
+
_context25.next = 18;
|
|
1813
|
+
return this.MakeElvMasterCall({
|
|
1814
|
+
methodName: "elv_deployedContractHasMethod",
|
|
1815
|
+
params: [contractAddress, methodId]
|
|
1816
|
+
});
|
|
1817
|
+
case 18:
|
|
1818
|
+
this.methodAvailability[key] = _context25.sent;
|
|
1819
|
+
case 19:
|
|
1820
|
+
return _context25.abrupt("return", this.methodAvailability[key]);
|
|
1821
|
+
case 20:
|
|
1822
|
+
case "end":
|
|
1823
|
+
return _context25.stop();
|
|
2266
1824
|
}
|
|
2267
1825
|
}, _callee25, this);
|
|
2268
1826
|
}));
|
|
2269
|
-
|
|
2270
1827
|
function ContractHasMethod(_x25) {
|
|
2271
1828
|
return _ContractHasMethod.apply(this, arguments);
|
|
2272
1829
|
}
|
|
2273
|
-
|
|
2274
1830
|
return ContractHasMethod;
|
|
2275
1831
|
}()
|
|
2276
1832
|
}, {
|
|
@@ -2279,31 +1835,25 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2279
1835
|
var _MakeElvMasterCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref26) {
|
|
2280
1836
|
var methodName, params;
|
|
2281
1837
|
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
2282
|
-
while (1) {
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
case 4:
|
|
2296
|
-
case "end":
|
|
2297
|
-
return _context26.stop();
|
|
2298
|
-
}
|
|
1838
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1839
|
+
case 0:
|
|
1840
|
+
methodName = _ref26.methodName, params = _ref26.params;
|
|
1841
|
+
_context26.next = 3;
|
|
1842
|
+
return this.client.ethClient.MakeProviderCall({
|
|
1843
|
+
methodName: "send",
|
|
1844
|
+
args: [methodName, params]
|
|
1845
|
+
});
|
|
1846
|
+
case 3:
|
|
1847
|
+
return _context26.abrupt("return", _context26.sent);
|
|
1848
|
+
case 4:
|
|
1849
|
+
case "end":
|
|
1850
|
+
return _context26.stop();
|
|
2299
1851
|
}
|
|
2300
1852
|
}, _callee26, this);
|
|
2301
1853
|
}));
|
|
2302
|
-
|
|
2303
1854
|
function MakeElvMasterCall(_x26) {
|
|
2304
1855
|
return _MakeElvMasterCall.apply(this, arguments);
|
|
2305
1856
|
}
|
|
2306
|
-
|
|
2307
1857
|
return MakeElvMasterCall;
|
|
2308
1858
|
}()
|
|
2309
1859
|
}, {
|
|
@@ -2312,50 +1862,39 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2312
1862
|
var _ReEncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref27) {
|
|
2313
1863
|
var libraryId, objectId, versionHash, cap;
|
|
2314
1864
|
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
2315
|
-
while (1) {
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
this.reencryptionKeys[objectId] = cap;
|
|
2343
|
-
|
|
2344
|
-
case 10:
|
|
2345
|
-
return _context27.abrupt("return", this.reencryptionKeys[objectId]);
|
|
2346
|
-
|
|
2347
|
-
case 11:
|
|
2348
|
-
case "end":
|
|
2349
|
-
return _context27.stop();
|
|
2350
|
-
}
|
|
1865
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1866
|
+
case 0:
|
|
1867
|
+
libraryId = _ref27.libraryId, objectId = _ref27.objectId, versionHash = _ref27.versionHash;
|
|
1868
|
+
if (versionHash) {
|
|
1869
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1870
|
+
}
|
|
1871
|
+
if (this.reencryptionKeys[objectId]) {
|
|
1872
|
+
_context27.next = 10;
|
|
1873
|
+
break;
|
|
1874
|
+
}
|
|
1875
|
+
_context27.next = 5;
|
|
1876
|
+
return this.client.Crypto.GenerateTargetConk();
|
|
1877
|
+
case 5:
|
|
1878
|
+
cap = _context27.sent;
|
|
1879
|
+
_context27.next = 8;
|
|
1880
|
+
return this.RetrieveReencryptionSymmetricKey({
|
|
1881
|
+
libraryId: libraryId,
|
|
1882
|
+
objectId: objectId
|
|
1883
|
+
});
|
|
1884
|
+
case 8:
|
|
1885
|
+
cap.symm_key = _context27.sent;
|
|
1886
|
+
this.reencryptionKeys[objectId] = cap;
|
|
1887
|
+
case 10:
|
|
1888
|
+
return _context27.abrupt("return", this.reencryptionKeys[objectId]);
|
|
1889
|
+
case 11:
|
|
1890
|
+
case "end":
|
|
1891
|
+
return _context27.stop();
|
|
2351
1892
|
}
|
|
2352
1893
|
}, _callee27, this);
|
|
2353
1894
|
}));
|
|
2354
|
-
|
|
2355
1895
|
function ReEncryptionConk(_x27) {
|
|
2356
1896
|
return _ReEncryptionConk.apply(this, arguments);
|
|
2357
1897
|
}
|
|
2358
|
-
|
|
2359
1898
|
return ReEncryptionConk;
|
|
2360
1899
|
}()
|
|
2361
1900
|
}, {
|
|
@@ -2363,71 +1902,57 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2363
1902
|
value: function () {
|
|
2364
1903
|
var _EncryptionConk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref28) {
|
|
2365
1904
|
var libraryId, objectId, versionHash, conk, _yield$this$client$Cr, secret_key;
|
|
2366
|
-
|
|
2367
1905
|
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
2368
|
-
while (1) {
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
conk.secret_key = secret_key; // { secret_key, public_key, symm_key, block_size }
|
|
2413
|
-
|
|
2414
|
-
this.encryptionKeys[objectId] = conk;
|
|
2415
|
-
|
|
2416
|
-
case 16:
|
|
2417
|
-
return _context28.abrupt("return", this.encryptionKeys[objectId]);
|
|
2418
|
-
|
|
2419
|
-
case 17:
|
|
2420
|
-
case "end":
|
|
2421
|
-
return _context28.stop();
|
|
2422
|
-
}
|
|
1906
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1907
|
+
case 0:
|
|
1908
|
+
libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash;
|
|
1909
|
+
if (versionHash) {
|
|
1910
|
+
objectId = Utils.DecodeVersionHash(versionHash).objectId;
|
|
1911
|
+
}
|
|
1912
|
+
if (libraryId) {
|
|
1913
|
+
_context28.next = 6;
|
|
1914
|
+
break;
|
|
1915
|
+
}
|
|
1916
|
+
_context28.next = 5;
|
|
1917
|
+
return this.client.ContentObjectLibraryId({
|
|
1918
|
+
objectId: objectId
|
|
1919
|
+
});
|
|
1920
|
+
case 5:
|
|
1921
|
+
libraryId = _context28.sent;
|
|
1922
|
+
case 6:
|
|
1923
|
+
if (this.encryptionKeys[objectId]) {
|
|
1924
|
+
_context28.next = 16;
|
|
1925
|
+
break;
|
|
1926
|
+
}
|
|
1927
|
+
_context28.next = 9;
|
|
1928
|
+
return this.RetrieveConk({
|
|
1929
|
+
libraryId: libraryId,
|
|
1930
|
+
objectId: objectId
|
|
1931
|
+
});
|
|
1932
|
+
case 9:
|
|
1933
|
+
conk = _context28.sent;
|
|
1934
|
+
_context28.next = 12;
|
|
1935
|
+
return this.client.Crypto.GeneratePrimaryConk({
|
|
1936
|
+
objectId: objectId
|
|
1937
|
+
});
|
|
1938
|
+
case 12:
|
|
1939
|
+
_yield$this$client$Cr = _context28.sent;
|
|
1940
|
+
secret_key = _yield$this$client$Cr.secret_key;
|
|
1941
|
+
conk.secret_key = secret_key;
|
|
1942
|
+
|
|
1943
|
+
// { secret_key, public_key, symm_key, block_size }
|
|
1944
|
+
this.encryptionKeys[objectId] = conk;
|
|
1945
|
+
case 16:
|
|
1946
|
+
return _context28.abrupt("return", this.encryptionKeys[objectId]);
|
|
1947
|
+
case 17:
|
|
1948
|
+
case "end":
|
|
1949
|
+
return _context28.stop();
|
|
2423
1950
|
}
|
|
2424
1951
|
}, _callee28, this);
|
|
2425
1952
|
}));
|
|
2426
|
-
|
|
2427
1953
|
function EncryptionConk(_x28) {
|
|
2428
1954
|
return _EncryptionConk.apply(this, arguments);
|
|
2429
1955
|
}
|
|
2430
|
-
|
|
2431
1956
|
return EncryptionConk;
|
|
2432
1957
|
}()
|
|
2433
1958
|
}, {
|
|
@@ -2435,103 +1960,81 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2435
1960
|
value: function () {
|
|
2436
1961
|
var _RecordTags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref29) {
|
|
2437
1962
|
var accessType, libraryId, objectId, versionHash, _yield$this$ContractI8, abi, owner;
|
|
2438
|
-
|
|
2439
1963
|
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
2440
|
-
while (1) {
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
abi: abi
|
|
2465
|
-
});
|
|
2466
|
-
|
|
2467
|
-
case 9:
|
|
2468
|
-
owner = _context29.sent;
|
|
2469
|
-
|
|
2470
|
-
if (Utils.EqualAddress(owner, this.client.signer.address)) {
|
|
2471
|
-
_context29.next = 13;
|
|
2472
|
-
break;
|
|
2473
|
-
}
|
|
2474
|
-
|
|
1964
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1965
|
+
case 0:
|
|
1966
|
+
accessType = _ref29.accessType, libraryId = _ref29.libraryId, objectId = _ref29.objectId, versionHash = _ref29.versionHash;
|
|
1967
|
+
if (!(accessType !== ACCESS_TYPES.OBJECT)) {
|
|
1968
|
+
_context29.next = 3;
|
|
1969
|
+
break;
|
|
1970
|
+
}
|
|
1971
|
+
return _context29.abrupt("return");
|
|
1972
|
+
case 3:
|
|
1973
|
+
_context29.next = 5;
|
|
1974
|
+
return this.ContractInfo({
|
|
1975
|
+
id: objectId
|
|
1976
|
+
});
|
|
1977
|
+
case 5:
|
|
1978
|
+
_yield$this$ContractI8 = _context29.sent;
|
|
1979
|
+
abi = _yield$this$ContractI8.abi;
|
|
1980
|
+
_context29.next = 9;
|
|
1981
|
+
return this.Owner({
|
|
1982
|
+
id: objectId,
|
|
1983
|
+
abi: abi
|
|
1984
|
+
});
|
|
1985
|
+
case 9:
|
|
1986
|
+
owner = _context29.sent;
|
|
1987
|
+
if (Utils.EqualAddress(owner, this.client.signer.address)) {
|
|
2475
1988
|
_context29.next = 13;
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
1989
|
+
break;
|
|
1990
|
+
}
|
|
1991
|
+
_context29.next = 13;
|
|
1992
|
+
return this.client.userProfileClient.RecordTags({
|
|
1993
|
+
libraryId: libraryId,
|
|
1994
|
+
objectId: objectId,
|
|
1995
|
+
versionHash: versionHash
|
|
1996
|
+
});
|
|
1997
|
+
case 13:
|
|
1998
|
+
case "end":
|
|
1999
|
+
return _context29.stop();
|
|
2486
2000
|
}
|
|
2487
2001
|
}, _callee29, this);
|
|
2488
2002
|
}));
|
|
2489
|
-
|
|
2490
2003
|
function RecordTags(_x29) {
|
|
2491
2004
|
return _RecordTags.apply(this, arguments);
|
|
2492
2005
|
}
|
|
2493
|
-
|
|
2494
2006
|
return RecordTags;
|
|
2495
|
-
}()
|
|
2496
|
-
/* Creation methods */
|
|
2497
|
-
|
|
2007
|
+
}() /* Creation methods */
|
|
2498
2008
|
}, {
|
|
2499
2009
|
key: "CreateAccessGroup",
|
|
2500
2010
|
value: function () {
|
|
2501
2011
|
var _CreateAccessGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30() {
|
|
2502
2012
|
var _yield$this$client$et, contractAddress, transactionHash;
|
|
2503
|
-
|
|
2504
2013
|
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
2505
|
-
while (1) {
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
case 6:
|
|
2524
|
-
case "end":
|
|
2525
|
-
return _context30.stop();
|
|
2526
|
-
}
|
|
2014
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2015
|
+
case 0:
|
|
2016
|
+
_context30.next = 2;
|
|
2017
|
+
return this.client.ethClient.DeployAccessGroupContract({
|
|
2018
|
+
contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
|
|
2019
|
+
signer: this.client.signer
|
|
2020
|
+
});
|
|
2021
|
+
case 2:
|
|
2022
|
+
_yield$this$client$et = _context30.sent;
|
|
2023
|
+
contractAddress = _yield$this$client$et.contractAddress;
|
|
2024
|
+
transactionHash = _yield$this$client$et.transactionHash;
|
|
2025
|
+
return _context30.abrupt("return", {
|
|
2026
|
+
contractAddress: contractAddress,
|
|
2027
|
+
transactionHash: transactionHash
|
|
2028
|
+
});
|
|
2029
|
+
case 6:
|
|
2030
|
+
case "end":
|
|
2031
|
+
return _context30.stop();
|
|
2527
2032
|
}
|
|
2528
2033
|
}, _callee30, this);
|
|
2529
2034
|
}));
|
|
2530
|
-
|
|
2531
2035
|
function CreateAccessGroup() {
|
|
2532
2036
|
return _CreateAccessGroup.apply(this, arguments);
|
|
2533
2037
|
}
|
|
2534
|
-
|
|
2535
2038
|
return CreateAccessGroup;
|
|
2536
2039
|
}()
|
|
2537
2040
|
}, {
|
|
@@ -2539,38 +2042,31 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2539
2042
|
value: function () {
|
|
2540
2043
|
var _CreateContentType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
|
|
2541
2044
|
var _yield$this$client$et2, contractAddress, transactionHash;
|
|
2542
|
-
|
|
2543
2045
|
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
2544
|
-
while (1) {
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
case 6:
|
|
2563
|
-
case "end":
|
|
2564
|
-
return _context31.stop();
|
|
2565
|
-
}
|
|
2046
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2047
|
+
case 0:
|
|
2048
|
+
_context31.next = 2;
|
|
2049
|
+
return this.client.ethClient.DeployTypeContract({
|
|
2050
|
+
contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
|
|
2051
|
+
signer: this.client.signer
|
|
2052
|
+
});
|
|
2053
|
+
case 2:
|
|
2054
|
+
_yield$this$client$et2 = _context31.sent;
|
|
2055
|
+
contractAddress = _yield$this$client$et2.contractAddress;
|
|
2056
|
+
transactionHash = _yield$this$client$et2.transactionHash;
|
|
2057
|
+
return _context31.abrupt("return", {
|
|
2058
|
+
contractAddress: contractAddress,
|
|
2059
|
+
transactionHash: transactionHash
|
|
2060
|
+
});
|
|
2061
|
+
case 6:
|
|
2062
|
+
case "end":
|
|
2063
|
+
return _context31.stop();
|
|
2566
2064
|
}
|
|
2567
2065
|
}, _callee31, this);
|
|
2568
2066
|
}));
|
|
2569
|
-
|
|
2570
2067
|
function CreateContentType() {
|
|
2571
2068
|
return _CreateContentType.apply(this, arguments);
|
|
2572
2069
|
}
|
|
2573
|
-
|
|
2574
2070
|
return CreateContentType;
|
|
2575
2071
|
}()
|
|
2576
2072
|
}, {
|
|
@@ -2578,40 +2074,33 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2578
2074
|
value: function () {
|
|
2579
2075
|
var _CreateContentLibrary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(_ref30) {
|
|
2580
2076
|
var kmsId, _yield$this$client$et3, contractAddress, transactionHash;
|
|
2581
|
-
|
|
2582
2077
|
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
2583
|
-
while (1) {
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
case 7:
|
|
2604
|
-
case "end":
|
|
2605
|
-
return _context32.stop();
|
|
2606
|
-
}
|
|
2078
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2079
|
+
case 0:
|
|
2080
|
+
kmsId = _ref30.kmsId;
|
|
2081
|
+
_context32.next = 3;
|
|
2082
|
+
return this.client.ethClient.DeployLibraryContract({
|
|
2083
|
+
contentSpaceAddress: Utils.HashToAddress(this.contentSpaceId),
|
|
2084
|
+
kmsId: kmsId,
|
|
2085
|
+
signer: this.client.signer
|
|
2086
|
+
});
|
|
2087
|
+
case 3:
|
|
2088
|
+
_yield$this$client$et3 = _context32.sent;
|
|
2089
|
+
contractAddress = _yield$this$client$et3.contractAddress;
|
|
2090
|
+
transactionHash = _yield$this$client$et3.transactionHash;
|
|
2091
|
+
return _context32.abrupt("return", {
|
|
2092
|
+
contractAddress: contractAddress,
|
|
2093
|
+
transactionHash: transactionHash
|
|
2094
|
+
});
|
|
2095
|
+
case 7:
|
|
2096
|
+
case "end":
|
|
2097
|
+
return _context32.stop();
|
|
2607
2098
|
}
|
|
2608
2099
|
}, _callee32, this);
|
|
2609
2100
|
}));
|
|
2610
|
-
|
|
2611
2101
|
function CreateContentLibrary(_x30) {
|
|
2612
2102
|
return _CreateContentLibrary.apply(this, arguments);
|
|
2613
2103
|
}
|
|
2614
|
-
|
|
2615
2104
|
return CreateContentLibrary;
|
|
2616
2105
|
}()
|
|
2617
2106
|
}, {
|
|
@@ -2619,43 +2108,35 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2619
2108
|
value: function () {
|
|
2620
2109
|
var _CreateContentObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(_ref31) {
|
|
2621
2110
|
var libraryId, typeId, _yield$this$client$et4, contractAddress, transactionHash;
|
|
2622
|
-
|
|
2623
2111
|
return _regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
2624
|
-
while (1) {
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
case 7:
|
|
2645
|
-
case "end":
|
|
2646
|
-
return _context33.stop();
|
|
2647
|
-
}
|
|
2112
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2113
|
+
case 0:
|
|
2114
|
+
libraryId = _ref31.libraryId, typeId = _ref31.typeId;
|
|
2115
|
+
_context33.next = 3;
|
|
2116
|
+
return this.client.ethClient.DeployContentContract({
|
|
2117
|
+
contentLibraryAddress: Utils.HashToAddress(libraryId),
|
|
2118
|
+
typeAddress: typeId ? Utils.HashToAddress(typeId) : Utils.nullAddress,
|
|
2119
|
+
signer: this.client.signer
|
|
2120
|
+
});
|
|
2121
|
+
case 3:
|
|
2122
|
+
_yield$this$client$et4 = _context33.sent;
|
|
2123
|
+
contractAddress = _yield$this$client$et4.contractAddress;
|
|
2124
|
+
transactionHash = _yield$this$client$et4.transactionHash;
|
|
2125
|
+
return _context33.abrupt("return", {
|
|
2126
|
+
contractAddress: contractAddress,
|
|
2127
|
+
transactionHash: transactionHash
|
|
2128
|
+
});
|
|
2129
|
+
case 7:
|
|
2130
|
+
case "end":
|
|
2131
|
+
return _context33.stop();
|
|
2648
2132
|
}
|
|
2649
2133
|
}, _callee33, this);
|
|
2650
2134
|
}));
|
|
2651
|
-
|
|
2652
2135
|
function CreateContentObject(_x31) {
|
|
2653
2136
|
return _CreateContentObject.apply(this, arguments);
|
|
2654
2137
|
}
|
|
2655
|
-
|
|
2656
2138
|
return CreateContentObject;
|
|
2657
2139
|
}() // Clear cached access transaction IDs and state channel tokens
|
|
2658
|
-
|
|
2659
2140
|
}, {
|
|
2660
2141
|
key: "ClearCache",
|
|
2661
2142
|
value: function ClearCache() {
|
|
@@ -2664,8 +2145,6 @@ var AuthorizationClient = /*#__PURE__*/function () {
|
|
|
2664
2145
|
this.channelContentTokens = {};
|
|
2665
2146
|
}
|
|
2666
2147
|
}]);
|
|
2667
|
-
|
|
2668
2148
|
return AuthorizationClient;
|
|
2669
2149
|
}();
|
|
2670
|
-
|
|
2671
2150
|
module.exports = AuthorizationClient;
|