One-key-flow fails with verifier not supported

Steps to reproduce:

  • Got to https://stg.acmedao.com/jwt . Login using any google id. Collect the jwt token.
  • Save the below code as one-key-flow.html
  • Open in the html file in browser with the above collected jwt as a URL query parameter. Ex, file:///Users/sharan/Desktop/one-key-flow.html?jwt=JWT_HERE
  • You should be able to reproduce the following error on console.

image

one-key-flow.html:

<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="<!doctype html> <html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Acme-dao">
<meta name="generator" content="acme-dao">
<title>one-key-flow test</title>
<style>
apple-pay-button {
–apple-pay-button-width: 156px;
–apple-pay-button-height: 50px;
–apple-pay-button-border-radius: 6px;
–apple-pay-button-padding: 0px 0px;
–apple-pay-button-box-sizing: border-box;
display: initial;
}
</style>

<!-- deps for when MFA=false –>
<script src="https://cdn.jsdelivr.net/npm/@toruslabs/torus.js@6.2.0/dist/torusUtils.umd.min.js&quot;&gt;&lt;/script&gt;
<script src="https://cdn.jsdelivr.net/npm/@toruslabs/openlogin-subkey@2.1.0/dist/openloginSubkey.umd.min.js&quot;&gt;&lt;/script&gt;
<script src="https://cdn.jsdelivr.net/npm/@toruslabs/fetch-node-details@8.0.0/dist/fetchNodeDetails.umd.min.js&quot;&gt;&lt;/script&gt;

<!-- deps for when MFA=true –>
<script src="https://cdn.jsdelivr.net/npm/@web3auth/web3auth@1.1.1/dist/web3auth.umd.min.js&quot;&gt;&lt;/script&gt;
<script src="https://cdn.jsdelivr.net/npm/@web3auth/core@1.1.1/dist/core.umd.min.js&quot;&gt;&lt;/script&gt;
<script src="https://cdn.jsdelivr.net/npm/@web3auth/openlogin-adapter@1.1.1/dist/openloginAdapter.umd.min.js&quot;&gt;&lt;/script&gt;

<!-- common deps –>
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.7.4-rc.0/web3.min.js&quot;&gt;&lt;/script&gt;
<script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js&quot;&gt;&lt;/script&gt;

<script>
const serverUrl = window.location.origin;
const urlParams = new URLSearchParams(location.search);
const jwt = urlParams.get(‘jwt’);
// const jwt = "PUT_YOUR_JWT_HERE";

const torusNetwork = &quot;https://polygon-mainnet.infura.io/v3/6b555ca82a3c440bb8cef518001c94c6&quot;
const torusNetworkChainId = &quot;0x89&quot;
// Initializing the Torus instance
const torus = new window.TorusUtils.default({
  enableOneKey: true,
  network: torusNetwork,
  allowHost: &quot;https://signer-polygon.tor.us/api/allow&quot;, 
  signerHost : &quot;https://signer-polygon.tor.us/api/sign&quot;
});
let blockchainProvider = null;

// Initializing the NodeDetailManager instance for Ropsten Testnet
// NOTE: change proxyAddress to `NodeDetailManager.PROXY_ADDRESS_MAINNET` when you switch to production
const nodeDetailManager = new window.FetchNodeDetails.default({ network: torusNetwork, proxyAddress: window.FetchNodeDetails.default.PROXY_ADDRESS_CYAN });

// const verifierId = loginRes.user.uid; // user's id from firebase login response or this can be any unique user's id like email etc.

const web3auth = new window.Web3auth.Web3Auth({
  chainConfig: {
    displayName: &quot;Ethereum Goerli&quot;,
    chainNamespace: &quot;eip155&quot;,
    chainId: &quot;0x5&quot;,
    rpcTarget: &quot;https://goerli.infura.io/v3/6b555ca82a3c440bb8cef518001c94c6&quot;,
    blockExplorer: &quot;https://goerli.polyscan.io/&quot;,
    ticker: &quot;ETH&quot;,
    tickerName: &quot;Ethereum&quot;,
  },
});

const openloginAdapter = new window.OpenloginAdapter.OpenloginAdapter({
  adapterSettings: {
    clientId: &quot;BIWLabqVJUJ3Ost4Iojs1yf91DaxcIDoQAdzV_UiUz7H3DOUGMAYtB8yDYOQMsjsDCXvGPMJ8dsONSmv-Q1_aM0&quot;,
    network: &quot;testnet&quot;,
    uxMode: &quot;redirect&quot;,
    replaceUrlOnRedirect: false,
    redirectUrl: window.location.href,
    loginConfig: {
      jwt: {
        name: &quot;Acmecore dev&quot;,
        verifier: &quot;acmecore-dev4&quot;,
        typeOfLogin: &quot;jwt&quot;,
        clientId: &quot;oJrh0kwMvcQ1L2nQwyb8toAt8OyZiVCd&quot;,
      },
    },
  },
});
let isLoading = false;
let web3;
let estimatedTransactionCost = 0.01; // TODO:
let rates;
let nftPrice;
let estimatedTransactionCostUSD;
let totalUSDPrice;
var preparedApplePayRequest=''

