SDK Version: 5.2.0
Platform: OS X Ventura 13.0.1 / Brave 1.47.186
Browser Console Screenshots:
Based on the documentation, I would expect to be able to retrieve the wallet’s private key when using the Torus EVM adapter, because it’s an in-app adapter, and it says here that the private key is only available when using in-app adapters (that’s in the Solana documentation, but I would expect the same to be true for other chains).
When I’m using the OpenLogin adapter, I can retrieve the private key just fine with basically the same code. Why is it that I can’t call the eth_private_key
method when using the Torus EVM adapter?
Init/login snippet:
const web3Auth = new Web3AuthNoModal({
clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID || '',
chainConfig: {
chainNamespace: 'eip155',
chainId: '0x1',
},
});
const torusWalletAdapter = new TorusWalletAdapter({
loginSettings: {
verifier: 'torus-auth0-github'
}
});
web3Auth.configureAdapter(torusWalletAdapter);
await web3Auth.init();
try {
// Wrap in try/catch to avoid errors if the wallet is already connected
const web3authProvider = await web3Auth.connectTo(
WALLET_ADAPTERS.TORUS_EVM,
{
loginProvider: 'torus-auth0-github',
}
);
} catch (e) {}
const web3 = new Web3(web3Auth.provider);
// This is where the error happens
const privkey = await web3Auth.provider.request({ method: 'eth_private_key' });
Any help would be much appreciated!