Documentation Index
Fetch the complete documentation index at: https://docs.cloud.coinbase.com/llms.txt
Use this file to discover all available pages before exploring further.
function createEvmKeyExportIframe(options: CreateKeyExportIframeOptions): Promise<CreateKeyExportIframeResult>;
Sets up a secure iframe for exporting EVM private keys.
This function handles the communication with a secure iframe that safely
exports EVM private keys to the user’s clipboard without exposing them to the
JavaScript context.
The iframe will be automatically cleaned up when the session expires (status “expired”).
The cleanup function is idempotent, so it’s safe to call it in your teardown code
even if the iframe has already been cleaned up due to expiration.
Parameters
| Parameter | Type | Description |
|---|
options | CreateKeyExportIframeOptions | Configuration options for the EVM key export iframe. |
Returns
Promise<CreateKeyExportIframeResult>
An object containing the iframe element, cleanup function, and theme update function.
Examples
// Using a CSS selector for the container
const { iframe, cleanup } = await createEvmKeyExportIframe({
address: "0x1234...",
target: "#key-export-container",
projectId: "your-project-id",
label: "Copy Private Key",
onStatusUpdate: (status, message) => {
if (status === "success") {
console.log("Key copied!");
} else if (status === "error") {
console.error("Error:", message);
}
}
});
// Later, clean up. Iframe will auto cleanup when it expires.
cleanup();
// Using an HTMLElement container directly
const container = document.getElementById("my-container") as HTMLElement;
const { cleanup, updateTheme } = await createEvmKeyExportIframe({
address: "0x1234...",
target: container,
projectId: "your-project-id",
theme: {
buttonBg: "#0052ff",
buttonText: "#ffffff"
}
});
// Update theme later
updateTheme({ buttonBg: "#ff0000" });