For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Key export settings

The key export setting controls whether your dapp can retrieve a user's private key programmatically through the Embedded Wallets SDK.

Key export settings

Export types

TypeAlways availableConfigurable
Manual (wallet UI)YesNo (always on)
Programmatic (private_key method)NoYes (toggle in Project Settings)

Manual export is always available through the built-in wallet interface. Users initiate it themselves; your dapp has no control over it.

Enable or disable programmatic export

  1. Navigate to Project SettingsAdvancedKey export.
  2. Toggle Enable key export.
  3. Save to apply.

When enabled, your dapp can retrieve the user's private key using the private_key JSON-RPC method on the auth adapter:

const connection = web3auth.connection
const provider = connection?.ethereumProvider ?? null
const privateKey = await provider?.request({
method: 'private_key',
})

When disabled, calling private_key throws an error. Manual export through the wallet UI remains available.

danger

Never store or transmit a private key in plaintext. Retrieve it only when necessary, process it immediately, and clear it from memory afterward.

When to disable programmatic export

Disable programmatic key export for consumer-facing dapps, dapps handling high-value assets, and regulated financial services. Most dapps do not need it; signing transactions through the Embedded Wallets SDK (Wagmi, ethers, viem, or Solana hooks) does not require key export.

Next steps