@web3auth/no-modal 10.14.0 → 10.14.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.
@@ -147,7 +147,7 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
147
147
  ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig10 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig10 === void 0 ? void 0 : _walletServicesConfig10.defaultPortfolio
148
148
  };
149
149
  };
150
- const sdkVersion = "10.14.0";
150
+ const sdkVersion = "10.14.1";
151
151
  const getErrorAnalyticsProperties = error => {
152
152
  try {
153
153
  const code = error instanceof index.Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
@@ -342,7 +342,7 @@ class AuthConnector extends baseConnector.BaseConnector {
342
342
  return finalPrivKey;
343
343
  }
344
344
  async connectWithProvider(params) {
345
- var _this$authInstance, _params$extraLoginOpt;
345
+ var _this$authInstance, _params$extraLoginOpt, _this$authInstance2, _this$authInstance3;
346
346
  if (!this.authInstance) throw index$1.WalletInitializationError.notReady("authInstance is not ready");
347
347
  const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId);
348
348
  if (!chainConfig) throw index$1.WalletLoginError.connectionError("Chain config is not available");
@@ -365,6 +365,14 @@ class AuthConnector extends baseConnector.BaseConnector {
365
365
  await this.connectWithSocialLogin(loginParams);
366
366
  }
367
367
  }
368
+ // if useSFAKey is true and privKey is available but coreKitKey is not available, throw an error
369
+ if (this.coreOptions.useSFAKey && (_this$authInstance2 = this.authInstance) !== null && _this$authInstance2 !== void 0 && _this$authInstance2.privKey && !((_this$authInstance3 = this.authInstance) !== null && _this$authInstance3 !== void 0 && _this$authInstance3.coreKitKey)) {
370
+ // If the user is already logged in, logout and throw an error
371
+ if (this.authInstance.sessionId) {
372
+ await this.authInstance.logout();
373
+ }
374
+ throw index$1.WalletLoginError.sfaKeyNotFound("This typically occurs when the authentication method used does not provide SFA keys (e.g., default auth connection).");
375
+ }
368
376
  // setup WS embed if chainNamespace is EIP155 or SOLANA
369
377
  if (chainNamespace === baseControllers.CHAIN_NAMESPACES.EIP155 || chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA) {
370
378
  // wait for ws embed instance to be ready.
@@ -146,7 +146,7 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
146
146
  ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig10 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig10 === void 0 ? void 0 : _walletServicesConfig10.defaultPortfolio
147
147
  };
148
148
  };
149
- const sdkVersion = "10.14.0";
149
+ const sdkVersion = "10.14.1";
150
150
  const getErrorAnalyticsProperties = error => {
151
151
  try {
152
152
  const code = error instanceof Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
@@ -341,7 +341,7 @@ class AuthConnector extends BaseConnector {
341
341
  return finalPrivKey;
342
342
  }
343
343
  async connectWithProvider(params) {
344
- var _this$authInstance, _params$extraLoginOpt;
344
+ var _this$authInstance, _params$extraLoginOpt, _this$authInstance2, _this$authInstance3;
345
345
  if (!this.authInstance) throw WalletInitializationError.notReady("authInstance is not ready");
346
346
  const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId);
347
347
  if (!chainConfig) throw WalletLoginError.connectionError("Chain config is not available");
@@ -366,6 +366,15 @@ class AuthConnector extends BaseConnector {
366
366
  }
367
367
  }
368
368
 
369
+ // if useSFAKey is true and privKey is available but coreKitKey is not available, throw an error
370
+ if (this.coreOptions.useSFAKey && (_this$authInstance2 = this.authInstance) !== null && _this$authInstance2 !== void 0 && _this$authInstance2.privKey && !((_this$authInstance3 = this.authInstance) !== null && _this$authInstance3 !== void 0 && _this$authInstance3.coreKitKey)) {
371
+ // If the user is already logged in, logout and throw an error
372
+ if (this.authInstance.sessionId) {
373
+ await this.authInstance.logout();
374
+ }
375
+ throw WalletLoginError.sfaKeyNotFound("This typically occurs when the authentication method used does not provide SFA keys (e.g., default auth connection).");
376
+ }
377
+
369
378
  // setup WS embed if chainNamespace is EIP155 or SOLANA
370
379
  if (chainNamespace === CHAIN_NAMESPACES.EIP155 || chainNamespace === CHAIN_NAMESPACES.SOLANA) {
371
380
  // wait for ws embed instance to be ready.