Function Signature

updatePassword(params: {
  accountAddress: string;
  existingPassword: string;
  newPassword: string;
}): Promise<void>

Description

Updates the password for a specific wallet address. This function requires the existing password for verification and a valid session ID for authentication.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address to update password for (must include 0x prefix)
  • existingPassword (string) - The current wallet password
  • newPassword (string) - The new wallet password

Returns

  • Promise<void> - Resolves when password is successfully updated

Example

import { authenticatedEvmClient } from './client';

const evmClient = await authenticatedEvmClient();

await evmClient.updatePassword({
  accountAddress: '0xYourWalletAddress',
  existingPassword: 'current-password',
  newPassword: 'new-wallet-password',
});

console.log('Password updated successfully');

Error Handling

try {
  await evmClient.updatePassword({
    accountAddress: '0xYourWalletAddress',
    existingPassword: 'current-password',
    newPassword: 'new-wallet-password',
  });
  console.log('Password updated successfully');
} catch (error) {
  if (error.message.includes('invalid password')) {
    console.error('Invalid existing password provided');
  } else {
    console.error('Failed to update password:', error);
  }
}

Security Considerations

  • Password Strength: Use strong, unique passwords
  • Password Storage: Never store passwords in plain text
  • Session Security: Implement proper session management
  • Verification: Always verify the existing password before updating