Key mismatch after updating to web3auth no-modal

When asking for help in this category, please make sure to provide the following details:

  • SDK Version: 7.3.2
  • Platform: Web
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken (JWT):

Hi, we have been using the old version of web3auth (prior to the release of the modal/no-modal sdks) and some of our users were created by simply authenticating on our website with email/password and then we used this email with the openlogin -email passwordless adapter to create a wallet for them. This project has been inactive for a couple of months and now we have revived it. We have made all the necessary changes, updated the implementations for walletconnect and metamask, updated packages to the no-modal sdk, and almost everything works, with exception of old users being unable to get the same private key from authentication through the openlogin via the no-modal sdks.

Before I share any relevant code, can you please let me know if the new no-modal sdk should be creating the same private key from such authentication (openlogin - email passwordless) as the old packages did?

Thanks in advance for your response!

hi @13.eremeev.sv

I hope you are doing great.

Please find attached the documentation about when you could get different private keys: https://web3auth.io/docs/troubleshooting/different-private-key

If you are using the same web3auth network, client id, verifier and SDK. You should be getting the same address.

please contact me if you have any doubts about this.

Thanks a lot for your reply Tom!

Here’s the old code we were using:

const openLoginAdapter = new OpenloginAdapter({
          adapterSettings: {
            network:
              process.env.NEXT_PUBLIC_ERC1155_NETWORK === "polygon-mainnet"
                ? "mainnet"
                : "testnet",
            clientId,
            uxMode: "popup",
          },
          loginSettings: {
            getWalletKey: true,
          },
          chainConfig: {
		chainNamespace: CHAIN_NAMESPACES.EIP155,
		chainId: getChainId(),
		rpcTarget: `https://${
			isPolygonMainnet ? "polygon-mainnet" : "polygon-mumbai"
		}.infura.io/v3/${process.env.NEXT_PUBLIC_INFURA_APP_ID}`,
		displayName: process.env.NEXT_PUBLIC_ERC1155_NETWORK!,
		blockExplorer: `https://${isMumbai ? "mumbai." : ""}polygonscan.com/`,
		ticker: "MATIC",
		tickerName: "Polygon",
	},
        });
        web3auth.configureAdapter(openLoginAdapter);

That was with the @web3auth/web3auth and @web3auth/base packages.

This year we changed the code to this:

const web3auth = new Web3AuthNoModal({
          clientId,
          chainConfig: {
    adapterNamespace: CHAIN_NAMESPACES.EIP155,
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: getChainId(),
    rpcTarget: `https://rpc.ankr.com/polygon/14e67e706759f10b38bab34e699878f3095157a6682b62dfd10ea910b2999570`,
    displayName: process.env.NEXT_PUBLIC_ERC1155_NETWORK!,
    blockExplorer: `https://${isMumbai ? "mumbai." : ""}polygon.etherscan.io`,
    ticker: "MATIC",
    tickerName: "Polygon",
  },
          web3AuthNetwork: "cyan",
        });

        const privateKeyProvider = new EthereumPrivateKeyProvider({
          config: { chainConfig: {
    adapterNamespace: CHAIN_NAMESPACES.EIP155,
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: getChainId(),
    rpcTarget: `https://rpc.ankr.com/polygon/14e67e706759f10b38bab34e699878f3095157a6682b62dfd10ea910b2999570`,
    displayName: process.env.NEXT_PUBLIC_ERC1155_NETWORK!,
    blockExplorer: `https://${isMumbai ? "mumbai." : ""}polygon.etherscan.io`,
    ticker: "MATIC",
    tickerName: "Polygon",
  } },
        });

        const openloginAdapter = new OpenloginAdapter({
          privateKeyProvider,
        });
        web3auth.configureAdapter(openloginAdapter);

I see there are some minor differences in the configuration, but not sure which ones exactly can mess up the resulting private keys our users are getting when they log in. Can you please let us know which parts of the config we need to change to fix the issue.

Thanks a lot in advance!

hi @13.eremeev.sv

Do you remember which network you were using? I see you are using “cyan” now, but Is it the same as the one you were using?

Also please notice that @web3auth/web3auth has been deprecated and Mumbai is not working anymore. You should use Amoy Polygon testnet.

We are using the same project in the web3auth dashboard and under the project environment it says “Legacy cyan mainnet (USA) (Cyan)”, so we’ve put “cyan” in the config object. I have a feeling our config object had “mainnet” for the environment before, but I might be wrong.

hi @13.eremeev.sv

if your dashboard says Cyan is because you were using it :slight_smile: