This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {randomUUID} from 'node:crypto'; | |
| import {PrivyClient, type AuthorizationContext} from '@privy-io/node'; | |
| import {createPublicClient, http} from 'viem'; | |
| import {mainnet} from 'viem/chains'; // replace with your chain | |
| const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as const; | |
| const privy = new PrivyClient({ | |
| appId: process.env.PRIVY_APP_ID!, | |
| appSecret: process.env.PRIVY_APP_SECRET!, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Headless Wallet Export Script | |
| * | |
| * This script exports a Privy embedded wallet's private key using HPKE encryption. | |
| * | |
| * Required dependencies: | |
| * npm install @hpke/core @hpke/chacha20poly1305 @noble/curves @noble/hashes @scure/base axios canonicalize | |
| * | |
| * Usage: | |
| * const privateKey = await exportWalletHeadlessly({ |