Exporting the private key
Enable users to export and backup their wallet private keys
This allows them to use their embedded wallets address with another wallet client, such as Metamask in any application. Note that this embedded wallet is only controlling the smart account and does not hold assets in it. If you want to simply transfer ownership to a Metamask and interact with a smart contract, we'll recommend checking the transfer ownership section.
To have your user export their embedded wallet's private key, use the exportPrivateKey
method from the SDK.
If your user is not authenticated
or has not yet created an embedded wallet in your game, this method will fail.
As an example, you might attach exportPrivateKey
as an event handler to an export wallet button in your app:
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 Openfort can ever access your user's private key. Your user is the only party that can ever access their full private key.