Management API Reference

Wallets

Exporting the embedded signer

This allows them to use their embedded signer address with another wallet client, such as Metamask in any application. Note that this embedded signer 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 signer's private key, use the exportPrivateKey method from the SDK.

If your user is not authenticated or has not yet created an embedded signer in your game, this method will fail.

As an example, you might attach exportPrivateKey as an event handler to an export signer button in your app:

ExportWalletButton.tsx
openfortConfig.ts

_16
import openfort from "./openfortConfig"
_16
_16
// This example assumes you have already checked that Openfort 'embeddedState' is
_16
// `ready` and the user is `authenticated`
_16
function ExportWalletButton() {
_16
const handleExportWalletButton = async () => {
_16
const privateKey = await openfort.exportPrivateKey();
_16
console.log(privateKey);
_16
};
_16
_16
return (
_16
<button onClick={handleExportWalletButton}>
_16
{'Export my wallet'}
_16
</button>
_16
);
_16
}

When your user exports their embedded signer, 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.