Availability
Key export is only available in certain environments depending on how the wallet was created, due to the characteristics of the wallet ownership model.Usage
To have your user export their embedded wallet’s private key, use Privy’s When invoked,
exportWallet
method:exportWallet
will open a modal where your user can copy the full private key for their embedded wallet. The modal will also link your user to a guide for how to load their embedded wallet into another wallet client, such as MetaMask or Phantom.If your user is not authenticated
or has not yet created an embedded wallet in your app, this method will fail.As an example, you might attach exportWallet
to an export wallet button in your app:If your application uses smart wallets on EVM
networks, exporting the wallet will export the private key for the smart wallet’s signer, and
not the smart wallet itself. Users can control their smart wallet via this private key, but will
be required to manually use it to sign calls to the contract for their smart wallet directly to
use the smart wallet outside of your app.
Exporting HD wallets
If your user has multiple embedded wallets, you can export the private key for a specific wallet by passing the address of your desired wallet as anaddress
parameter to the exportWallet
method:When your user exports their embedded wallet, their private key is assembled on a different origin
than your app’s origin. This means neither you nor Privy can ever access your user’s private key.
Your user is the only party that can ever access their full private key.