import { type StorageAdapter } from '@lifi/perps-sdk'; import { type Address, type Hex } from 'viem'; /** * Hyperliquid agent keypair — an EVM keypair the user approves (via * `APPROVE_AGENT`) to sign trading actions on their behalf, so each order * does not require a wallet prompt. `privateKey` is a 32-byte EVM hex key. * @public */ export interface HyperliquidAgent { address: Address; privateKey: Hex; } /** * Owns the Hyperliquid agent keypair lifecycle: generate, persist, look up, * and revoke. Keyed per user L1 address. Persisted via the injected * {@link StorageAdapter} (browser `localStorage` by default). * * @security The default adapter encrypts records at rest (AES-GCM-256 via * WebCrypto, keyed by a non-extractable key held in IndexedDB) before writing * ciphertext to `localStorage`, defeating generic storage/disk scanning and raw * key exfiltration. It does not defend against malware targeting this SDK or a * fully compromised page — a same-origin script can still drive this store to * decrypt. Blast radius is limited to agent trading: fund withdrawal still * requires L1 `APPROVE_AGENT` consent that the agent key alone cannot grant. * @public */ export declare class HyperliquidAgentStore { private storage; private cache; constructor(storage?: StorageAdapter); private storageKey; /** * Get the existing agent for a user address. * * @throws {PerpsError} `AgentNotFound` when no agent exists, or * `AgentStorageCorrupt` when a record is present but malformed (so callers * never act on a structurally-invalid keypair, and `getOrCreate` does not * silently overwrite a poisoned-but-recoverable entry). */ get(address: Address): Promise; /** * Get the existing agent for a user address, or create and persist one. * Regenerates only on genuine absence; a malformed stored record surfaces * as `AgentStorageCorrupt` rather than being overwritten with a fresh key. */ getOrCreate(address: Address): Promise; /** Whether an agent exists for the user address. */ has(address: Address): Promise; /** * Remove the agent for a user address. Call when the user revokes agent * authorization. */ remove(address: Address): Promise; /** * Import an existing agent keypair (e.g. restoring from backup or pinning a * specific key) and persist it. */ import(address: Address, privateKey: Hex): Promise; /** Clear the in-memory cache. Does not remove persisted agents. */ clearCache(): void; } //# sourceMappingURL=HyperliquidAgentStore.d.ts.map