> ## Documentation Index
> Fetch the complete documentation index at: https://docs.air3.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-factor authentication (MFA)

> Set up passkey-based multi-factor authentication for AIR Kit users with setupOrUpdateMfa, and decide when to prompt for it.

## setupOrUpdateMfa()

Sets up or updates multi-factor authentication for the user's account. This method guides the user through the MFA setup process using passkeys.

**Method Signature:**

```ts theme={null}
public async setupOrUpdateMfa(): Promise<void>
```

**What happens during MFA setup:**

1. The method ensures the wallet is initialized
2. Opens the MFA setup flow and guides the user through passkey creation/verification
3. Updates the user's MFA status in the system, including `loginResult` to reflect the new MFA status

**Requirements:**

* User must be logged in

**Important Notes:**

* **MFA is generally required**: If your dApp doesn't trigger `setupOrUpdateMfa()` after login and the user hasn't set up MFA, it will be triggered automatically with any wallet related request, requiring the user to complete setup before the request can be processed
* **Currently only passkey is supported** as the MFA method
* **Only MFA setup is currently implemented, not updates**: It's recommended to check if the user has already set up MFA before calling this method to avoid unnecessary prompts
* **Abstract Account Address availability**: The abstract account address will only be returned in user info and token if MFA is set up

## MFA setup integration

Since MFA is generally required, you can either:

**Option 1: Proactive Setup (Recommended)**

```ts theme={null}
try {
  const userInfo = await airService.getUserInfo();
  if (!userInfo.user.isMFASetup) {
    await airService.setupOrUpdateMfa();
    // Abstract account address will now be available
  }
} catch (error) {
  // Handle error appropriately
}
```

**Option 2: Let AIR Kit Handle Automatically**
Simply proceed with wallet operations - MFA will be prompted automatically if required.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.