{"id":50982425,"url":"https://github.com/wpank/privy-agent0-provider","last_synced_at":"2026-06-19T15:36:20.573Z","repository":{"id":339378867,"uuid":"1159956138","full_name":"wpank/privy-agent0-provider","owner":"wpank","description":"Privy Agent Wallet provider for using in Agent0 TS SDK","archived":false,"fork":false,"pushed_at":"2026-02-19T11:56:07.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-19T15:59:22.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wpank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-17T11:19:08.000Z","updated_at":"2026-02-19T11:56:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wpank/privy-agent0-provider","commit_stats":null,"previous_names":["wpank/privy-agent0-provider"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wpank/privy-agent0-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpank%2Fprivy-agent0-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpank%2Fprivy-agent0-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpank%2Fprivy-agent0-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpank%2Fprivy-agent0-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpank","download_url":"https://codeload.github.com/wpank/privy-agent0-provider/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpank%2Fprivy-agent0-provider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34538466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-19T15:36:19.711Z","updated_at":"2026-06-19T15:36:20.548Z","avatar_url":"https://github.com/wpank.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# privy-agent0-provider\n\nPrivy agentic wallet provider for the [Agent0 ERC-8004 SDK](https://sdk.ag0.xyz/docs). Register and manage on-chain AI agents without ever touching a raw private key.\n\nYour Ethereum signing key stays in [Privy's secure enclave](https://docs.privy.io/recipes/agent-integrations/agentic-wallets) -- this library gives you an EIP-1193 provider that plugs directly into the Agent0 SDK's `walletProvider` config.\n\n## Install\n\n```bash\nyarn add privy-agent0-provider @privy-io/node viem agent0-sdk\n```\n\n## Quick Start\n\n```ts\nimport { getOrCreateWallet, createPrivyProvider } from 'privy-agent0-provider';\nimport { SDK } from 'agent0-sdk';\n\n// 1. Get or create a Privy wallet (saved to .privy-wallet.json)\nconst wallet = await getOrCreateWallet({\n  privyAppId: process.env.PRIVY_APP_ID!,\n  privyAppSecret: process.env.PRIVY_APP_SECRET!,\n});\n\n// 2. Create an EIP-1193 provider\nconst provider = createPrivyProvider({\n  privyAppId: process.env.PRIVY_APP_ID!,\n  privyAppSecret: process.env.PRIVY_APP_SECRET!,\n  walletId: wallet.walletId,\n  walletAddress: wallet.address as `0x${string}`,\n  authorizationPrivateKey: wallet.authPrivateKey,\n  rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',\n  chainId: 11155111,\n});\n\n// 3. Use it with the Agent0 SDK\nconst sdk = new SDK({\n  chainId: 11155111,\n  rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',\n  walletProvider: provider,\n  ipfs: 'pinata',\n  pinataJwt: process.env.PINATA_JWT!,\n});\n\nconst agent = sdk.createAgent('My Agent', 'Registered with Privy');\nconst tx = await agent.registerIPFS();\nconst { result } = await tx.waitMined();\nconsole.log('Agent ID:', result.agentId);\n```\n\n## API\n\n### `createPrivyProvider(config)`\n\nCreates an EIP-1193 compatible provider for the Agent0 SDK.\n\nSigning operations (`eth_sendTransaction`, `personal_sign`, `eth_signTypedData_v4`) are handled by a viem `WalletClient` backed by Privy's `createViemAccount`. All other RPC calls are proxied to the configured JSON-RPC URL.\n\n**Parameters:** `PrivyProviderConfig`\n\n| Field | Type | Description |\n|---|---|---|\n| `privyAppId` | `string` | Privy App ID |\n| `privyAppSecret` | `string` | Privy App Secret |\n| `walletId` | `string` | Privy wallet ID |\n| `walletAddress` | `` `0x${string}` `` | Ethereum address |\n| `authorizationPrivateKey` | `string` | Base64 PKCS8 P-256 authorization key |\n| `rpcUrl` | `string` | JSON-RPC URL |\n| `chainId` | `number` | Chain ID |\n\n**Returns:** An object with a `request()` method satisfying the Agent0 SDK's `EIP1193Provider` type.\n\n---\n\n### `createPrivyWalletClient(config)`\n\nCreates a viem `WalletClient` backed by a Privy wallet. Useful when you want to use viem directly instead of going through the Agent0 SDK.\n\n**Parameters:** Same `PrivyProviderConfig` as above.\n\n**Returns:** A viem `WalletClient`.\n\n---\n\n### `createWallet(opts)`\n\nCreates a new Ethereum wallet via Privy's API with a fresh P-256 authorization keypair.\n\n**Parameters:** `CreateWalletOptions`\n\n| Field | Type | Description |\n|---|---|---|\n| `privyAppId` | `string` | Privy App ID |\n| `privyAppSecret` | `string` | Privy App Secret |\n\n**Returns:** `Promise\u003cPersistedWallet\u003e`\n\n---\n\n### `getOrCreateWallet(opts, filePath?)`\n\nLoads a wallet from `.privy-wallet.json`, or creates a new one and saves it if the file doesn't exist.\n\n**Parameters:**\n- `opts` — `CreateWalletOptions` (Privy credentials)\n- `filePath` — Optional path to the wallet file (defaults to `.privy-wallet.json`)\n\n**Returns:** `Promise\u003cPersistedWallet\u003e`\n\n---\n\n### `loadWallet(filePath?)`\n\nReads a persisted wallet from disk.\n\n**Returns:** `PersistedWallet | null`\n\n---\n\n### `saveWallet(wallet, filePath?)`\n\nWrites a wallet to disk.\n\n---\n\n### `resolveChain(chainId)`\n\nMaps a chain ID to a viem `Chain` object. Supports Ethereum mainnet (1), Sepolia (11155111), and Base (8453).\n\n## How It Works\n\n```\nYour server                     Privy                        Ethereum\n─────────────────────────────────────────────────────────────────────\n                                                              \n  authorizationPrivateKey ──▶  Privy API verifies the        \n  (P-256, NOT an ETH key)      authorization signature        \n                                       │                      \n                               Secure enclave holds           \n                               the actual ETH private key     \n                                       │                      \n                               Signs the transaction ──────▶  Network\n```\n\n- The **authorization key** (P-256) proves your server is allowed to request signatures\n- The **Ethereum private key** (secp256k1) never leaves Privy's enclave\n- You can attach **policies** in the Privy Dashboard to restrict what the wallet can do\n\n## Examples\n\nCopy `.env.example` to `.env` and fill in your credentials, then:\n\n```bash\n# Auto-create wallet on first run\nyarn example:auto\n\n# Use an existing wallet from env vars\nyarn example:existing\n```\n\nSee [`examples/`](examples/) for the full source.\n\n## Environment Variables\n\n| Variable | Required | Description |\n|---|---|---|\n| `PRIVY_APP_ID` | Yes | From Privy Dashboard |\n| `PRIVY_APP_SECRET` | Yes | From Privy Dashboard |\n| `PRIVY_WALLET_ID` | For `existing` example | Wallet ID from Dashboard |\n| `PRIVY_WALLET_ADDRESS` | For `existing` example | Wallet's Ethereum address |\n| `PRIVY_AUTH_PRIVATE_KEY` | For `existing` example | Base64 PKCS8 P-256 key |\n| `PINATA_JWT` | For examples | Pinata JWT for IPFS uploads |\n| `RPC_URL` | No | Defaults to public Sepolia endpoint |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpank%2Fprivy-agent0-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpank%2Fprivy-agent0-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpank%2Fprivy-agent0-provider/lists"}