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.
Function Signature
Future<PortalAddresses> recoverWallet({
required PortalBackupMethod method,
String? password,
String? cipherText,
})
Description
Recovers a wallet from a backup using the specified backup method. This is used when a user needs to access their wallet on a new device.
Parameters
| Parameter | Type | Required | Description |
|---|
method | PortalBackupMethod | Yes | The backup method that was used |
password | String | No | Required when recovering with PortalBackupMethod.password |
cipherText | String | No | The encrypted backup data (for self-managed backups) |
Returns
PortalAddresses - An object containing the recovered wallet addresses:
| Property | Type | Description |
|---|
ethereum | String? | The Ethereum/EVM address |
solana | String? | The Solana address |
Example
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
// Recover with password
final addresses = await portal.recoverWallet(
method: PortalBackupMethod.password,
password: 'user-password',
);
print('Recovered EVM address: ${addresses.ethereum}');
print('Recovered Solana address: ${addresses.solana}');
Self-Managed Backup Recovery
// Recover with cipher text (self-managed backups)
final addresses = await portal.recoverWallet(
method: PortalBackupMethod.password,
password: 'user-password',
cipherText: 'stored-cipher-text',
);
Errors
| Code | Description |
|---|
NOT_INITIALIZED | Portal was not initialized |
RECOVERY_FAILED | The recovery operation failed |
INVALID_PASSWORD | The provided password is incorrect |
BACKUP_NOT_FOUND | No backup found for the specified method |