> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# verifyPassword

> Verifies that a password is correct for the wallet's encrypted backup

## Function Signature

```typescript theme={"system"}
verifyPassword(params: {
  accountAddress: string;
  walletMetadata: WalletMetadata;
  password?: string;
}): Promise<void>
```

## Description

Verifies that the supplied `password` correctly decrypts the wallet's backup. Throws if the password is wrong or the cached metadata is stale (couldn't recover a share to verify against).

If the wallet does not require a password for the current operation, the call returns silently without verifying.

## Parameters

### Required Parameters

* **`accountAddress`** (`string`) - The wallet address (must include `0x` prefix). Must match `walletMetadata.accountAddress`.
* **`walletMetadata`** ([`WalletMetadata`](/node/reference/types/wallet-metadata)) - The cached metadata for this wallet. Must include `externalServerKeySharesBackupInfo`.

### Optional Parameters

* **`password`** (`string`) - The password to verify. If the wallet is password-encrypted and no password is provided, throws `"Password is required for operation but not provided"`.

## Returns

* **`Promise<void>`** - Resolves if the password is correct (or no password was needed). Throws otherwise.

## Example

```typescript theme={"system"}
import { authenticatedEvmClient } from './client';

const evmClient = await authenticatedEvmClient();

const walletMetadata = JSON.parse(await redis.get(`wallet:${accountAddress}`));

await evmClient.verifyPassword({
  accountAddress,
  walletMetadata,
  password: 'user-password',
});

console.log('Password verified successfully');
```

## Error Handling

The error message distinguishes wrong-password from stale-metadata to help diagnose:

```typescript theme={"system"}
try {
  await evmClient.verifyPassword({ accountAddress, walletMetadata, password });
  console.log('Password verified');
} catch (error) {
  if (error.message.includes('Failed to verify password')) {
    // Either the password is incorrect, or the cached
    // walletMetadata.externalServerKeySharesBackupInfo is stale
    // (merge backupInfo from updatePassword/refresh/reshare into cache).
    console.error(error.message);
  } else {
    console.error('Unexpected error:', error);
  }
}
```

## Related

* [`WalletMetadata`](/node/reference/types/wallet-metadata) - The metadata object passed to every operation
* [`requiresPasswordForOperation()`](/node/reference/evm/requires-password-for-operation) - Check whether a password is required
* [`updatePassword()`](/node/reference/evm/update-password) - Rotate the wallet's password
