Function Signature

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

Description

Decrypts an encrypted key share using the provided password. This function is used to recover key shares that were previously encrypted.

Parameters

Required Parameters

  • keyShare (string) - The encrypted key share to decrypt
  • password (string) - Password for decryption

Returns

  • Promise<any> - The decrypted key share

Example

import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

const decryptedShare = await svmClient.decryptKeyShare({
  keyShare: 'encrypted-key-share-string',
  password: 'your-password',
});

console.log('Decrypted share:', decryptedShare);

Error Handling

try {
  const decryptedShare = await svmClient.decryptKeyShare({
    keyShare: 'encrypted-key-share-string',
    password: 'your-password',
  });
  console.log('Key share decrypted successfully');
} catch (error) {
  if (error.message.includes('invalid password')) {
    console.error('Invalid password for decryption');
  } else {
    console.error('Failed to decrypt key share:', error);
  }
}