Function Signature

verifyPassword(params: {
  accountAddress: string;
  password: string;
  walletOperation: WalletOperation;
}): Promise<void>

Description

Verifies a Solana wallet password for a specific operation. This function is used to authenticate the user before performing password-protected wallet operations.

Parameters

Required Parameters

  • accountAddress (string) - The Solana wallet address to verify password for
  • password (string) - The wallet password to verify
  • walletOperation (WalletOperation) - The wallet operation to verify password for

Returns

  • Promise<void> - Resolves if password is valid, throws error if invalid

Example

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

const svmClient = await authenticatedSvmClient();

await svmClient.verifyPassword({
  accountAddress: 'YourSolanaWalletAddress',
  password: 'your-wallet-password',
  walletOperation: WalletOperation.SIGN_MESSAGE
});

console.log('Password verified successfully');

Available Wallet Operations

  • SIGN_MESSAGE - Message signing operations
  • SIGN_TRANSACTION - Transaction signing operations
  • EXPORT_PRIVATE_KEY - Private key export operations

Error Handling

try {
  await svmClient.verifyPassword({
    accountAddress: 'YourSolanaWalletAddress',
    password: 'your-wallet-password',
    walletOperation: WalletOperation.SIGN_MESSAGE
  });
  console.log('Password verified successfully');
} catch (error) {
  if (error.message.includes('invalid password')) {
    console.error('Invalid password provided');
  } else {
    console.error('Password verification failed:', error);
  }
}