@getpara/core-sdk 2.0.0-alpha.56 → 2.0.0-alpha.58

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.
@@ -922,7 +922,7 @@ const _ParaCore = class _ParaCore {
922
922
  throw error;
923
923
  }
924
924
  if (!this.partner || ((_a = this.partner) == null ? void 0 : _a.id) !== session.partnerId || !(0, import_utils2.supportedWalletTypesEq)(((_b = this.partner) == null ? void 0 : _b.supportedWalletTypes) || [], session.supportedWalletTypes) || (((_c = this.partner) == null ? void 0 : _c.cosmosPrefix) || "cosmos") !== session.cosmosPrefix) {
925
- if (!session.partnerId) {
925
+ if (!session.partnerId && !this.isPortal()) {
926
926
  this.displayModalError(
927
927
  `Invalid API Key. Please ensure you have a valid API key for the current environment: ${(_d = this.ctx.env) == null ? void 0 : _d.toUpperCase()}.`
928
928
  );
@@ -3294,6 +3294,7 @@ Need help? Visit: https://docs.getpara.com or contact support
3294
3294
  if (serverAuthState.stage === "login" || serverAuthState.stage === "done") {
3295
3295
  throw new Error("Account already exists.");
3296
3296
  }
3297
+ yield this.touchSession(true);
3297
3298
  return __privateMethod(this, _ParaCore_instances, prepareAuthState_fn).call(this, serverAuthState, urlOptions);
3298
3299
  });
3299
3300
  }
@@ -3710,10 +3711,11 @@ prepareLoginState_fn = function(_0, _1) {
3710
3711
  portalTheme,
3711
3712
  sessionLookupId
3712
3713
  }) {
3713
- const _a = loginState, { loginAuthMethods, hasPasswordWithoutPIN } = _a, authState = __objRest(_a, ["loginAuthMethods", "hasPasswordWithoutPIN"]);
3714
+ const _a = loginState, { loginAuthMethods = [], hasPasswordWithoutPIN } = _a, authState = __objRest(_a, ["loginAuthMethods", "hasPasswordWithoutPIN"]);
3714
3715
  const isPasskeySupported = yield this.isPasskeySupported(), isPasskeyPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PASSKEY) && !this.isNativePasskey, isPasswordPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PASSWORD) && hasPasswordWithoutPIN, isPINPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PIN);
