forked from Web3Auth/web3auth-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (20 loc) · 885 Bytes
/
index.js
File metadata and controls
23 lines (20 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const { Web3Auth } = require("@web3auth/node-sdk");
const web3auth = new Web3Auth({
clientId: "BEglQSgt4cUWcj6SKRdu5QkOXTsePmMcusG5EAoyjyOYKlVRjIF1iCNnMOTfpzCiunHRrMui8TIwQPXdkQ8Yxuk", // Get your Client ID from Web3Auth Dashboard
chainConfig: {
chainNamespace: "eip155",
chainId: "0x1",
rpcTarget: "https://rpc.ankr.com/eth",
},
});
web3auth.init({ network: "cyan" });
const connect = async () => {
const provider = await web3auth.connect({
verifier: "verifier-name", // replace with your verifier name
verifierId: "verifier-Id", // replace with your verifier id, setup while creating the verifier on Web3Auth's Dashboard
idToken: "JWT Token", // replace with your newly created unused JWT Token.
});
const eth_private_key = await provider.request({ method: "eth_private_key" });
console.log("ETH Private Key", eth_private_key);
};
connect();