Implementation Guide
Step by step guide for implementing our SDK
Install Mirai Package
npm i @kanalabs/mirai
or
yarn add @kanalabs/mirai
Social Login Using Web3Auth
Installation
First, let us create a wallet using Web3Auth for Social Login. For this, we have to sign up at https://dashboard.web3auth.io/ to create an account to create a web3Auth Client ID which is available after you are signed into the dashboard and create a project under 'Plug and Play'. Copy the Client ID shown and keep it ready before continuing.
You can view a detailed steps on how to get started with Web3Auth : https://web3auth.io/docs/integration-builder?lang=REACT&chain=ETH&evmFramework=ETHERS&customAuth=NONE&mfa=DEFAULT&whitelabel=NO&useModal=NO&web3AuthNetwork=TESTNET&rnMode=EXPO&stepIndex=0&stepIndex=10#step-10
Install Web3Auth Packages
Whitelisting
The Client ID is unique for each project, if we use different Client IDs the same account login will give us different private keys. So if anyone uses our client ID, it will give a private key similar to the one we give. So it is necessary to add website links before allowing it to share our web3auth login.
Initialise web3auth
Defining the Web3Auth openLogin Adapter which is responsible for sign-in options. You can see the list of all sign-in options provided : https://web3auth.io/docs/auth-provider-setup/social-providers/
Listen to events emitted by the Web3Auth Adapter
Initialize the web3Auth instance after setting up the Adapter Configuration
Login with web3auth
Now, log in to web3Auth with valid credentials from any of the supported social platforms that web3auth supports..
For this example, Let us take Google as the social platform that we are looking to login
After completing the login process, you can obtain the private key. Before initializing the Mirai SDK with it, it is necessary to format the private key.
Format privateKey
Initialize Mirai SDK
To initialize the wallet SDK - specify the required networks and it will be initialize SDK for all networks.
Set Current SDK Instance
After initializing the sdk with the array required chains, we can set the default instance of SDK for any initialized network. with this function
Example
To get the smart wallet address
Destroy Instances
To destroy all SDK instances for the session
Last updated