> ## 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.

# reshare

> Reshares a wallet with a new threshold signature scheme

## Function Signature

```typescript theme={"system"}
reshare(params: {
  chainName: string;
  accountAddress: string;
  oldThresholdSignatureScheme: ThresholdSignatureScheme;
  newThresholdSignatureScheme: ThresholdSignatureScheme;
  walletMetadata: WalletMetadata;
  password?: string;
  externalServerKeyShares?: ServerKeyShare[];
  backUpToDynamic?: boolean;
}): Promise<{
  externalServerKeyShares: ServerKeyShare[];
  backupInfo: KeyShareBackupInfo;
}>
```

## Description

Reshares a wallet with a new threshold signature scheme (e.g. 2-of-2 → 2-of-3). Returns the new shares plus an updated `backupInfo`. **Re-cache the `backupInfo`** into your stored `walletMetadata.externalServerKeySharesBackupInfo` or subsequent operations will read stale metadata. The new `thresholdSignatureScheme` should also be merged into your cached `walletMetadata`.

## Parameters

### Required Parameters

* **`chainName`** (`string`) - The chain name (e.g., `'EVM'`)
* **`accountAddress`** (`string`) - The wallet address (must include `0x` prefix). Must match `walletMetadata.accountAddress`.
* **`oldThresholdSignatureScheme`** (`ThresholdSignatureScheme`) - The current threshold scheme
* **`newThresholdSignatureScheme`** (`ThresholdSignatureScheme`) - The new threshold scheme
* **`walletMetadata`** ([`WalletMetadata`](/node/reference/types/wallet-metadata)) - The cached metadata for this wallet

### Optional Parameters

* **`password`** (`string`) - **Required when `backUpToDynamic` is `true`.**
* **`externalServerKeyShares`** ([`ServerKeyShare[]`](/node/reference/types/server-key-share)) - Current plaintext shares. If omitted, the SDK recovers from backup using `password`.
* **`backUpToDynamic`** (`boolean`) - Whether to back up the new shares. Defaults to `false`.

## Returns

* **`Promise<{ externalServerKeyShares, backupInfo }>`**
  * `externalServerKeyShares` — The newly-generated shares under the new threshold scheme. Re-vault these.
  * `backupInfo` ([`KeyShareBackupInfo`](/node/reference/types/key-share-backup-info)) — Updated backup-pointer state. Merge into cached `walletMetadata`.

## Available Threshold Schemes

* **`TWO_OF_TWO`** - Requires both shares to sign
* **`TWO_OF_THREE`** - Requires any two of three shares to sign

## Example

```typescript theme={"system"}
import { authenticatedEvmClient } from './client';
import { ThresholdSignatureScheme } from '@dynamic-labs-wallet/node';

const evmClient = await authenticatedEvmClient();

const walletMetadata = JSON.parse(await redis.get(`wallet:${accountAddress}`));
const externalServerKeyShares = await vault.read(`wallet:${accountAddress}/shares`);

const { externalServerKeyShares: newShares, backupInfo } = await evmClient.reshare({
  chainName: 'EVM',
  accountAddress,
  oldThresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  newThresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_THREE,
  walletMetadata,
  externalServerKeyShares,
  password: 'user-password',
  backUpToDynamic: true,
});

// Re-cache: new threshold scheme + new backupInfo, plus new shares to vault.
const updatedMetadata = {
  ...walletMetadata,
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_THREE,
  externalServerKeySharesBackupInfo: backupInfo,
};
await redis.set(`wallet:${accountAddress}`, JSON.stringify(updatedMetadata));
await vault.write(`wallet:${accountAddress}/shares`, newShares);
```

## Error Handling

```typescript theme={"system"}
try {
  const result = await evmClient.reshare({ /* ... */ });
  console.log('Wallet reshared successfully');
} catch (error) {
  console.error('Failed to reshare wallet:', error);
}
```

## Related

* [`WalletMetadata`](/node/reference/types/wallet-metadata) - The metadata object passed to every operation
* [`createWalletAccount()`](/node/reference/evm/create-wallet-account) - Create new wallet with threshold scheme
* [`refreshWalletAccountShares()`](/node/reference/evm/refresh-wallet-account-shares) - Refresh shares without changing threshold