const render = async () =&gt; {
  console.log(&quot;inside isMFAEnabled&quot;);
  const parsedJWT = await JSON.parse(atob(jwt.split('.')[1]));
  console.log(parsedJWT);
  const verifierId = parsedJWT.email;
  console.log(verifierId);
  const { torusNodeEndpoints, torusNodePub, torusIndexes } = await nodeDetailManager.getNodeDetails({ verifier: &quot;acmecore-dev4&quot;, verifierId });
  const userDetails = await torus.getUserTypeAndAddress(torusNodeEndpoints, torusNodePub, { verifier: &quot;acmecore-dev4&quot;, verifierId }, true);
  // Now we check if the user has enabled mfa or not.
  // if !userDetails.upgraded then mfa is not enabled.
  console.log(userDetails)
  const mfaEnabled = !(userDetails.typeOfUser === &quot;v2&quot; &amp;&amp; !userDetails.upgraded);
  console.log(&quot;Is MFA enabled: &quot;, mfaEnabled);

  if (mfaEnabled==false){
    console.log(&quot;if mfa disabled&quot;)
    const chainConfig = {
      chainId: torusNetworkChainId,
      rpcTarget: torusNetwork,
    };
    // torus is initialized in code snippet above
    // if YES, login directly with the torus libraries within your app
    const keyDetails = await torus.retrieveShares(torusNodeEndpoints, torusIndexes, &quot;acmecore-dev4&quot;, { verifier_id: verifierId }, jwt, {});
    // use the private key to get the provider
    const finalPrivKey = subkey(keyDetails.privKey.padStart(64, &quot;0&quot;), Buffer.from(clientId, &quot;base64&quot;)).padStart(64, &quot;0&quot;);
    console.log(finalPrivKey)
    const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
      config: {
        chainConfig,
      },
    });
    blockchainProvider = await ethereumPrivateKeyProvider.setupProvider(finalPrivKey);
  }
  return;
};

</script>
</head>

<body class="" onload="render()">
</body>

</html>
“>

<!doctype html>
<html lang=”en">

<head>
<meta charset=“utf-8>
<meta name=“viewportcontent=“width=device-width, initial-scale=1>
<meta name=“descriptioncontent=“”>
<meta name=“authorcontent=“Acme-dao>
<meta name=“generatorcontent=“acme-dao>
<title>one-key-flow test</title>
<style>
apple-pay-button {
–apple-pay-button-width: 156px;
–apple-pay-button-height: 50px;
–apple-pay-button-border-radius: 6px;
–apple-pay-button-padding: 0px 0px;
–apple-pay-button-box-sizing: border-box;
display: initial;
}
</style>

<!-- deps for when MFA=false –>
<script src=“https://cdn.jsdelivr.net/npm/@toruslabs/torus.js@6.2.0/dist/torusUtils.umd.min.js></script>
<script src=“https://cdn.jsdelivr.net/npm/@toruslabs/openlogin-subkey@2.1.0/dist/openloginSubkey.umd.min.js></script>
<script src=“https://cdn.jsdelivr.net/npm/@toruslabs/fetch-node-details@8.0.0/dist/fetchNodeDetails.umd.min.js></script>

<!-- deps for when MFA=true –>
<script src=“https://cdn.jsdelivr.net/npm/@web3auth/web3auth@1.1.1/dist/web3auth.umd.min.js></script>
<script src=“https://cdn.jsdelivr.net/npm/@web3auth/core@1.1.1/dist/core.umd.min.js></script>
<script src=“https://cdn.jsdelivr.net/npm/@web3auth/openlogin-adapter@1.1.1/dist/openloginAdapter.umd.min.js></script>

<!-- common deps –>
<script src=“https://cdnjs.cloudflare.com/ajax/libs/web3/1.7.4-rc.0/web3.min.js></script>
<script src=“https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js></script>

<script>
const serverUrl = window.location.origin;
const urlParams = new URLSearchParams(location.search);
const jwt = urlParams.get(‘jwt’);
// const jwt = “PUT_YOUR_JWT_HERE”;

