> ## 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.

# configurePasskeyStorage

> Configure Passkey backup storage.

## Function Signature

```dart theme={null}
Future<void> configurePasskeyStorage({
  required String relyingPartyId,
  required List<String> relyingPartyOrigins,
  String? webAuthnHost,
})
```

## Description

Configures Passkey (WebAuthn) backup storage. This must be called before using passkeys for backup or recovery operations.

## Parameters

| Parameter             | Type           | Required | Description                           |
| --------------------- | -------------- | -------- | ------------------------------------- |
| `relyingPartyId`      | `String`       | Yes      | The relying party identifier (domain) |
| `relyingPartyOrigins` | `List<String>` | Yes      | List of allowed origins               |
| `webAuthnHost`        | `String`       | No       | Optional WebAuthn host URL            |

## Returns

**`void`**

## Example

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

// Configure passkey with Portal's relying party
await portal.configurePasskeyStorage(
  relyingPartyId: 'portalhq.io',
  relyingPartyOrigins: ['https://portalhq.io'],
);

// Now you can use passkey backup
final response = await portal.backupWallet(
  method: PortalBackupMethod.passkey,
);
```

### Using Your Own Domain

```dart theme={null}
await portal.configurePasskeyStorage(
  relyingPartyId: 'your-domain.com',
  relyingPartyOrigins: ['https://your-domain.com'],
  webAuthnHost: 'https://webauthn.your-domain.com',
);
```

## Setup Requirements

### Using Portal's Relying Party (`portalhq.io`)

1. Add `portalhq.io` as a web credential domain in your app
2. Share your app bundle ID with the Portal team

### Using Your Own Domain

1. Set up associated domains in your app
2. Serve an AASA file from your domain with `webcredential` configured
3. Configure the relying party ID to match your domain

See Apple's documentation:

* [Configuring an associated domain](https://developer.apple.com/documentation/xcode/configuring-an-associated-domain)
* [Supporting associated domains](https://developer.apple.com/documentation/xcode/supporting-associated-domains)

## Errors

| Code                   | Description                         |
| ---------------------- | ----------------------------------- |
| `NOT_INITIALIZED`      | Portal was not initialized          |
| `CONFIGURATION_FAILED` | Failed to configure passkey storage |

## Related

* [Back up a wallet guide](../guide/back-up-a-wallet)
* [backupWallet](./backupwallet)
* [configureGoogleStorage](./configuregooglestorage)
