Skip to main content
The Export Key screen allows users to export their wallet’s private key. This screen includes security warnings and confirmation steps to ensure users understand the risks of exposing their private key.
Exporting private keys is a sensitive operation. Users should be warned that anyone with access to their private key has full control of their wallet and funds.

How it works

When a user requests to export their private key:
  1. Your app calls the export key method from the MoonKey SDK
  2. The Export Key screen appears with security warnings
  3. User reviews the warnings and understands the risks
  4. User confirms they want to proceed
  5. The private key is displayed to the user
  6. User can copy the private key for backup or import into another wallet

Triggering the Export Key screen

Use the useExportPrivateKey hook from the MoonKey SDK to trigger the Export Key screen:

Customizing the Export Key screen

You can customize the Export Key screen by passing UI configuration:

Configuration options

string
Custom title text displayed at the top of the Export Key screen.Example:
string
Description text for HD (Hierarchical Deterministic) wallet seed phrase export option.This text explains what an HD seed phrase is and its purpose.Example:
string
Description text for the private key export option.This text explains what the private key is and how it’s used.Example:
string
Warning text emphasizing that private keys should never be shared.This critical security warning is prominently displayed.Example:
string
Text displayed while export options are being loaded.Example:
string
URL to your company logo. Displayed at the top of the Export Key screen.Example:

Security warnings

The Export Key screen displays multiple security warnings to users:
Anyone with access to your private key has complete control over your wallet and all funds in it.
Never share your private key with anyone. MoonKey support will never ask for your private key.
If you choose to store your private key, keep it in a secure location like a password manager or offline storage.
Be cautious of phishing attempts. Only export your key when you initiated the action.

Use cases

Wallet backup

Allow users to backup their wallet for recovery purposes:

Migrate to another wallet

Help users migrate their wallet to another application:

Advanced users self-custody

Provide power users with their private key for self-custody:

Complete example

Here’s a complete example with proper warnings and logging:

User experience flow

1

Trigger export

User clicks button to export their private key.
2

Security warnings

The Export Key screen displays comprehensive security warnings about the risks.
3

User acknowledges risks

User must acknowledge they understand the risks before proceeding.
4

Private key displayed

The private key is displayed on screen, typically with a copy button.
5

User copies key

User copies the private key to store it securely.
6

Confirmation

User confirms they have securely stored the key before closing the screen.

Best practices

Require additional confirmation before showing the Export Key screen:
Keep a security audit log of private key exports:
Provide educational content about key security:
Consider rate limiting exports to prevent abuse:
For sensitive operations, require fresh authentication:
Suggest safer alternatives when appropriate:

Security considerations

Private key export is one of the most sensitive operations in a wallet application. Implement multiple layers of security and education.
For developers:
  1. Multiple confirmations - Require users to confirm multiple times
  2. Clear warnings - Display unmistakable security warnings
  3. Audit logging - Log all export events with timestamps and IP addresses
  4. Rate limiting - Limit how often users can export keys
  5. Re-authentication - Require fresh login before export
  6. User education - Provide resources about key security
  7. Alternative options - Suggest safer backup methods when possible
  8. Compliance - Ensure export functionality meets regulatory requirements
For users: The Export Key screen helps users by:
  • Displaying clear warnings about the risks
  • Explaining what a private key is and why it’s sensitive
  • Requiring explicit confirmation before revealing the key
  • Providing guidance on secure storage
  • Warning against common phishing attempts
Common threats to warn about:
  • Phishing websites that trick users into entering their private key
  • Malicious browser extensions that steal private keys
  • Screen recording malware that captures the displayed key
  • Social engineering where attackers impersonate support
  • Insecure storage like plaintext files or unencrypted notes

Displaying the private key

After user confirmation, the private key should be displayed securely: