Skip to main content
Recovery methods are set when a wallet is created, but they are not fixed. You can add a recovery method to an existing wallet — for example a backup phone number or a new server key — and remove one the user no longer controls. Every change is approved by one of the wallet’s existing recovery methods, and that approval is enforced onchain. Adding and removing recovery methods is supported on Solana and Stellar. EVM is coming soon; contact support if you would like early access. See Recovery Methods for the concept, and Configure Wallet Recovery for setting recovery methods at creation time.

Prerequisites

  • Wallet: An existing Solana or Stellar wallet with at least one recovery method.
  • API key: An API key with wallets.create and wallets:transactions.create scopes. In staging, all scopes are included by default.

How It Works

Adding or removing a recovery method creates a transaction that one of the wallet’s existing recovery methods must approve. With the SDK, addRecoveryMethod() and removeRecoveryMethod() handle the approval for you: an email or phone method prompts the user for a one-time code, a server method signs with its secret, and an external wallet signs through its onSign callback. Once the transaction confirms, wallet.recoveryMethods reflects the change. With the REST API, you submit the change and then approve the returned transaction yourself.
  • A wallet always keeps at least one recovery method: removing the last one is rejected.
  • A recovery method whose add transaction has not confirmed yet cannot be removed. Adding the same method again returns the in-flight transaction, or starts a new one once it has expired.
  • Only a recovery method can authorize these changes. Operational signers added with addSigner() cannot.
  • On Solana, only Crossmint smart wallets support these operations. On Stellar, removing a recovery method requires the wallet to run the latest contract version.

Select the Authorizing Recovery Method

When a wallet has a single recovery method, the SDK uses it to authorize addSigner(), removeSigner(), addRecoveryMethod(), and removeRecoveryMethod(). When a wallet has several, select the one to authorize with first by calling useRecoveryMethod() with one of the entries in wallet.recoveryMethods; otherwise the operation throws SignerRequiredError. Here, the phone recovery method authorizes adding an email signer:
Pass the full config when the method needs it to sign: the secret for a server method, or the onSign callback for an external wallet.
Passing a config that does not match any entry in wallet.recoveryMethods throws InvalidRecoveryConfigError.
useRecoveryMethod() is experimental and may change in a future release.

Add a Recovery Method

The new method accepts the same configuration objects as recoveryMethods at wallet creation — email, phone, external-wallet, or server. Phone numbers use E.164 format.
For a wallet with a single email recovery method, the user enters the email one-time code to approve the change, and the last line logs ["email", "phone"]. With several recovery methods, call useRecoveryMethod() first.

Remove a Recovery Method

Identify the method to remove with the same configuration object you would pass to useRecoveryMethod(). Any of the wallet’s recovery methods can authorize the removal, as long as at least one method remains afterwards. In the React and React Native examples below, the email method authorizes removing the phone method.

Next Steps

Configure Recovery

Set recovery methods when creating a wallet

List Signers

Inspect the wallet’s signers and recovery methods

Recover a Wallet

Regain access from a new device with a recovery method