Skip to main content

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.

Function Signature

updatePassword(params: {
  accountAddress: string;
  walletMetadata: WalletMetadata;
  existingPassword?: string;
  newPassword?: string;
  backUpToDynamic: boolean;
  externalServerKeyShares?: ServerKeyShare[];
}): Promise<{ backupInfo: KeyShareBackupInfo }>

Description

Rotates the password used to encrypt the wallet’s backup shares on Dynamic’s key share service. Returns the updated backupInfo. Merge it into your cached walletMetadata.externalServerKeySharesBackupInfo — otherwise the next signing operation will fail password verification against stale metadata.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address. Must match walletMetadata.accountAddress.
  • walletMetadata (WalletMetadata) - The cached metadata for this wallet
  • backUpToDynamic (boolean) - Whether to back the re-encrypted shares up to Dynamic.

Optional Parameters

  • existingPassword (string) - The current password (required if the wallet is currently password-encrypted)
  • newPassword (string) - The new password. Required when backUpToDynamic is true. Validated upfront before the MPC ceremony runs — passing an empty / missing newPassword with backUpToDynamic: true throws immediately rather than silently downgrading the backup.
  • externalServerKeyShares (ServerKeyShare[]) - Plaintext shares.

Returns

  • Promise<{ backupInfo }> — Merge into cached walletMetadata.

Example

import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

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

const { backupInfo } = await svmClient.updatePassword({
  accountAddress,
  walletMetadata,
  externalServerKeyShares,
  existingPassword: 'old-password',
  newPassword: 'new-password',
  backUpToDynamic: true,
});

const updated = { ...walletMetadata, externalServerKeySharesBackupInfo: backupInfo };
await redis.set(`wallet:${accountAddress}`, JSON.stringify(updated));