Skip to main content

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.

Function Signature

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.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address. Must match walletMetadata.accountAddress.
  • walletMetadata (WalletMetadata) - 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

Optional Parameters

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

Returns

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

Example

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

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

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