Skip to content

Commit

Permalink
Added manageMFA and linked to account dashboard feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ihsraham committed Jan 9, 2025
1 parent 84bdde8 commit 7608938
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/features/account-dashboard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docs/sdk/pnp/web/modal/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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.
Expand Down Expand Up @@ -100,6 +102,10 @@ Read more about connecting your users with the selected blockchain in the

<EnableMFA />

## Manage Multi Factor Authentication (MFA)

<ManageMFA />

## Get idToken for Backend Verification

<GetIdTokenInfo />
Expand Down
6 changes: 6 additions & 0 deletions docs/sdk/pnp/web/no-modal/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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.
Expand Down Expand Up @@ -144,6 +146,10 @@ options.

<EnableMFA />

## Manage Multi Factor Authentication (MFA)

<ManageMFA />

## Get idToken

<GetIdTokenInfo />
Expand Down
32 changes: 32 additions & 0 deletions src/common/sdk/pnp/web/_manage-mfa.mdx
Original file line number Diff line number Diff line change
@@ -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<T>(loginParams?: T): Promise<void>;
```

- **`loginParams`** (optional): Optional parameters to include during the MFA management process.
- **Returns**: A `Promise<void>` 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.

:::

0 comments on commit 7608938

Please sign in to comment.