@getpara/core-sdk 1.1.0 → 1.2.0

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.
@@ -1629,9 +1629,10 @@ class ParaCore {
1629
1629
  *
1630
1630
  * @param {Object} opts the options object
1631
1631
  * @param {OAuthMethod} opts.method the third-party service to use for OAuth.
1632
+ * @param {string} [opts.deeplinkUrl] the deeplink to redirect to after the OAuth flow. This is for mobile only.
1632
1633
  * @returns {string} the URL for the user to log in with OAuth.
1633
1634
  */
1634
- getOAuthURL({ method }) {
1635
+ getOAuthURL({ method, deeplinkUrl }) {
1635
1636
  return __awaiter(this, void 0, void 0, function* () {
1636
1637
  yield this.logout();
1637
1638
  const res = yield this.touchSession(true);
@@ -1641,6 +1642,7 @@ class ParaCore {
1641
1642
  params: {
1642
1643
  apiKey: this.ctx.apiKey,
1643
1644
  sessionLookupId: res.data.sessionLookupId,
1645
+ deeplinkUrl,
1644
1646
  },
1645
1647
  });
1646
1648
  });
@@ -2467,6 +2469,8 @@ class ParaCore {
2467
2469
  sessionCookie: this.sessionCookie,
2468
2470
  phone: this.phone,
2469
2471
  countryCode: this.countryCode,
2472
+ telegramUserId: this.telegramUserId,
2473
+ farcasterUsername: this.farcasterUsername,
2470
2474
  };
2471
2475
  return Buffer.from(JSON.stringify(sessionInfo)).toString('base64');
2472
2476
  }
@@ -2522,6 +2526,16 @@ class ParaCore {
2522
2526
  this.exitFarcaster();
2523
2527
  this.exitOAuth();
2524
2528
  }
2529
+ /**
2530
+ * Retrieves a token to verify the current session.
2531
+ * @returns {Promise<string>} the ID
2532
+ **/
2533
+ getVerificationToken() {
2534
+ return __awaiter(this, void 0, void 0, function* () {
2535
+ const { data } = yield this.touchSession();
2536
+ return data.sessionLookupId;
2537
+ });
2538
+ }
2525
2539
  /**
2526
2540
  * Logs the user out.
2527
2541
  * @param {Object} opts the options object.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SHORT_POLLING_INTERVAL_MS = exports.POLLING_INTERVAL_MS = exports.SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = exports.LOCAL_STORAGE_SESSION_COOKIE = exports.LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES = exports.LOCAL_STORAGE_CURRENT_WALLET_IDS = exports.LOCAL_STORAGE_EXTERNAL_WALLETS = exports.LOCAL_STORAGE_WALLETS = exports.LOCAL_STORAGE_ED25519_WALLETS = exports.LOCAL_STORAGE_USER_ID = exports.LOCAL_STORAGE_TELEGRAM_USER_ID = exports.LOCAL_STORAGE_FARCASTER_USERNAME = exports.LOCAL_STORAGE_COUNTRY_CODE = exports.LOCAL_STORAGE_PHONE = exports.LOCAL_STORAGE_EMAIL = exports.PREFIX = exports.PARA_CORE_VERSION = void 0;
4
- exports.PARA_CORE_VERSION = '1.1.0';
4
+ exports.PARA_CORE_VERSION = '1.2.0';
5
5
  exports.PREFIX = '@CAPSULE/';
6
6
  exports.LOCAL_STORAGE_EMAIL = `${exports.PREFIX}e-mail`;
7
7
  exports.LOCAL_STORAGE_PHONE = `${exports.PREFIX}phone`;
@@ -1600,9 +1600,10 @@ export class ParaCore {
1600
1600
  *
1601
1601
  * @param {Object} opts the options object
1602
1602
  * @param {OAuthMethod} opts.method the third-party service to use for OAuth.
1603
+ * @param {string} [opts.deeplinkUrl] the deeplink to redirect to after the OAuth flow. This is for mobile only.
1603
1604
  * @returns {string} the URL for the user to log in with OAuth.
1604
1605
  */
1605
- getOAuthURL({ method }) {
1606
+ getOAuthURL({ method, deeplinkUrl }) {
1606
1607
  return __awaiter(this, void 0, void 0, function* () {
1607
1608
  yield this.logout();
1608
1609
  const res = yield this.touchSession(true);
@@ -1612,6 +1613,7 @@ export class ParaCore {
1612
1613
  params: {
1613
1614
  apiKey: this.ctx.apiKey,
1614
1615
  sessionLookupId: res.data.sessionLookupId,
1616
+ deeplinkUrl,
1615
1617
  },
1616
1618
  });
1617
1619
  });
@@ -2438,6 +2440,8 @@ export class ParaCore {
2438
2440
  sessionCookie: this.sessionCookie,
2439
2441
  phone: this.phone,
2440
2442
  countryCode: this.countryCode,
2443
+ telegramUserId: this.telegramUserId,
2444
+ farcasterUsername: this.farcasterUsername,
2441
2445
  };
2442
2446
  return Buffer.from(JSON.stringify(sessionInfo)).toString('base64');
2443
2447
  }
@@ -2493,6 +2497,16 @@ export class ParaCore {
2493
2497
  this.exitFarcaster();
2494
2498
  this.exitOAuth();
2495
2499
  }
2500
+ /**
2501
+ * Retrieves a token to verify the current session.
2502
+ * @returns {Promise<string>} the ID
2503
+ **/
2504
+ getVerificationToken() {
2505
+ return __awaiter(this, void 0, void 0, function* () {
2506
+ const { data } = yield this.touchSession();
2507
+ return data.sessionLookupId;
2508
+ });
2509
+ }
2496
2510
  /**
2497
2511
  * Logs the user out.
2498
2512
  * @param {Object} opts the options object.
@@ -1,4 +1,4 @@
1
- export const PARA_CORE_VERSION = '1.1.0';
1
+ export const PARA_CORE_VERSION = '1.2.0';
2
2
  export const PREFIX = '@CAPSULE/';
3
3
  export const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
4
4
  export const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
@@ -565,10 +565,12 @@ export declare abstract class ParaCore {
565
565
  *
566
566
  * @param {Object} opts the options object
567
567
  * @param {OAuthMethod} opts.method the third-party service to use for OAuth.
568
+ * @param {string} [opts.deeplinkUrl] the deeplink to redirect to after the OAuth flow. This is for mobile only.
568
569
  * @returns {string} the URL for the user to log in with OAuth.
569
570
  */
570
- getOAuthURL({ method }: {
571
+ getOAuthURL({ method, deeplinkUrl }: {
571
572
  method: OAuthMethod;
573
+ deeplinkUrl?: string;
572
574
  }): Promise<string>;
573
575
  /**
574
576
  * Awaits the response from a user's attempt to log in with OAuth.
@@ -901,6 +903,11 @@ export declare abstract class ParaCore {
901
903
  protected exitFarcaster(): void;
902
904
  protected exitOAuth(): void;
903
905
  protected exitLoops(): void;
906
+ /**
907
+ * Retrieves a token to verify the current session.
908
+ * @returns {Promise<string>} the ID
909
+ **/
910
+ getVerificationToken(): Promise<string>;
904
911
  /**
905
912
  * Logs the user out.
906
913
  * @param {Object} opts the options object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
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.1.0",
12
+ "@getpara/user-management-client": "1.2.0",
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": "a9e81f5c4560664441b3a18b3f8fe05c5db927ec"
43
+ "gitHead": "a9162c59be1456292d46c56787c1d5bf313bf24b"
44
44
  }