<span class="pl-k">const</span> <span class="pl-s1">torusNetwork</span> <span class="pl-c1">=</span> <span class="pl-s">"https://polygon-mainnet.infura.io/v3/6b555ca82a3c440bb8cef518001c94c6"</span>
<span class="pl-k">const</span> <span class="pl-s1">torusNetworkChainId</span> <span class="pl-c1">=</span> <span class="pl-s">"0x89"</span>
<span class="pl-c">// Initializing the Torus instance</span>
<span class="pl-k">const</span> <span class="pl-s1">torus</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">TorusUtils</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">enableOneKey</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
  <span class="pl-c1">network</span>: <span class="pl-s1">torusNetwork</span><span class="pl-kos">,</span>
  <span class="pl-c1">allowHost</span>: <span class="pl-s">"https://signer-polygon.tor.us/api/allow"</span><span class="pl-kos">,</span> 
  <span class="pl-c1">signerHost</span> : <span class="pl-s">"https://signer-polygon.tor.us/api/sign"</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">blockchainProvider</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>

<span class="pl-c">// Initializing the NodeDetailManager instance for Ropsten Testnet</span>
<span class="pl-c">// NOTE: change proxyAddress to `NodeDetailManager.PROXY_ADDRESS_MAINNET` when you switch to production</span>
<span class="pl-k">const</span> <span class="pl-s1">nodeDetailManager</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">FetchNodeDetails</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">network</span>: <span class="pl-s1">torusNetwork</span><span class="pl-kos">,</span> <span class="pl-c1">proxyAddress</span>: <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">FetchNodeDetails</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">.</span><span class="pl-c1">PROXY_ADDRESS_CYAN</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// const verifierId = loginRes.user.uid; // user's id from firebase login response or this can be any unique user's id like email etc.</span>

<span class="pl-k">const</span> <span class="pl-s1">web3auth</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">Web3auth</span><span class="pl-kos">.</span><span class="pl-c1">Web3Auth</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">chainConfig</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">displayName</span>: <span class="pl-s">"Ethereum Goerli"</span><span class="pl-kos">,</span>
    <span class="pl-c1">chainNamespace</span>: <span class="pl-s">"eip155"</span><span class="pl-kos">,</span>
    <span class="pl-c1">chainId</span>: <span class="pl-s">"0x5"</span><span class="pl-kos">,</span>
    <span class="pl-c1">rpcTarget</span>: <span class="pl-s">"https://goerli.infura.io/v3/6b555ca82a3c440bb8cef518001c94c6"</span><span class="pl-kos">,</span>
    <span class="pl-c1">blockExplorer</span>: <span class="pl-s">"https://goerli.polyscan.io/"</span><span class="pl-kos">,</span>
    <span class="pl-c1">ticker</span>: <span class="pl-s">"ETH"</span><span class="pl-kos">,</span>
    <span class="pl-c1">tickerName</span>: <span class="pl-s">"Ethereum"</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">openloginAdapter</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">OpenloginAdapter</span><span class="pl-kos">.</span><span class="pl-c1">OpenloginAdapter</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">adapterSettings</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">clientId</span>: <span class="pl-s">"BIWLabqVJUJ3Ost4Iojs1yf91DaxcIDoQAdzV_UiUz7H3DOUGMAYtB8yDYOQMsjsDCXvGPMJ8dsONSmv-Q1_aM0"</span><span class="pl-kos">,</span>
    <span class="pl-c1">network</span>: <span class="pl-s">"testnet"</span><span class="pl-kos">,</span>
    <span class="pl-c1">uxMode</span>: <span class="pl-s">"redirect"</span><span class="pl-kos">,</span>
    <span class="pl-c1">replaceUrlOnRedirect</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">redirectUrl</span>: <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">location</span><span class="pl-kos">.</span><span class="pl-c1">href</span><span class="pl-kos">,</span>
    <span class="pl-c1">loginConfig</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">jwt</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">name</span>: <span class="pl-s">"Acmecore dev"</span><span class="pl-kos">,</span>
        <span class="pl-c1">verifier</span>: <span class="pl-s">"acmecore-dev4"</span><span class="pl-kos">,</span>
        <span class="pl-c1">typeOfLogin</span>: <span class="pl-s">"jwt"</span><span class="pl-kos">,</span>
        <span class="pl-c1">clientId</span>: <span class="pl-s">"oJrh0kwMvcQ1L2nQwyb8toAt8OyZiVCd"</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">isLoading</span> <span class="pl-c1">=</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">web3</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">estimatedTransactionCost</span> <span class="pl-c1">=</span> <span class="pl-c1">0.01</span><span class="pl-kos">;</span> <span class="pl-c">// TODO:</span>
<span class="pl-k">let</span> <span class="pl-s1">rates</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">nftPrice</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">estimatedTransactionCostUSD</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">totalUSDPrice</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">preparedApplePayRequest</span><span class="pl-c1">=</span><span class="pl-s">''</span>

