@getpara/core-sdk 1.0.0 → 1.0.2
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/cjs/ParaCore.js +20 -6
- package/dist/esm/ParaCore.js +20 -6
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -73,8 +73,7 @@ const recovery_js_1 = require("./shares/recovery.js");
|
|
|
73
73
|
const libphonenumber_js_1 = __importDefault(require("libphonenumber-js"));
|
|
74
74
|
const formattingUtils_js_1 = require("./utils/formattingUtils.js");
|
|
75
75
|
const errors_js_1 = require("./errors.js");
|
|
76
|
-
|
|
77
|
-
const PARA_CORE_VERSION = '2.20.0'; // '0.2.2';
|
|
76
|
+
const PARA_CORE_VERSION = '1.0.2';
|
|
78
77
|
function dispatchEvent(type, data, error) {
|
|
79
78
|
typeof window !== 'undefined' &&
|
|
80
79
|
!!window.dispatchEvent &&
|
|
@@ -257,11 +256,17 @@ class ParaCore {
|
|
|
257
256
|
};
|
|
258
257
|
}
|
|
259
258
|
isPortal(envOverride) {
|
|
260
|
-
|
|
259
|
+
var _a;
|
|
260
|
+
if (typeof window === 'undefined')
|
|
261
|
+
return false;
|
|
262
|
+
return (!!((_a = window.location) === null || _a === void 0 ? void 0 : _a.host) &&
|
|
261
263
|
(0, definitions_js_1.getPortalBaseURL)(envOverride ? { env: envOverride } : this.ctx).includes(window.location.host));
|
|
262
264
|
}
|
|
263
265
|
isParaConnect() {
|
|
264
|
-
|
|
266
|
+
var _a;
|
|
267
|
+
if (typeof window === 'undefined')
|
|
268
|
+
return false;
|
|
269
|
+
return !!((_a = window.location) === null || _a === void 0 ? void 0 : _a.host) && (0, definitions_js_1.getParaConnectBaseUrl)(this.ctx).includes(window.location.host);
|
|
265
270
|
}
|
|
266
271
|
requireApiKey() {
|
|
267
272
|
if (!this.ctx.apiKey) {
|
|
@@ -1531,6 +1536,9 @@ class ParaCore {
|
|
|
1531
1536
|
setAuth(auth) {
|
|
1532
1537
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1533
1538
|
const authInfo = (0, user_management_client_1.extractAuthInfo)(auth);
|
|
1539
|
+
if (!authInfo) {
|
|
1540
|
+
return undefined;
|
|
1541
|
+
}
|
|
1534
1542
|
switch (authInfo.authType) {
|
|
1535
1543
|
case 'email':
|
|
1536
1544
|
yield this.setEmail(authInfo.identifier);
|
|
@@ -1558,13 +1566,16 @@ class ParaCore {
|
|
|
1558
1566
|
initiateUserLogin(_a) {
|
|
1559
1567
|
var { useShortUrl = false } = _a, auth = __rest(_a, ["useShortUrl"]);
|
|
1560
1568
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1561
|
-
const
|
|
1569
|
+
const authInfo = yield this.setAuth(auth);
|
|
1570
|
+
if (!authInfo) {
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1562
1573
|
const res = yield this.touchSession(true);
|
|
1563
1574
|
if (!this.loginEncryptionKeyPair) {
|
|
1564
1575
|
yield this.setLoginEncryptionKeyPair();
|
|
1565
1576
|
}
|
|
1566
1577
|
const webAuthLoginURL = yield this.getWebAuthURLForLogin({
|
|
1567
|
-
authType,
|
|
1578
|
+
authType: authInfo.authType,
|
|
1568
1579
|
sessionId: res.data.sessionId,
|
|
1569
1580
|
partnerId: res.data.partnerId,
|
|
1570
1581
|
loginEncryptionPublicKey: (0, utils_js_1.getPublicKeyHex)(this.loginEncryptionKeyPair),
|
|
@@ -1583,6 +1594,9 @@ class ParaCore {
|
|
|
1583
1594
|
initiateUserLoginV2(auth) {
|
|
1584
1595
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1585
1596
|
const authInfo = yield this.setAuth(auth);
|
|
1597
|
+
if (!authInfo) {
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1586
1600
|
yield this.touchSession(true);
|
|
1587
1601
|
if (!this.loginEncryptionKeyPair) {
|
|
1588
1602
|
yield this.setLoginEncryptionKeyPair();
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -44,8 +44,7 @@ import { sendRecoveryForShare } from './shares/recovery.js';
|
|
|
44
44
|
import parsePhoneNumberFromString from 'libphonenumber-js';
|
|
45
45
|
import { getCosmosAddress, truncateAddress } from './utils/formattingUtils.js';
|
|
46
46
|
import { TransactionReviewDenied, TransactionReviewError, TransactionReviewTimeout } from './errors.js';
|
|
47
|
-
|
|
48
|
-
const PARA_CORE_VERSION = '2.20.0'; // '0.2.2';
|
|
47
|
+
const PARA_CORE_VERSION = '1.0.2';
|
|
49
48
|
function dispatchEvent(type, data, error) {
|
|
50
49
|
typeof window !== 'undefined' &&
|
|
51
50
|
!!window.dispatchEvent &&
|
|
@@ -221,11 +220,17 @@ export class ParaCore {
|
|
|
221
220
|
};
|
|
222
221
|
}
|
|
223
222
|
isPortal(envOverride) {
|
|
224
|
-
|
|
223
|
+
var _a;
|
|
224
|
+
if (typeof window === 'undefined')
|
|
225
|
+
return false;
|
|
226
|
+
return (!!((_a = window.location) === null || _a === void 0 ? void 0 : _a.host) &&
|
|
225
227
|
getPortalBaseURL(envOverride ? { env: envOverride } : this.ctx).includes(window.location.host));
|
|
226
228
|
}
|
|
227
229
|
isParaConnect() {
|
|
228
|
-
|
|
230
|
+
var _a;
|
|
231
|
+
if (typeof window === 'undefined')
|
|
232
|
+
return false;
|
|
233
|
+
return !!((_a = window.location) === null || _a === void 0 ? void 0 : _a.host) && getParaConnectBaseUrl(this.ctx).includes(window.location.host);
|
|
229
234
|
}
|
|
230
235
|
requireApiKey() {
|
|
231
236
|
if (!this.ctx.apiKey) {
|
|
@@ -1495,6 +1500,9 @@ export class ParaCore {
|
|
|
1495
1500
|
setAuth(auth) {
|
|
1496
1501
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1497
1502
|
const authInfo = extractAuthInfo(auth);
|
|
1503
|
+
if (!authInfo) {
|
|
1504
|
+
return undefined;
|
|
1505
|
+
}
|
|
1498
1506
|
switch (authInfo.authType) {
|
|
1499
1507
|
case 'email':
|
|
1500
1508
|
yield this.setEmail(authInfo.identifier);
|
|
@@ -1522,13 +1530,16 @@ export class ParaCore {
|
|
|
1522
1530
|
initiateUserLogin(_a) {
|
|
1523
1531
|
var { useShortUrl = false } = _a, auth = __rest(_a, ["useShortUrl"]);
|
|
1524
1532
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1525
|
-
const
|
|
1533
|
+
const authInfo = yield this.setAuth(auth);
|
|
1534
|
+
if (!authInfo) {
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1526
1537
|
const res = yield this.touchSession(true);
|
|
1527
1538
|
if (!this.loginEncryptionKeyPair) {
|
|
1528
1539
|
yield this.setLoginEncryptionKeyPair();
|
|
1529
1540
|
}
|
|
1530
1541
|
const webAuthLoginURL = yield this.getWebAuthURLForLogin({
|
|
1531
|
-
authType,
|
|
1542
|
+
authType: authInfo.authType,
|
|
1532
1543
|
sessionId: res.data.sessionId,
|
|
1533
1544
|
partnerId: res.data.partnerId,
|
|
1534
1545
|
loginEncryptionPublicKey: getPublicKeyHex(this.loginEncryptionKeyPair),
|
|
@@ -1547,6 +1558,9 @@ export class ParaCore {
|
|
|
1547
1558
|
initiateUserLoginV2(auth) {
|
|
1548
1559
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1549
1560
|
const authInfo = yield this.setAuth(auth);
|
|
1561
|
+
if (!authInfo) {
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1550
1564
|
yield this.touchSession(true);
|
|
1551
1565
|
if (!this.loginEncryptionKeyPair) {
|
|
1552
1566
|
yield this.setLoginEncryptionKeyPair();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@celo/utils": "^8.0.0",
|
|
11
11
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
|
-
"@getpara/user-management-client": "1.0.
|
|
12
|
+
"@getpara/user-management-client": "1.0.2",
|
|
13
13
|
"@noble/hashes": "^1.5.0",
|
|
14
14
|
"base64url": "^3.0.1",
|
|
15
15
|
"buffer": "6.0.3",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"types": "./dist/types/index.d.ts"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "b52cb28fc10a5fda8c49747e98b512d680b5ded0"
|
|
44
44
|
}
|