Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getpara.com/llms.txt

Use this file to discover all available pages before exploring further.

The useExportPrivateKey hook returns a URL where the user can reauthenticate and view their private key. On React Native, you open this URL in the system browser or an in-app browser.

Integration

import { useExportPrivateKey, useWallet } from "@getpara/react-native-wallet";
import { Button, Alert, Linking } from "react-native";

export function ExportKeyButton() {
  const { data: wallet } = useWallet();
  const { exportPrivateKeyAsync, isPending } = useExportPrivateKey();

  const handleExport = async () => {
    try {
      const { url } = await exportPrivateKeyAsync({
        walletId: wallet?.id,
      });

      if (url) {
        const canOpen = await Linking.canOpenURL(url);
        if (canOpen) {
          await Linking.openURL(url);
        } else {
          Alert.alert("Error", "Unable to open export URL");
        }
      }
    } catch (err) {
      console.error("Failed to export private key:", err);
      Alert.alert("Error", "Failed to initiate private key export");
    }
  };

  return (
    <Button
      title={isPending ? "Loading..." : "Export Private Key"}
      onPress={handleExport}
      disabled={isPending || !wallet}
    />
  );
}
For a better user experience, consider using expo-web-browser or react-native-inappbrowser-reborn to open the export URL within your app instead of leaving it.

Limitations

Currently, private key export is only available for embedded EVM or Cosmos wallets. Unclaimed pregenerated wallets and guest mode wallets cannot be exported.
After a pregenerated wallet is claimed, it is no longer app-managed and can use the same export flow as other embedded wallets.
The key exported will work as either an EVM or Cosmos private key, depending on what wallet it is imported into.