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

# recoverEncryptedBackupByWallet

> Recovers encrypted backup shares for a wallet using a password

## Function Signature

```typescript theme={"system"}
recoverEncryptedBackupByWallet(params: {
  accountAddress: string;
  walletMetadata: WalletMetadata;
  password: string;
  walletOperation: WalletOperation;
  shareCount?: number;
}): Promise<ServerKeyShare[]>
```

## Description

Recovers and decrypts backup shares for a wallet. Returns the recovered shares — the SDK no longer caches them internally. Assign the return value to a local variable if you need to reuse the shares.

## Parameters

### Required Parameters

* **`accountAddress`** (`string`) - The wallet address (must include `0x` prefix). Must match `walletMetadata.accountAddress`.
* **`walletMetadata`** ([`WalletMetadata`](/node/reference/types/wallet-metadata)) - The cached metadata for this wallet. Must include `externalServerKeySharesBackupInfo`.
* **`password`** (`string`) - Password to decrypt the backup
* **`walletOperation`** (`WalletOperation`) - The wallet operation that drives the recovery shape (which shares to recover)

### Optional Parameters

* **`shareCount`** (`number`) - Number of shares to recover (defaults to 1)

## Returns

* **`Promise<ServerKeyShare[]>`** — Array of recovered plaintext shares

## Example

```typescript theme={"system"}
import { authenticatedEvmClient } from './client';
import { WalletOperation } from '@dynamic-labs-wallet/node';

const evmClient = await authenticatedEvmClient();

const walletMetadata = JSON.parse(await redis.get(`wallet:${accountAddress}`));

const recoveredShares = await evmClient.recoverEncryptedBackupByWallet({
  accountAddress,
  walletMetadata,
  password: 'user-password',
  walletOperation: WalletOperation.SIGN_MESSAGE,
  shareCount: 1,
});

console.log('Recovered shares count:', recoveredShares.length);
```

## Available Wallet Operations

* **`SIGN_MESSAGE`** - Message signing operations
* **`SIGN_TRANSACTION`** - Transaction signing operations
* **`EXPORT_PRIVATE_KEY`** - Private key export operations
* **`REACH_THRESHOLD`** - Threshold-meeting recovery
* **`REACH_ALL_PARTIES`** - All-parties recovery

## Related

* [`WalletMetadata`](/node/reference/types/wallet-metadata) - The metadata object passed to every operation
* [`storeEncryptedBackupByWallet()`](/node/reference/evm/store-encrypted-backup-by-wallet) - Store encrypted backup
* [`requiresRestoreBackupSharesForOperation()`](/node/reference/evm/requires-restore-backup-shares-for-operation) - Check if backup restore is required
