Function Signature

encryptKeyShare(params: {
  keyShare: any;
  password: string;
}): Promise<string>

Description

Encrypts a key share with a password. This function provides a way to securely encrypt key shares for storage or transmission.

Parameters

Required Parameters

  • keyShare (any) - The key share to encrypt
  • password (string) - Password for encryption

Returns

  • Promise<string> - The encrypted key share

Example

import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

const encryptedShare = await svmClient.encryptKeyShare({
  keyShare: {
    chainName: 'solana',
    keyShare: '0xYourKeyShare',
  },
  password: 'your-password',
});

console.log('Encrypted share:', encryptedShare);

Error Handling

try {
  const encryptedShare = await svmClient.encryptKeyShare({
    keyShare: {
      chainName: 'solana',
      keyShare: '0xYourKeyShare',
    },
    password: 'your-password',
  });
  console.log('Key share encrypted successfully');
} catch (error) {
  console.error('Failed to encrypt key share:', error);
}