@getpara/core-sdk 1.0.0 → 1.0.1

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.
@@ -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
- // TODO: update backend to use @getpara/core-sdk version
77
- const PARA_CORE_VERSION = '2.20.0'; // '0.2.2';
76
+ const PARA_CORE_VERSION = '1.0.1';
78
77
  function dispatchEvent(type, data, error) {
79
78
  typeof window !== 'undefined' &&
80
79
  !!window.dispatchEvent &&
@@ -1531,6 +1530,9 @@ class ParaCore {
1531
1530
  setAuth(auth) {
1532
1531
  return __awaiter(this, void 0, void 0, function* () {
1533
1532
  const authInfo = (0, user_management_client_1.extractAuthInfo)(auth);
1533
+ if (!authInfo) {
1534
+ return undefined;
1535
+ }
1534
1536
  switch (authInfo.authType) {
1535
1537
  case 'email':
1536
1538
  yield this.setEmail(authInfo.identifier);
@@ -1558,13 +1560,16 @@ class ParaCore {
1558
1560
  initiateUserLogin(_a) {
1559
1561
  var { useShortUrl = false } = _a, auth = __rest(_a, ["useShortUrl"]);
1560
1562
  return __awaiter(this, void 0, void 0, function* () {
1561
- const { authType } = yield this.setAuth(auth);
1563
+ const authInfo = yield this.setAuth(auth);
1564
+ if (!authInfo) {
1565
+ return;
1566
+ }
1562
1567
  const res = yield this.touchSession(true);
1563
1568
  if (!this.loginEncryptionKeyPair) {
1564
1569
  yield this.setLoginEncryptionKeyPair();
1565
1570
  }
1566
1571
  const webAuthLoginURL = yield this.getWebAuthURLForLogin({
1567
- authType,
1572
+ authType: authInfo.authType,
1568
1573
  sessionId: res.data.sessionId,
1569
1574
  partnerId: res.data.partnerId,
1570
1575
  loginEncryptionPublicKey: (0, utils_js_1.getPublicKeyHex)(this.loginEncryptionKeyPair),
@@ -1583,6 +1588,9 @@ class ParaCore {
1583
1588
  initiateUserLoginV2(auth) {
1584
1589
  return __awaiter(this, void 0, void 0, function* () {
1585
1590
  const authInfo = yield this.setAuth(auth);
1591
+ if (!authInfo) {
1592
+ return;
1593
+ }
1586
1594
  yield this.touchSession(true);
1587
1595
  if (!this.loginEncryptionKeyPair) {
1588
1596
  yield this.setLoginEncryptionKeyPair();
@@ -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
- // TODO: update backend to use @getpara/core-sdk version
48
- const PARA_CORE_VERSION = '2.20.0'; // '0.2.2';
47
+ const PARA_CORE_VERSION = '1.0.1';
49
48
  function dispatchEvent(type, data, error) {
50
49
  typeof window !== 'undefined' &&
51
50
  !!window.dispatchEvent &&
@@ -1495,6 +1494,9 @@ export class ParaCore {
1495
1494
  setAuth(auth) {
1496
1495
  return __awaiter(this, void 0, void 0, function* () {
1497
1496
  const authInfo = extractAuthInfo(auth);
1497
+ if (!authInfo) {
1498
+ return undefined;
1499
+ }
1498
1500
  switch (authInfo.authType) {
1499
1501
  case 'email':
1500
1502
  yield this.setEmail(authInfo.identifier);
@@ -1522,13 +1524,16 @@ export class ParaCore {
1522
1524
  initiateUserLogin(_a) {
1523
1525
  var { useShortUrl = false } = _a, auth = __rest(_a, ["useShortUrl"]);
1524
1526
  return __awaiter(this, void 0, void 0, function* () {
1525
- const { authType } = yield this.setAuth(auth);
1527
+ const authInfo = yield this.setAuth(auth);
1528
+ if (!authInfo) {
1529
+ return;
1530
+ }
1526
1531
  const res = yield this.touchSession(true);
1527
1532
  if (!this.loginEncryptionKeyPair) {
1528
1533
  yield this.setLoginEncryptionKeyPair();
1529
1534
  }
1530
1535
  const webAuthLoginURL = yield this.getWebAuthURLForLogin({
1531
- authType,
1536
+ authType: authInfo.authType,
1532
1537
  sessionId: res.data.sessionId,
1533
1538
  partnerId: res.data.partnerId,
1534
1539
  loginEncryptionPublicKey: getPublicKeyHex(this.loginEncryptionKeyPair),
@@ -1547,6 +1552,9 @@ export class ParaCore {
1547
1552
  initiateUserLoginV2(auth) {
1548
1553
  return __awaiter(this, void 0, void 0, function* () {
1549
1554
  const authInfo = yield this.setAuth(auth);
1555
+ if (!authInfo) {
1556
+ return;
1557
+ }
1550
1558
  yield this.touchSession(true);
1551
1559
  if (!this.loginEncryptionKeyPair) {
1552
1560
  yield this.setLoginEncryptionKeyPair();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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.0",
12
+ "@getpara/user-management-client": "1.0.1",
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": "d4a619d2399a681ab36fbd66424997a343e546e2"
43
+ "gitHead": "adab14d69316165076fb244001ae271847bc23cc"
44
44
  }