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

# Embedded wallets: backup & recovery

> The React SDK drove keyshare backup and private-key export from its widget screens. In the JavaScript SDK you run the readiness check, the Google Drive backup, and the secure export yourself.

Embedded (WaaS) wallets stay recoverable through a backup of their cryptographic key shares. The React SDK exposed this through widget screens — a "back up your wallet" step and a "reveal private key" view. The JavaScript SDK gives you the same operations as functions and hooks so you can place them in your own settings UI.

Building the backup and export screens is the same in any JavaScript SDK app, so it isn't repeated here: [**Wallet backup & recovery** (Building UI)](/docs/javascript/building-ui/wallet-backup-recovery) covers readiness, the Google Drive backup, and the secure key export with full code. This page is the React→JavaScript translation plus the migration-specific behavior.

## What maps to what

| React SDK                        | JavaScript SDK                                                                                                     |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| widget recovery/backup status    | `getWalletRecoveryState()` / `useGetWalletRecoveryState()`                                                         |
| "back up to Google Drive" screen | `getGoogleDriveBackupReadiness()` → `backupWaasKeySharesToGoogleDrive()` / `useBackupWaasKeySharesToGoogleDrive()` |
| "reveal private key" screen      | `exportWaasPrivateKey()` / `useExportWaasPrivateKey()`                                                             |
| automatic keyshare refresh       | `refreshWaasWalletAccountShares()` / `useRefreshWaasWalletAccountShares()`                                         |

## Migration-specific behavior

* **Readiness is yours to check.** `getWalletRecoveryState({ walletAccount })` returns `walletReadyState` (`'ready'` / `'encrypted'`) and `isPasswordEncrypted` (whether a password protects the share). Prompt to set a password when `isPasswordEncrypted` is `false`, or to unlock when `walletReadyState` is `'encrypted'`, before backing up. `walletReadyState` is a plain string — there's no publicly exported `WalletReadyState` enum.
* **Backup gates on a Google scope check.** A backup spends an [MPC reshare ceremony](/docs/overview/wallets/embedded-wallets/mpc/architecture), so call `getGoogleDriveBackupReadiness()` first: on `status: 'needs-access'` have the user [re-link their Google account](/docs/javascript/authentication-methods/social-linking) to grant the missing Drive scopes (`missingScopes`) before `backupWaasKeySharesToGoogleDrive()`.
* **Export runs in a secure iframe.** `exportWaasPrivateKey()` renders the key inside an SDK-injected iframe in a container you provide — the key never touches your DOM. Pass the wallet password when the project requires one.

<Warning>
  The private key grants full control of the wallet. Only trigger export behind a deliberate user action and never log or copy the value yourself — the secure iframe keeps it out of your application's reach.
</Warning>

## Errors you now own

| Situation                            | What to do                                                                              |
| ------------------------------------ | --------------------------------------------------------------------------------------- |
| Google Drive scopes missing          | `getGoogleDriveBackupReadiness()` returns `'needs-access'` — re-link before backing up. |
| Backup fails after a `'ready'` check | Surface the rejection and let the user retry; the ceremony can fail transiently.        |
| Wrong password on export/refresh     | The call rejects — reprompt for the password.                                           |
| Export container not mounted         | Ensure the `displayContainer` element exists before calling `exportWaasPrivateKey`.     |

## See also

* [Wallet backup & recovery (Building UI)](/docs/javascript/building-ui/wallet-backup-recovery) — the full readiness, backup, and export build
* [Embedded wallets: password & security](/docs/javascript/migrating-from-react/embedded-wallets-password-security) — the password these flows may require
* [Embedded wallets: setup & creation](/docs/javascript/migrating-from-react/embedded-wallets-setup) — creating the wallets you back up
* MFA — recovery codes for account-level authentication
