@eluvio/elv-client-js 4.0.132 → 4.0.133
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 +14 -15
- package/dist/ElvClient-node-min.js +13 -14
- package/dist/ElvFrameClient-min.js +10 -10
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +14 -15
- package/dist/ElvWalletClient-node-min.js +13 -14
- package/dist/src/AuthorizationClient.js +12 -9
- package/dist/src/ContentObjectAudit.js +3 -3
- package/dist/src/ContentObjectVerification.js +3 -3
- package/dist/src/Crypto.js +2 -2
- package/dist/src/ElvClient.js +222 -263
- package/dist/src/ElvWallet.js +5 -7
- package/dist/src/EthClient.js +9 -8
- package/dist/src/FrameClient.js +10 -9
- package/dist/src/HttpClient.js +5 -5
- package/dist/src/Id.js +2 -1
- package/dist/src/PermissionsClient.js +19 -31
- package/dist/src/RemoteSigner.js +11 -10
- package/dist/src/UserProfileClient.js +20 -35
- package/dist/src/Utils.js +3 -2
- package/dist/src/client/ABRPublishing.js +2 -2
- package/dist/src/client/AccessGroups.js +2 -2
- package/dist/src/client/ContentAccess.js +12 -8
- package/dist/src/client/ContentManagement.js +72 -82
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/Files.js +2 -2
- package/dist/src/client/LiveConf.js +17 -31
- package/dist/src/client/LiveStream.js +4 -2
- package/dist/src/client/NFT.js +2 -2
- package/dist/src/client/Shares.js +24 -47
- package/dist/src/walletClient/ClientMethods.js +2 -2
- package/dist/src/walletClient/Profile.js +2 -2
- package/dist/src/walletClient/Utils.js +2 -2
- package/dist/src/walletClient/index.js +48 -63
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
/**
|
|
7
7
|
* Methods for creating and managing shared authorization tokens
|
|
8
8
|
*
|
|
@@ -23,7 +23,7 @@ var UrlJoin = require("url-join");
|
|
|
23
23
|
*/
|
|
24
24
|
exports.CreateShare = /*#__PURE__*/function () {
|
|
25
25
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
26
|
-
var objectId, expiresAt, _ref$params, params, tenantId
|
|
26
|
+
var objectId, expiresAt, _ref$params, params, tenantId;
|
|
27
27
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
@@ -32,30 +32,23 @@ exports.CreateShare = /*#__PURE__*/function () {
|
|
|
32
32
|
return this.userProfileClient.TenantContractId();
|
|
33
33
|
case 3:
|
|
34
34
|
tenantId = _context.sent;
|
|
35
|
-
_context.next = 6;
|
|
36
|
-
return this.CreateFabricToken({});
|
|
37
|
-
case 6:
|
|
38
|
-
token = _context.sent;
|
|
39
35
|
params.object_id = objectId;
|
|
40
36
|
if (expiresAt) {
|
|
41
37
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|
|
42
38
|
}
|
|
43
|
-
_context.next =
|
|
39
|
+
_context.next = 8;
|
|
44
40
|
return this.MakeAuthServiceRequest({
|
|
45
41
|
path: UrlJoin("as", "sharing", tenantId, "share"),
|
|
46
42
|
method: "POST",
|
|
47
43
|
format: "JSON",
|
|
48
44
|
body: params,
|
|
49
45
|
headers: {
|
|
50
|
-
Authorization: "Bearer ".concat(
|
|
46
|
+
Authorization: "Bearer ".concat(this.signedToken)
|
|
51
47
|
}
|
|
52
48
|
});
|
|
53
|
-
case
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
share.end_time = share.end_time ? new Date(share.end_time * 1000).toISOString() : undefined;
|
|
57
|
-
return _context.abrupt("return", share);
|
|
58
|
-
case 15:
|
|
49
|
+
case 8:
|
|
50
|
+
return _context.abrupt("return", _context.sent);
|
|
51
|
+
case 9:
|
|
59
52
|
case "end":
|
|
60
53
|
return _context.stop();
|
|
61
54
|
}
|
|
@@ -73,7 +66,6 @@ exports.CreateShare = /*#__PURE__*/function () {
|
|
|
73
66
|
* @param {string=} objectId - If specified, the results will be limited shares for the specified object
|
|
74
67
|
* @param {number=} limit=100 - Maximum number of results to return
|
|
75
68
|
* @param {number=} offset=0 - Offset from which to return results
|
|
76
|
-
* @param {Object=} params={} - Additional parameters
|
|
77
69
|
*
|
|
78
70
|
* @returns {Promise<Array<Object>>} - Info about the shares
|
|
79
71
|
*/
|
|
@@ -84,41 +76,34 @@ exports.Shares = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntim
|
|
|
84
76
|
limit,
|
|
85
77
|
_ref4$offset,
|
|
86
78
|
offset,
|
|
87
|
-
_ref4$params,
|
|
88
|
-
params,
|
|
89
79
|
tenantId,
|
|
90
|
-
token,
|
|
91
80
|
response,
|
|
92
81
|
_args2 = arguments;
|
|
93
82
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
94
83
|
while (1) switch (_context2.prev = _context2.next) {
|
|
95
84
|
case 0:
|
|
96
|
-
_ref4 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, objectId = _ref4.objectId, _ref4$limit = _ref4.limit, limit = _ref4$limit === void 0 ? 100 : _ref4$limit, _ref4$offset = _ref4.offset, offset = _ref4$offset === void 0 ? 0 : _ref4$offset
|
|
85
|
+
_ref4 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, objectId = _ref4.objectId, _ref4$limit = _ref4.limit, limit = _ref4$limit === void 0 ? 100 : _ref4$limit, _ref4$offset = _ref4.offset, offset = _ref4$offset === void 0 ? 0 : _ref4$offset;
|
|
97
86
|
_context2.next = 3;
|
|
98
87
|
return this.userProfileClient.TenantContractId();
|
|
99
88
|
case 3:
|
|
100
89
|
tenantId = _context2.sent;
|
|
101
90
|
_context2.next = 6;
|
|
102
|
-
return this.CreateFabricToken({});
|
|
103
|
-
case 6:
|
|
104
|
-
token = _context2.sent;
|
|
105
|
-
_context2.next = 9;
|
|
106
91
|
return this.MakeAuthServiceRequest({
|
|
107
92
|
path: UrlJoin("as", "sharing", tenantId, "shares"),
|
|
108
|
-
method: objectId
|
|
93
|
+
method: objectId ? "POST" : "GET",
|
|
109
94
|
queryParams: {
|
|
110
95
|
limit: limit,
|
|
111
96
|
offset: offset
|
|
112
97
|
},
|
|
113
|
-
body: objectId ?
|
|
98
|
+
body: objectId ? {
|
|
114
99
|
object_id: objectId
|
|
115
|
-
}
|
|
100
|
+
} : undefined,
|
|
116
101
|
format: "JSON",
|
|
117
102
|
headers: {
|
|
118
|
-
Authorization: "Bearer ".concat(
|
|
103
|
+
Authorization: "Bearer ".concat(this.signedToken)
|
|
119
104
|
}
|
|
120
105
|
});
|
|
121
|
-
case
|
|
106
|
+
case 6:
|
|
122
107
|
response = _context2.sent;
|
|
123
108
|
// Convert dates from seconds to date strings
|
|
124
109
|
if (response && response.shares) {
|
|
@@ -130,7 +115,7 @@ exports.Shares = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntim
|
|
|
130
115
|
});
|
|
131
116
|
}
|
|
132
117
|
return _context2.abrupt("return", response);
|
|
133
|
-
case
|
|
118
|
+
case 9:
|
|
134
119
|
case "end":
|
|
135
120
|
return _context2.stop();
|
|
136
121
|
}
|
|
@@ -149,7 +134,7 @@ exports.Shares = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntim
|
|
|
149
134
|
*/
|
|
150
135
|
exports.UpdateShare = /*#__PURE__*/function () {
|
|
151
136
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
|
|
152
|
-
var shareId, expiresAt, _ref5$params, params, tenantId
|
|
137
|
+
var shareId, expiresAt, _ref5$params, params, tenantId;
|
|
153
138
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
154
139
|
while (1) switch (_context3.prev = _context3.next) {
|
|
155
140
|
case 0:
|
|
@@ -158,26 +143,22 @@ exports.UpdateShare = /*#__PURE__*/function () {
|
|
|
158
143
|
return this.userProfileClient.TenantContractId();
|
|
159
144
|
case 3:
|
|
160
145
|
tenantId = _context3.sent;
|
|
161
|
-
_context3.next = 6;
|
|
162
|
-
return this.CreateFabricToken({});
|
|
163
|
-
case 6:
|
|
164
|
-
token = _context3.sent;
|
|
165
146
|
if (expiresAt) {
|
|
166
147
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|
|
167
148
|
}
|
|
168
|
-
_context3.next =
|
|
149
|
+
_context3.next = 7;
|
|
169
150
|
return this.MakeAuthServiceRequest({
|
|
170
151
|
path: UrlJoin("as", "sharing", tenantId, "share", shareId),
|
|
171
152
|
method: "PUT",
|
|
172
153
|
format: "JSON",
|
|
173
154
|
body: params,
|
|
174
155
|
headers: {
|
|
175
|
-
Authorization: "Bearer ".concat(
|
|
156
|
+
Authorization: "Bearer ".concat(this.signedToken)
|
|
176
157
|
}
|
|
177
158
|
});
|
|
178
|
-
case
|
|
159
|
+
case 7:
|
|
179
160
|
return _context3.abrupt("return", _context3.sent);
|
|
180
|
-
case
|
|
161
|
+
case 8:
|
|
181
162
|
case "end":
|
|
182
163
|
return _context3.stop();
|
|
183
164
|
}
|
|
@@ -196,7 +177,7 @@ exports.UpdateShare = /*#__PURE__*/function () {
|
|
|
196
177
|
*/
|
|
197
178
|
exports.RevokeShare = /*#__PURE__*/function () {
|
|
198
179
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
|
|
199
|
-
var shareId, tenantId
|
|
180
|
+
var shareId, tenantId;
|
|
200
181
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
201
182
|
while (1) switch (_context4.prev = _context4.next) {
|
|
202
183
|
case 0:
|
|
@@ -206,21 +187,17 @@ exports.RevokeShare = /*#__PURE__*/function () {
|
|
|
206
187
|
case 3:
|
|
207
188
|
tenantId = _context4.sent;
|
|
208
189
|
_context4.next = 6;
|
|
209
|
-
return this.CreateFabricToken({});
|
|
210
|
-
case 6:
|
|
211
|
-
token = _context4.sent;
|
|
212
|
-
_context4.next = 9;
|
|
213
190
|
return this.MakeAuthServiceRequest({
|
|
214
191
|
path: UrlJoin("as", "sharing", tenantId, "share", shareId, "revoke"),
|
|
215
192
|
method: "PUT",
|
|
216
193
|
format: "JSON",
|
|
217
194
|
headers: {
|
|
218
|
-
Authorization: "Bearer ".concat(
|
|
195
|
+
Authorization: "Bearer ".concat(this.signedToken)
|
|
219
196
|
}
|
|
220
197
|
});
|
|
221
|
-
case
|
|
198
|
+
case 6:
|
|
222
199
|
return _context4.abrupt("return", _context4.sent);
|
|
223
|
-
case
|
|
200
|
+
case 7:
|
|
224
201
|
case "end":
|
|
225
202
|
return _context4.stop();
|
|
226
203
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
2
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
3
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
var Utils = require("../Utils");
|
|
7
7
|
var UrlJoin = require("url-join");
|
|
8
8
|
var _require = require("./Utils"),
|
|
@@ -2,8 +2,8 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
|
2
2
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
3
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
4
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var UrlJoin = require("url-join");
|
|
9
9
|
var StateStorePath = function StateStorePath(_ref) {
|
|
@@ -2,8 +2,8 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
|
2
2
|
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
3
3
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
4
4
|
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
7
|
var Utils = require("../Utils");
|
|
8
8
|
var RarityToPercentage = function RarityToPercentage(rarity) {
|
|
9
9
|
if (!rarity) {
|
|
@@ -7,8 +7,8 @@ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
|
7
7
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
8
8
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
9
9
|
var _excluded = ["code", "address", "type", "authToken", "expiresAt"];
|
|
10
|
-
function ownKeys(
|
|
11
|
-
function _objectSpread(
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
12
|
var _require = require("../ElvClient"),
|
|
13
13
|
ElvClient = _require.ElvClient;
|
|
14
14
|
var Configuration = require("./Configuration");
|
|
@@ -79,7 +79,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
79
79
|
this.utils = client.utils;
|
|
80
80
|
this.ForbiddenMethods = ElvWalletClient.ForbiddenMethods;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
_createClass(ElvWalletClient, [{
|
|
83
83
|
key: "Log",
|
|
84
84
|
value: function Log(message) {
|
|
85
85
|
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -136,7 +136,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
136
136
|
*/
|
|
137
137
|
}, {
|
|
138
138
|
key: "PersonalSign",
|
|
139
|
-
value:
|
|
139
|
+
value: function () {
|
|
140
140
|
var _PersonalSign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
141
141
|
var message, parameters, url;
|
|
142
142
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -265,7 +265,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
265
265
|
return _PersonalSign.apply(this, arguments);
|
|
266
266
|
}
|
|
267
267
|
return PersonalSign;
|
|
268
|
-
}()
|
|
268
|
+
}()
|
|
269
269
|
}, {
|
|
270
270
|
key: "LogInURL",
|
|
271
271
|
value: function () {
|
|
@@ -344,7 +344,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
344
344
|
*/
|
|
345
345
|
}, {
|
|
346
346
|
key: "LogIn",
|
|
347
|
-
value:
|
|
347
|
+
value: function () {
|
|
348
348
|
var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref5) {
|
|
349
349
|
var _this = this;
|
|
350
350
|
var _ref5$method, method, provider, _ref5$mode, mode, callbackUrl, marketplaceParams, _ref5$clearLogin, clearLogin, callback, loginUrl;
|
|
@@ -463,10 +463,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
463
463
|
*
|
|
464
464
|
* @methodGroup Login
|
|
465
465
|
*/
|
|
466
|
-
)
|
|
467
466
|
}, {
|
|
468
467
|
key: "LogOut",
|
|
469
|
-
value:
|
|
468
|
+
value: function () {
|
|
470
469
|
var _LogOut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
471
470
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
472
471
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -509,7 +508,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
509
508
|
return _LogOut.apply(this, arguments);
|
|
510
509
|
}
|
|
511
510
|
return LogOut;
|
|
512
|
-
}()
|
|
511
|
+
}()
|
|
513
512
|
}, {
|
|
514
513
|
key: "TokenStatus",
|
|
515
514
|
value: function () {
|
|
@@ -549,7 +548,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
549
548
|
*/
|
|
550
549
|
}, {
|
|
551
550
|
key: "Authenticate",
|
|
552
|
-
value:
|
|
551
|
+
value: function () {
|
|
553
552
|
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref7) {
|
|
554
553
|
var token, decodedToken;
|
|
555
554
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
@@ -606,7 +605,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
606
605
|
* @param {string=} email - Email address of the user. If not specified, this method will attempt to extract the email from the ID token.
|
|
607
606
|
* @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
|
|
608
607
|
* @param {boolean=} shareEmail=false - Whether or not the user consents to sharing their email
|
|
609
|
-
* @param {number=} tokenDuration=24 - Token expiration duration, in hours
|
|
610
608
|
*
|
|
611
609
|
* @returns {Promise<Object>} - Returns an authorization tokens that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
|
|
612
610
|
* Save this token to avoid having to reauthenticate with OAuth. This token expires after 24 hours.
|
|
@@ -616,26 +614,26 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
616
614
|
* - signingToken - Identical to `authToken`, but also includes the ability to perform arbitrary signatures with the custodial wallet. This token should be protected and should not be
|
|
617
615
|
* shared with third parties.
|
|
618
616
|
*/
|
|
619
|
-
)
|
|
620
617
|
}, {
|
|
621
618
|
key: "AuthenticateOAuth",
|
|
622
|
-
value:
|
|
619
|
+
value: function () {
|
|
623
620
|
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref8) {
|
|
624
|
-
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, _ref8$extraData, extraData, nonce, _ref8$createRemoteTok, createRemoteToken, _ref8$force, force,
|
|
621
|
+
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, _ref8$extraData, extraData, nonce, _ref8$createRemoteTok, createRemoteToken, _ref8$force, force, tokenDuration, fabricToken, expiresAt, tokenResponse, address, decodedToken;
|
|
625
622
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
626
623
|
while (1) switch (_context11.prev = _context11.next) {
|
|
627
624
|
case 0:
|
|
628
|
-
idToken = _ref8.idToken, tenantId = _ref8.tenantId, email = _ref8.email, signerURIs = _ref8.signerURIs, _ref8$shareEmail = _ref8.shareEmail, shareEmail = _ref8$shareEmail === void 0 ? false : _ref8$shareEmail, _ref8$extraData = _ref8.extraData, extraData = _ref8$extraData === void 0 ? {} : _ref8$extraData, nonce = _ref8.nonce, _ref8$createRemoteTok = _ref8.createRemoteToken, createRemoteToken = _ref8$createRemoteTok === void 0 ? true : _ref8$createRemoteTok, _ref8$force = _ref8.force, force = _ref8$force === void 0 ? false : _ref8$force
|
|
625
|
+
idToken = _ref8.idToken, tenantId = _ref8.tenantId, email = _ref8.email, signerURIs = _ref8.signerURIs, _ref8$shareEmail = _ref8.shareEmail, shareEmail = _ref8$shareEmail === void 0 ? false : _ref8$shareEmail, _ref8$extraData = _ref8.extraData, extraData = _ref8$extraData === void 0 ? {} : _ref8$extraData, nonce = _ref8.nonce, _ref8$createRemoteTok = _ref8.createRemoteToken, createRemoteToken = _ref8$createRemoteTok === void 0 ? true : _ref8$createRemoteTok, _ref8$force = _ref8.force, force = _ref8$force === void 0 ? false : _ref8$force;
|
|
626
|
+
tokenDuration = 24;
|
|
629
627
|
if (!(!tenantId && this.selectedMarketplaceInfo)) {
|
|
630
|
-
_context11.next =
|
|
628
|
+
_context11.next = 6;
|
|
631
629
|
break;
|
|
632
630
|
}
|
|
633
|
-
_context11.next =
|
|
631
|
+
_context11.next = 5;
|
|
634
632
|
return this.AvailableMarketplaces();
|
|
635
|
-
case 4:
|
|
636
|
-
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
637
633
|
case 5:
|
|
638
|
-
|
|
634
|
+
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
635
|
+
case 6:
|
|
636
|
+
_context11.next = 8;
|
|
639
637
|
return this.client.SetRemoteSigner({
|
|
640
638
|
idToken: idToken,
|
|
641
639
|
tenantId: tenantId,
|
|
@@ -645,29 +643,28 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
645
643
|
}),
|
|
646
644
|
unsignedPublicAuth: true
|
|
647
645
|
});
|
|
648
|
-
case
|
|
646
|
+
case 8:
|
|
649
647
|
if (!(createRemoteToken && this.client.signer.remoteSigner)) {
|
|
650
|
-
_context11.next =
|
|
648
|
+
_context11.next = 17;
|
|
651
649
|
break;
|
|
652
650
|
}
|
|
653
651
|
expiresAt = Date.now() + 24 * 60 * 60 * 1000;
|
|
654
|
-
_context11.next =
|
|
652
|
+
_context11.next = 12;
|
|
655
653
|
return this.client.signer.RetrieveCSAT({
|
|
656
654
|
email: email,
|
|
657
655
|
nonce: nonce,
|
|
658
656
|
tenantId: tenantId,
|
|
659
|
-
force: force
|
|
660
|
-
duration: tokenDuration
|
|
657
|
+
force: force
|
|
661
658
|
});
|
|
662
|
-
case
|
|
659
|
+
case 12:
|
|
663
660
|
tokenResponse = _context11.sent;
|
|
664
661
|
fabricToken = tokenResponse.token;
|
|
665
662
|
nonce = tokenResponse.nonce;
|
|
666
|
-
_context11.next =
|
|
663
|
+
_context11.next = 21;
|
|
667
664
|
break;
|
|
668
|
-
case
|
|
665
|
+
case 17:
|
|
669
666
|
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
670
|
-
_context11.next =
|
|
667
|
+
_context11.next = 20;
|
|
671
668
|
return this.client.CreateFabricToken({
|
|
672
669
|
duration: tokenDuration * 60 * 60 * 1000,
|
|
673
670
|
context: email ? {
|
|
@@ -676,24 +673,24 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
676
673
|
}
|
|
677
674
|
} : {}
|
|
678
675
|
});
|
|
679
|
-
case 19:
|
|
680
|
-
fabricToken = _context11.sent;
|
|
681
676
|
case 20:
|
|
677
|
+
fabricToken = _context11.sent;
|
|
678
|
+
case 21:
|
|
682
679
|
address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
683
680
|
if (email) {
|
|
684
|
-
_context11.next =
|
|
681
|
+
_context11.next = 31;
|
|
685
682
|
break;
|
|
686
683
|
}
|
|
687
|
-
_context11.prev =
|
|
684
|
+
_context11.prev = 23;
|
|
688
685
|
decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
|
|
689
686
|
email = decodedToken.email;
|
|
690
|
-
_context11.next =
|
|
687
|
+
_context11.next = 31;
|
|
691
688
|
break;
|
|
692
|
-
case
|
|
693
|
-
_context11.prev =
|
|
694
|
-
_context11.t0 = _context11["catch"](
|
|
689
|
+
case 28:
|
|
690
|
+
_context11.prev = 28;
|
|
691
|
+
_context11.t0 = _context11["catch"](23);
|
|
695
692
|
throw Error("Failed to decode ID token");
|
|
696
|
-
case
|
|
693
|
+
case 31:
|
|
697
694
|
this.client.SetStaticToken({
|
|
698
695
|
token: fabricToken
|
|
699
696
|
});
|
|
@@ -723,11 +720,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
723
720
|
nonce: nonce
|
|
724
721
|
})
|
|
725
722
|
});
|
|
726
|
-
case
|
|
723
|
+
case 33:
|
|
727
724
|
case "end":
|
|
728
725
|
return _context11.stop();
|
|
729
726
|
}
|
|
730
|
-
}, _callee11, this, [[
|
|
727
|
+
}, _callee11, this, [[23, 28]]);
|
|
731
728
|
}));
|
|
732
729
|
function AuthenticateOAuth(_x13) {
|
|
733
730
|
return _AuthenticateOAuth.apply(this, arguments);
|
|
@@ -747,10 +744,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
747
744
|
* @returns {Promise<string>} - Returns an authorization token that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
|
|
748
745
|
* Save this token to avoid having to reauthenticate. This token expires after 24 hours.
|
|
749
746
|
*/
|
|
750
|
-
)
|
|
751
747
|
}, {
|
|
752
748
|
key: "AuthenticateExternalWallet",
|
|
753
|
-
value:
|
|
749
|
+
value: function () {
|
|
754
750
|
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref9) {
|
|
755
751
|
var _this2 = this;
|
|
756
752
|
var address, _ref9$tokenDuration, tokenDuration, _ref9$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
@@ -819,7 +815,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
819
815
|
*
|
|
820
816
|
* @returns {string} - The client auth token
|
|
821
817
|
*/
|
|
822
|
-
)
|
|
823
818
|
}, {
|
|
824
819
|
key: "ClientAuthToken",
|
|
825
820
|
value: function ClientAuthToken() {
|
|
@@ -1883,7 +1878,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1883
1878
|
*/
|
|
1884
1879
|
}, {
|
|
1885
1880
|
key: "Initialize",
|
|
1886
|
-
value:
|
|
1881
|
+
value: function () {
|
|
1887
1882
|
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
|
|
1888
1883
|
var client, _ref24$appId, appId, _ref24$network, network, _ref24$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref24$storeAuthToken, storeAuthToken, _ref24$skipMarketplac, skipMarketplaceLoad, _ref25, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
|
|
1889
1884
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
@@ -1983,46 +1978,36 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1983
1978
|
_context25.prev = 35;
|
|
1984
1979
|
_context25.t0 = _context25["catch"](28);
|
|
1985
1980
|
case 37:
|
|
1986
|
-
_context25.
|
|
1987
|
-
_context25.next = 40;
|
|
1981
|
+
_context25.next = 39;
|
|
1988
1982
|
return client.utils.ResponseToJson(client.MakeAuthServiceRequest({
|
|
1989
1983
|
path: "/as/mw/toplevel",
|
|
1990
1984
|
queryParams: {
|
|
1991
1985
|
env: mode
|
|
1992
1986
|
}
|
|
1993
1987
|
}));
|
|
1994
|
-
case
|
|
1988
|
+
case 39:
|
|
1995
1989
|
walletClient.topLevelInfo = _context25.sent;
|
|
1996
|
-
_context25.next = 47;
|
|
1997
|
-
break;
|
|
1998
|
-
case 43:
|
|
1999
|
-
_context25.prev = 43;
|
|
2000
|
-
_context25.t1 = _context25["catch"](37);
|
|
2001
|
-
// eslint-disable-next-line no-console
|
|
2002
|
-
console.error("Unable to load top level info:");
|
|
2003
|
-
// eslint-disable-next-line no-console
|
|
2004
|
-
console.error(_context25.t1);
|
|
2005
|
-
case 47:
|
|
2006
1990
|
if (skipMarketplaceLoad) {
|
|
2007
|
-
_context25.next =
|
|
1991
|
+
_context25.next = 43;
|
|
2008
1992
|
break;
|
|
2009
1993
|
}
|
|
2010
|
-
_context25.next =
|
|
1994
|
+
_context25.next = 43;
|
|
2011
1995
|
return walletClient.LoadAvailableMarketplaces();
|
|
2012
|
-
case
|
|
1996
|
+
case 43:
|
|
2013
1997
|
return _context25.abrupt("return", walletClient);
|
|
2014
|
-
case
|
|
1998
|
+
case 44:
|
|
2015
1999
|
case "end":
|
|
2016
2000
|
return _context25.stop();
|
|
2017
2001
|
}
|
|
2018
|
-
}, _callee25, null, [[28, 35]
|
|
2002
|
+
}, _callee25, null, [[28, 35]]);
|
|
2019
2003
|
}));
|
|
2020
2004
|
function Initialize(_x25) {
|
|
2021
2005
|
return _Initialize.apply(this, arguments);
|
|
2022
2006
|
}
|
|
2023
2007
|
return Initialize;
|
|
2024
|
-
}()
|
|
2008
|
+
}()
|
|
2025
2009
|
}]);
|
|
2010
|
+
return ElvWalletClient;
|
|
2026
2011
|
}();
|
|
2027
2012
|
Object.assign(ElvWalletClient.prototype, require("./ClientMethods"));
|
|
2028
2013
|
Object.assign(ElvWalletClient.prototype, require("./Profile"));
|