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

getExternalServerKeyShares(params: {
  accountAddress: string;
  walletMetadata: WalletMetadata;
  password?: string;
  backupInfo?: KeyShareBackupInfo;
}): Promise<ServerKeyShare[]>

Description

Retrieves external server key shares for the wallet by recovering them from backup using the supplied password. Returns the recovered plaintext shares.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address (must include 0x prefix). Must match walletMetadata.accountAddress.
  • walletMetadata (WalletMetadata) - The cached metadata for this wallet

Optional Parameters

  • password (string) - Required if the wallet was created with backUpToDynamic: true
  • backupInfo (KeyShareBackupInfo) - Pre-resolved backup info; if omitted the SDK reads it from walletMetadata

Returns

  • Promise<ServerKeyShare[]> - Array of external server key shares

Example

import { authenticatedEvmClient } from './client';

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

const keyShares = await evmClient.getExternalServerKeyShares({
  accountAddress,
  walletMetadata,
  password: 'user-password',
});

console.log('Key shares retrieved:', keyShares.length);

Error Handling

try {
  const keyShares = await evmClient.getExternalServerKeyShares({
    accountAddress: '0xYourWalletAddress',
  });
  console.log('Key shares retrieved successfully');
} catch (error) {
  console.error('Failed to retrieve key shares:', error);
}