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

# Feature flags

> Enable or disable specific SDK behaviors using feature flags when initializing Portal.

## Overview

Feature flags are set on the `featureFlags` option when you create a `Portal` instance. They control optional behavior such as signing performance, backup options, and which MPC backend is used. You do not need to change your signing or wallet code when enabling flags—the SDK adapts automatically.

## Enabling feature flags

Pass `featureFlags` in the Portal constructor:

```typescript theme={null}
import { Portal, BackupMethods } from '@portal-hq/core'
import Keychain from '@portal-hq/keychain'
import GoogleDriveStorage from '@portal-hq/gdrive-storage'

const portal = new Portal({
  apiKey: 'YOUR_PORTAL_CLIENT_API_KEY',
  backup: {
    [BackupMethods.GoogleDrive]: new GoogleDriveStorage({ /* ... */ }),
  },
  gatewayConfig: 'https://mainnet.infura.io/v3/YOUR_INFURA_API_KEY',
  featureFlags: {
    usePresignatures: true,
  },
})
```

## Available flags

### `usePresignatures`

* **Type:** `boolean`
* **Default:** `false`
* **Description:** When enabled, the SDK uses **presignatures** to improve signing latency. You do not call any presignature APIs yourself; the SDK generates presignatures in the background and uses them automatically when you sign (e.g. via `portal.request()` or send-asset flows).

**What presignatures do**

Presignatures pre-compute part of the MPC signing protocol ahead of time. When the user triggers a sign (EVM transaction, raw sign, or send asset), the SDK consumes one presignature if available and completes the signature faster. If no presignature is available, the SDK falls back to normal signing. Behavior is transparent to your app.

**When to enable**

Enable `usePresignatures` when you want lower latency on EVM signing without changing your integration. The SDK fills a small buffer after wallet creation or recovery and replenishes it as presignatures are used.

**Limitations**

* Applies only to **SECP256K1** (EVM) signing. Solana (ED25519) signing is unchanged.
* Presignatures are single-use; the SDK manages creation and consumption for you.

**Example**

```typescript theme={null}
const portal = new Portal({
  apiKey: 'YOUR_PORTAL_CLIENT_API_KEY',
  backup: { /* ... */ },
  gatewayConfig: { /* ... */ },
  featureFlags: {
    usePresignatures: true,
  },
})
```

***

### `usePreGeneratedWallet`

* **Type:** `boolean`
* **Default:** `false`
* **Description:** When enabled, `portal.createWallet()` attempts to claim a pre-generated wallet share instead of running the standard interactive MPC generation. This can make wallet creation faster. You do not need to change how you call `createWallet`.

**What it does**

Normally, `createWallet` runs the interactive MPC key generation protocol in real time. With this flag enabled, the SDK first tries to claim a share from a pre-computed pool. If that fails with an HTTP 5xx response from the enclave, the SDK automatically falls back to the standard generation flow—the fallback is transparent, and `createWallet` resolves or rejects exactly as it would through the standard flow. Failures that aren't a 5xx (for example, a malformed request or a network failure) are not retried and propagate as usual.

**When to enable**

Enable `usePreGeneratedWallet` when you want faster wallet creation without changing your integration. The resulting wallet is identical to one created through the standard flow.

**Limitations**

* This is a performance optimization only; it doesn't change the API surface, the resulting wallet, or how backup/recovery works.

**Example**

```typescript theme={null}
const portal = new Portal({
  apiKey: 'YOUR_PORTAL_CLIENT_API_KEY',
  backup: { /* ... */ },
  gatewayConfig: { /* ... */ },
  featureFlags: {
    usePreGeneratedWallet: true,
  },
})
```

***

### `useEnclaveMPCApi`

* **Type:** `boolean`
* **Default:** `false`
* **Description:** Use the Enclave MPC API for signing instead of the standard MPC path. Signing runs in a server-side TEE (AWS Nitro Enclave), which can yield more consistent and often faster signing across devices.

***

### `enableSdkPerformanceMetrics`

* **Type:** `boolean`
* **Default:** `false`
* **Description:** Enables SDK performance metrics collection. Used for internal monitoring and debugging.

***

## Reference

For the full `FeatureFlags` type and constructor options, see [@portal-hq/core](/sdks/react-native/reference/core#featureflags).