3715
3716
  return __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, authState), {
3716
- isPasskeySupported
3717
+ isPasskeySupported,
3718
+ loginAuthMethods
3717
3719
  }), isPasskeyPossible ? {
3718
3720
  passkeyUrl: yield this.getLoginUrl({ sessionId: sessionLookupId, shorten, portalTheme }),
3719
3721
  passkeyKnownDeviceUrl: yield this.constructPortalUrl("loginAuth", {
@@ -3744,7 +3746,7 @@ prepareLoginState_fn = function(_0, _1) {
3744
3746
  };
3745
3747
  prepareSignUpState_fn = function(_0, _1) {
3746
3748
  return __async(this, arguments, function* (serverSignupState, { useShortUrls: shorten = false, portalTheme }) {
3747
- const _a = serverSignupState, { signupAuthMethods } = _a, authState = __objRest(_a, ["signupAuthMethods"]);
3749
+ const _a = serverSignupState, { signupAuthMethods = [] } = _a, authState = __objRest(_a, ["signupAuthMethods"]);
3748
3750
  const isPasskeySupported = yield this.isPasskeySupported();
3749
3751
  const [isPasskey, isPassword, isPIN] = [
3750
3752
  signupAuthMethods.includes(import_user_management_client.AuthMethod.PASSKEY),
@@ -3756,7 +3758,10 @@ prepareSignUpState_fn = function(_0, _1) {
3756
3758
  "No supported authentication methods found. Please ensure you have enabled either WebAuth passkeys, passwords or PINs in your Developer Portal settings."
3757
3759
  );
3758
3760
  }
3759
- const signupState = __spreadProps(__spreadValues({}, authState), { isPasskeySupported });
3761
+ const signupState = __spreadProps(__spreadValues({}, authState), {
3762
+ isPasskeySupported,
3763
+ signupAuthMethods
3764
+ });
3760
3765
  if (isPasskey) {
3761
3766
  const { url: passkeyUrl, credentialId: passkeyId } = yield this.getNewCredentialAndUrl({
3762
3767
  authMethod: "PASSKEY",
@@ -43,7 +43,7 @@ __export(constants_exports, {
43
43
  SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
44
44
  });
45
45
  module.exports = __toCommonJS(constants_exports);
46
- const PARA_CORE_VERSION = "2.0.0-alpha.56";
46
+ const PARA_CORE_VERSION = "2.0.0-alpha.58";
47
47
  const PREFIX = "@CAPSULE/";
48
48
  const PARA_PREFIX = "@PARA/";
49
49
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -886,7 +886,7 @@ const _ParaCore = class _ParaCore {
886
886
  throw error;
887
887
  }
888
888
  if (!this.partner || ((_a = this.partner) == null ? void 0 : _a.id) !== session.partnerId || !supportedWalletTypesEq(((_b = this.partner) == null ? void 0 : _b.supportedWalletTypes) || [], session.supportedWalletTypes) || (((_c = this.partner) == null ? void 0 : _c.cosmosPrefix) || "cosmos") !== session.cosmosPrefix) {
889
- if (!session.partnerId) {
889
+ if (!session.partnerId && !this.isPortal()) {
890
890
  this.displayModalError(
891
891
  `Invalid API Key. Please ensure you have a valid API key for the current environment: ${(_d = this.ctx.env) == null ? void 0 : _d.toUpperCase()}.`
892
892
  );
@@ -3258,6 +3258,7 @@ Need help? Visit: https://docs.getpara.com or contact support
3258
3258
  if (serverAuthState.stage === "login" || serverAuthState.stage === "done") {
3259
3259
  throw new Error("Account already exists.");
3260
3260
  }
3261
+ yield this.touchSession(true);
3261
3262
  return __privateMethod(this, _ParaCore_instances, prepareAuthState_fn).call(this, serverAuthState, urlOptions);
3262
3263
  });
3263
3264
  }
@@ -3674,10 +3675,11 @@ prepareLoginState_fn = function(_0, _1) {
3674
3675
  portalTheme,
3675
3676
  sessionLookupId
3676
3677
  }) {
3677
- const _a = loginState, { loginAuthMethods, hasPasswordWithoutPIN } = _a, authState = __objRest(_a, ["loginAuthMethods", "hasPasswordWithoutPIN"]);
3678
+ const _a = loginState, { loginAuthMethods = [], hasPasswordWithoutPIN } = _a, authState = __objRest(_a, ["loginAuthMethods", "hasPasswordWithoutPIN"]);
3678
3679
  const isPasskeySupported = yield this.isPasskeySupported(), isPasskeyPossible = loginAuthMethods.includes(AuthMethod.PASSKEY) && !this.isNativePasskey, isPasswordPossible = loginAuthMethods.includes(AuthMethod.PASSWORD) && hasPasswordWithoutPIN, isPINPossible = loginAuthMethods.includes(AuthMethod.PIN);
3679
3680
  return __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, authState), {
3680
- isPasskeySupported
3681
+ isPasskeySupported,
3682
+ loginAuthMethods
3681
3683
  }), isPasskeyPossible ? {
3682
3684
  passkeyUrl: yield this.getLoginUrl({ sessionId: sessionLookupId, shorten, portalTheme }),
3683
3685
  passkeyKnownDeviceUrl: yield this.constructPortalUrl("loginAuth", {
@@ -3708,7 +3710,7 @@ prepareLoginState_fn = function(_0, _1) {
3708
3710
  };
3709
3711
  prepareSignUpState_fn = function(_0, _1) {
3710
3712
  return __async(this, arguments, function* (serverSignupState, { useShortUrls: shorten = false, portalTheme }) {
3711
- const _a = serverSignupState, { signupAuthMethods } = _a, authState = __objRest(_a, ["signupAuthMethods"]);
3713
+ const _a = serverSignupState, { signupAuthMethods = [] } = _a, authState = __objRest(_a, ["signupAuthMethods"]);
3712
3714
  const isPasskeySupported = yield this.isPasskeySupported();
3713
3715
  const [isPasskey, isPassword, isPIN] = [
3714
3716
  signupAuthMethods.includes(AuthMethod.PASSKEY),
@@ -3720,7 +3722,10 @@ prepareSignUpState_fn = function(_0, _1) {
3720
3722
  "No supported authentication methods found. Please ensure you have enabled either WebAuth passkeys, passwords or PINs in your Developer Portal settings."
3721
3723
  );
3722
3724
  }
3723
- const signupState = __spreadProps(__spreadValues({}, authState), { isPasskeySupported });
3725
+ const signupState = __spreadProps(__spreadValues({}, authState), {
3726
+ isPasskeySupported,
3727
+ signupAuthMethods
3728
+ });
3724
3729
  if (isPasskey) {
3725
3730
  const { url: passkeyUrl, credentialId: passkeyId } = yield this.getNewCredentialAndUrl({
3726
3731
  authMethod: "PASSKEY",
@@ -1,5 +1,5 @@
1
1
  import "./chunk-W5CT3TVS.js";
2
- const PARA_CORE_VERSION = "2.0.0-alpha.56";
2
+ const PARA_CORE_VERSION = "2.0.0-alpha.58";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -146,6 +146,10 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & Wi
146
146
  * A Para Portal URL for logging in via a PIN.
147
147
  */
148
148
  pinUrl?: string;
149
+ /**
150
+ * Supported login auth methods for this session.
151
+ */
152
+ loginAuthMethods?: AuthMethod[];
149
153
  };
150
154
  export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & WithIsPasskeySupported & {
151
155
  /**
@@ -172,8 +176,14 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
172
176
  * The Para system ID for the newly generated PIN.
173
177
  */
174
178
  pinId?: string;
179
+ /**
180
+ * Supported signup auth methods for this session.
181
+ */
182
+ signupAuthMethods?: AuthMethod[];
183
+ };
184
+ export type AuthStateDone = Omit<ServerAuthStateDone, 'authMethods'> & {
185
+ authMethods: AuthMethod[];
175
186
  };
176
- export type AuthStateDone = ServerAuthStateDone;
177
187
  export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
178
188
  export type AuthStateSignupOrLoginOrDone = AuthStateSignup | AuthStateLogin | AuthStateDone;
179
189
  export type OAuthResponse = AuthStateSignupOrLoginOrDone;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-alpha.56",
3
+ "version": "2.0.0-alpha.58",
4
4
  "dependencies": {
5
5
  "@celo/utils": "^8.0.2",
6
6
  "@cosmjs/encoding": "^0.32.4",
7
7
  "@ethereumjs/util": "^9.1.0",
8
- "@getpara/user-management-client": "2.0.0-alpha.56",
8
+ "@getpara/user-management-client": "2.0.0-alpha.58",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "base64url": "^3.0.1",
11
11
  "libphonenumber-js": "^1.11.7",
@@ -27,7 +27,7 @@
27
27
  "dist",
28
28
  "package.json"
29
29
  ],
30
- "gitHead": "908fa2e02b383f43eef312c0cbeb2f2076e8dc25",
30
+ "gitHead": "58c87796dc0a10da5b7c3ed9658cfd9656f122cb",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {