Integrating Torus with your DApp is as seamless as using it. Let us start by first installing Torus onto your DApp website.
The code snippet below sets Torus as the default login method for the DApp, paste the following script to the <body> of index.html.
You can install via a npm package.
import Torus from "@toruslabs/torus-embed";import Web3 from "web3";const torus = new Torus();await torus.init();await torus.login(); // await torus.ethereum.enable()const web3 = new Web3(torus.provider);
Please refer to the examples folder for sample implementations
Test if Torus works with your DApp with the code snippet from below:
// Start using web3 in your dapp$ web3.eth.accounts> "0x05B53A73B...150C005e21"