From 760893830ca682adf41f4049126f7a9545651faa Mon Sep 17 00:00:00 2001 From: Maharshi Mishra Date: Thu, 9 Jan 2025 10:53:59 +0530 Subject: [PATCH] Added manageMFA and linked to account dashboard feature --- docs/features/account-dashboard.mdx | 9 ++++++++ docs/sdk/pnp/web/modal/usage.mdx | 6 +++++ docs/sdk/pnp/web/no-modal/usage.mdx | 6 +++++ src/common/sdk/pnp/web/_manage-mfa.mdx | 32 ++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 src/common/sdk/pnp/web/_manage-mfa.mdx diff --git a/docs/features/account-dashboard.mdx b/docs/features/account-dashboard.mdx index 86f397a7a..2c49473f3 100644 --- a/docs/features/account-dashboard.mdx +++ b/docs/features/account-dashboard.mdx @@ -9,6 +9,15 @@ Web3Auth's Account Dashboard provides a unified platform for users to manage the Authentication (MFA) and account security with ease. This document provides an overview of its features and how to integrate it seamlessly into your application. +:::tip + +To implement the Account Dashboard in your custom verifier-based dApp, please refer to the +[Manage MFA for No Modal SDK](/sdk/pnp/web/no-modal/usage#manage-multi-factor-authentication-mfa) +and [Manage MFA for Modal SDK](/sdk/pnp/web/modal/usage#manage-multi-factor-authentication-mfa) +sections. + +::: + ![Unified Recovery Management Screenshot](/images/account-dashboard/unified-recovery-management.jpg) ### 1. Unified Recovery Management diff --git a/docs/sdk/pnp/web/modal/usage.mdx b/docs/sdk/pnp/web/modal/usage.mdx index ced92e7df..d1e1da263 100644 --- a/docs/sdk/pnp/web/modal/usage.mdx +++ b/docs/sdk/pnp/web/modal/usage.mdx @@ -11,6 +11,7 @@ import ConnectBlockchain from "@site/src/common/sdk/pnp/web/_connect-blockchain. import GetIdTokenInfo from "@site/src/common/sdk/pnp/web/_get-idtoken-info.mdx"; import GetUserInfo from "@site/src/common/sdk/pnp/web/_get-user-info.mdx"; import EnableMFA from "@site/src/common/sdk/pnp/web/_enable-mfa.mdx"; +import ManageMFA from "@site/src/common/sdk/pnp/web/_manage-mfa.mdx"; import LogOut from "@site/src/common/sdk/pnp/web/_logout.mdx"; import SwitchChain from "@site/src/common/sdk/pnp/web/_switch-chain.mdx"; import Status from "@site/src/common/sdk/pnp/web/_status-method.mdx"; @@ -28,6 +29,7 @@ following functions: - `connect()` - Showing the Modal and Logging in the User - `getUserInfo()` - Getting the User's Information - `enableMFA()` - Enable Multi Factor Authentication for the user +- `manageMFA()` - Redirect the user to manage their MFA settings in the Web3Auth Account Dashboard - `authenticateUser()` - Getting the idToken from Web3Auth - `addChain()` - Add chain config details to the connected adapter. - `switchChain()` - Switch chain as per chainId already added to chain config. @@ -100,6 +102,10 @@ Read more about connecting your users with the selected blockchain in the +## Manage Multi Factor Authentication (MFA) + + + ## Get idToken for Backend Verification diff --git a/docs/sdk/pnp/web/no-modal/usage.mdx b/docs/sdk/pnp/web/no-modal/usage.mdx index 1d8183ebf..a1162b8c9 100644 --- a/docs/sdk/pnp/web/no-modal/usage.mdx +++ b/docs/sdk/pnp/web/no-modal/usage.mdx @@ -13,6 +13,7 @@ import Provider from "@site/src/common/sdk/pnp/web/_provider-method.mdx"; import ConnectedAdapterName from "@site/src/common/sdk/pnp/web/_connected-adapter-name-method.mdx"; import Connected from "@site/src/common/sdk/pnp/web/_connected-method.mdx"; import EnableMFA from "@site/src/common/sdk/pnp/web/_enable-mfa.mdx"; +import ManageMFA from "@site/src/common/sdk/pnp/web/_manage-mfa.mdx"; import ExtraLoginOptions from "@site/src/common/sdk/pnp/web/_extra-login-options.mdx"; import GetIdTokenInfo from "@site/src/common/sdk/pnp/web/_get-idtoken-info.mdx"; import GetUserInfo from "@site/src/common/sdk/pnp/web/_get-user-info.mdx"; @@ -33,6 +34,7 @@ the following functions: - `connectTo()` - Logging in the User with the given Wallet Adapter and respective Login Parameters. - `getUserInfo()` - Getting the User's Information. - `enableMFA()` - Enable Multi Factor Authentication for the user. +- `manageMFA()` - Redirect users to the Web3Auth Account Dashboard to manage their MFA settings. - `authenticateUser()` - Getting the idToken from Web3Auth. - `addChain()` - Add chain config details to the connected adapter. - `switchChain()` - Switch chain as per chainId already added to the chain config. @@ -144,6 +146,10 @@ options. +## Manage Multi Factor Authentication (MFA) + + + ## Get idToken diff --git a/src/common/sdk/pnp/web/_manage-mfa.mdx b/src/common/sdk/pnp/web/_manage-mfa.mdx new file mode 100644 index 000000000..d5b18ad08 --- /dev/null +++ b/src/common/sdk/pnp/web/_manage-mfa.mdx @@ -0,0 +1,32 @@ +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +#### `manageMFA()` + +You can redirect users to the Web3Auth Account Dashboard to manage their MFA settings by calling the +`manageMFA()` function. This method ensures that identity details are injected into the dashboard +internally for custom verifier-based dApps. In order to see what's present on the account dashboard, +please refer to the [Account Dashboard](/features/account-dashboard). + +```javascript +await web3auth.manageMFA(); +``` + +#### Interface + +```typescript +manageMFA(loginParams?: T): Promise; +``` + +- **`loginParams`** (optional): Optional parameters to include during the MFA management process. +- **Returns**: A `Promise` indicating successful redirection to the Account Dashboard. + +:::tip + +If MFA is not already enabled, the `manageMFA()` method will throw an error. Ensure you use +`enableMFA()` before calling `manageMFA()`. + +If your dApp uses default verifiers, users can directly log in to the Account Dashboard to manage +MFA. For custom verifier-based dApps, the `manageMFA()` method must be used. + +:::