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

# Recover a wallet

> This guide will walk you through how to recover a Portal wallet from a backup.

If a user loses their device or needs to access their wallet on a new device, they can recover it using their backup.

## Recovery Process

The recovery process requires:

1. The backup method that was originally used
2. The authentication credentials (password, passkey, or cloud storage access)

## Recovery Methods

### Password Recovery

If the wallet was backed up with a password:

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

final portal = Portal();

// Recover wallet with password
final addresses = await portal.recoverWallet(
  method: PortalBackupMethod.password,
  password: 'THE-USER-PASSWORD',
);

print('Wallet recovered!');
print('EVM address: ${addresses.ethereum}');
print('Solana address: ${addresses.solana}');
```

### Passkey Recovery

If the wallet was backed up with a passkey:

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

final portal = Portal();

// Configure passkey storage first
await portal.configurePasskeyStorage(
  relyingPartyId: 'portalhq.io',
  relyingPartyOrigins: ['https://portalhq.io'],
);

// Recover wallet with passkey
final addresses = await portal.recoverWallet(
  method: PortalBackupMethod.passkey,
);

print('Wallet recovered!');
```

### Google Drive Recovery

If the wallet was backed up to Google Drive:

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

final portal = Portal();

// Configure Google Drive storage first
await portal.configureGoogleStorage(
  clientId: 'your-google-client-id',
);

// Recover wallet with Google Drive
final addresses = await portal.recoverWallet(
  method: PortalBackupMethod.googleDrive,
);

print('Wallet recovered!');
```

### iCloud Recovery (iOS only)

If the wallet was backed up to iCloud:

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

final portal = Portal();

// Configure iCloud storage first
await portal.configureICloudStorage();

// Recover wallet with iCloud
final addresses = await portal.recoverWallet(
  method: PortalBackupMethod.iCloud,
);

print('Wallet recovered!');
```

### Firebase Auth Recovery

If the wallet was backed up with Firebase Auth:

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

final portal = Portal();

// Configure Firebase storage first
await portal.configureFirebaseStorage(
  getToken: () async {
    final user = FirebaseAuth.instance.currentUser;
    if (user == null) return null;
    return await user.getIdToken(true);
  },
);

// Recover wallet with Firebase
final addresses = await portal.recoverWallet(
  method: PortalBackupMethod.firebase,
);

print('Wallet recovered!');
print('EVM address: ${addresses.ethereum}');
print('Solana address: ${addresses.solana}');
```

## Checking Recovery Status

Before attempting recovery, you can check if a wallet is recoverable:

```dart theme={null}
// Check if wallet can be recovered
final isRecoverable = await portal.isWalletRecoverable();

if (isRecoverable) {
  // Get available recovery methods
  final methods = await portal.availableRecoveryMethods();
  print('Available recovery methods: $methods');
} else {
  print('No recovery options available');
}
```

## Check Password Recovery Availability

If you want to specifically check if password recovery is available:

```dart theme={null}
final canRecoverWithPassword = await portal.isPasswordRecoverAvailable();

if (canRecoverWithPassword) {
  print('Password recovery is available');
}
```

<Warning>
  If a user forgets their password and has no other backup method configured, there is no way to recover the wallet. Always recommend users set up multiple backup methods.
</Warning>

**Related Documentation**

* [recoverWallet function reference](../reference/recoverwallet)
* [availableRecoveryMethods function reference](../reference/availablerecoverymethods)
* [isWalletRecoverable function reference](../reference/iswalletrecoverable)
