Function Signature

recoverEncryptedBackupByWallet(params: {
  accountAddress: string;
  password: string;
  walletOperation: WalletOperation;
  shareCount: number;
  storeRecoveredShares: boolean;
}): Promise<any[]>

Description

Recovers encrypted backup of wallet key shares. This function restores key shares from a previously stored backup and can optionally store the recovered shares.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address to recover backup for
  • password (string) - Wallet password for decryption
  • walletOperation (WalletOperation) - The wallet operation for recovery
  • shareCount (number) - Number of shares to recover
  • storeRecoveredShares (boolean) - Whether to store recovered shares

Returns

  • Promise<any[]> - Array of recovered key shares

Example

import { authenticatedSvmClient } from './client';
import { WalletOperation } from '@dynamic-labs-wallet/node';

const svmClient = await authenticatedSvmClient();

const recoveredShares = await svmClient.recoverEncryptedBackupByWallet({
  accountAddress: 'YourSolanaWalletAddress',
  password: 'your-password',
  walletOperation: WalletOperation.SIGN_MESSAGE,
  shareCount: 1,
  storeRecoveredShares: true,
});

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

Available Wallet Operations

  • SIGN_MESSAGE - Message signing operations
  • SIGN_TRANSACTION - Transaction signing operations
  • EXPORT_PRIVATE_KEY - Private key export operations

Error Handling

try {
  const recoveredShares = await svmClient.recoverEncryptedBackupByWallet({
    accountAddress: 'YourSolanaWalletAddress',
    password: 'your-password',
    walletOperation: WalletOperation.SIGN_MESSAGE,
    shareCount: 1,
    storeRecoveredShares: true,
  });
  console.log('Encrypted backup recovered successfully');
} catch (error) {
  console.error('Failed to recover encrypted backup:', error);
}