<span class="pl-k">const</span> <span class="pl-en">render</span> <span class="pl-c1">=</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"inside isMFAEnabled"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">parsedJWT</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-c1">JSON</span><span class="pl-kos">.</span><span class="pl-en">parse</span><span class="pl-kos">(</span><span class="pl-en">atob</span><span class="pl-kos">(</span><span class="pl-s1">jwt</span><span class="pl-kos">.</span><span class="pl-en">split</span><span class="pl-kos">(</span><span class="pl-s">'.'</span><span class="pl-kos">)</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">parsedJWT</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">verifierId</span> <span class="pl-c1">=</span> <span class="pl-s1">parsedJWT</span><span class="pl-kos">.</span><span class="pl-c1">email</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">verifierId</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-kos">{</span> torusNodeEndpoints<span class="pl-kos">,</span> torusNodePub<span class="pl-kos">,</span> torusIndexes <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">nodeDetailManager</span><span class="pl-kos">.</span><span class="pl-en">getNodeDetails</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">verifier</span>: <span class="pl-s">"acmecore-dev4"</span><span class="pl-kos">,</span> verifierId <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">userDetails</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">torus</span><span class="pl-kos">.</span><span class="pl-en">getUserTypeAndAddress</span><span class="pl-kos">(</span><span class="pl-s1">torusNodeEndpoints</span><span class="pl-kos">,</span> <span class="pl-s1">torusNodePub</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">verifier</span>: <span class="pl-s">"acmecore-dev4"</span><span class="pl-kos">,</span> verifierId <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-c">// Now we check if the user has enabled mfa or not.</span>
  <span class="pl-c">// if !userDetails.upgraded then mfa is not enabled.</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">userDetails</span><span class="pl-kos">)</span>
  <span class="pl-k">const</span> <span class="pl-s1">mfaEnabled</span> <span class="pl-c1">=</span> <span class="pl-c1">!</span><span class="pl-kos">(</span><span class="pl-s1">userDetails</span><span class="pl-kos">.</span><span class="pl-c1">typeOfUser</span> <span class="pl-c1">===</span> <span class="pl-s">"v2"</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-c1">!</span><span class="pl-s1">userDetails</span><span class="pl-kos">.</span><span class="pl-c1">upgraded</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"Is MFA enabled: "</span><span class="pl-kos">,</span> <span class="pl-s1">mfaEnabled</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">mfaEnabled</span><span class="pl-c1">==</span><span class="pl-c1">false</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"if mfa disabled"</span><span class="pl-kos">)</span>
    <span class="pl-k">const</span> <span class="pl-s1">chainConfig</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
      <span class="pl-c1">chainId</span>: <span class="pl-s1">torusNetworkChainId</span><span class="pl-kos">,</span>
      <span class="pl-c1">rpcTarget</span>: <span class="pl-s1">torusNetwork</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-c">// torus is initialized in code snippet above</span>
    <span class="pl-c">// if YES, login directly with the torus libraries within your app</span>
    <span class="pl-k">const</span> <span class="pl-s1">keyDetails</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">torus</span><span class="pl-kos">.</span><span class="pl-en">retrieveShares</span><span class="pl-kos">(</span><span class="pl-s1">torusNodeEndpoints</span><span class="pl-kos">,</span> <span class="pl-s1">torusIndexes</span><span class="pl-kos">,</span> <span class="pl-s">"acmecore-dev4"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">verifier_id</span>: <span class="pl-s1">verifierId</span> <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-s1">jwt</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-c">// use the private key to get the provider</span>
    <span class="pl-k">const</span> <span class="pl-s1">finalPrivKey</span> <span class="pl-c1">=</span> <span class="pl-en">subkey</span><span class="pl-kos">(</span><span class="pl-s1">keyDetails</span><span class="pl-kos">.</span><span class="pl-c1">privKey</span><span class="pl-kos">.</span><span class="pl-en">padStart</span><span class="pl-kos">(</span><span class="pl-c1">64</span><span class="pl-kos">,</span> <span class="pl-s">"0"</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-v">Buffer</span><span class="pl-kos">.</span><span class="pl-en">from</span><span class="pl-kos">(</span><span class="pl-s1">clientId</span><span class="pl-kos">,</span> <span class="pl-s">"base64"</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">padStart</span><span class="pl-kos">(</span><span class="pl-c1">64</span><span class="pl-kos">,</span> <span class="pl-s">"0"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">finalPrivKey</span><span class="pl-kos">)</span>
    <span class="pl-k">const</span> <span class="pl-s1">ethereumPrivateKeyProvider</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">EthereumPrivateKeyProvider</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
      <span class="pl-c1">config</span>: <span class="pl-kos">{</span>
        chainConfig<span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-s1">blockchainProvider</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">ethereumPrivateKeyProvider</span><span class="pl-kos">.</span><span class="pl-en">setupProvider</span><span class="pl-kos">(</span><span class="pl-s1">finalPrivKey</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-k">return</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

</script>
</head>

<body class=“” onload=“render()>
</body>

</html>



Originally posted by: rys-acme

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/816