Function Signature

offlineExportPrivateKey(params: {
  keyShares: any[];
  derivationPath?: string;
}): Promise<string>

Description

Exports private key offline without requiring server communication. This function is useful for scenarios where you need to export keys without network connectivity.

Parameters

Required Parameters

  • keyShares (any[]) - Array of key shares

Optional Parameters

  • derivationPath (string) - Derivation path for the key (e.g., “m/44’/501’/0’/0’” for Solana)

Returns

  • Promise<string> - The exported private key

Example

import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

const offlinePrivateKey = await svmClient.offlineExportPrivateKey({
  keyShares: [
    {
      chainName: 'solana',
      keyShare: '0xYourKeyShare',
    },
  ],
  derivationPath: "m/44'/501'/0'/0'", // Solana derivation path
});

console.log('Offline Private Key:', offlinePrivateKey);

Error Handling

try {
  const offlinePrivateKey = await svmClient.offlineExportPrivateKey({
    keyShares,
    derivationPath: "m/44'/501'/0'/0'",
  });
  console.log('Offline private key exported successfully');
} catch (error) {
  console.error('Failed to export offline private key:', error);
}