Skip to content

Privy wallet policies: trade-only, never withdraw #11

Open

Description

@joeblau

Description

Define and attach Privy policies that allow only HL exchange actions (order, cancel, modify, updateLeverage, etc.) and deny withdraw/usdSend/spotSend/transfers and approveAgent. Policy also enforces chain/domain restrictions. Limits from config mirrored where Privy supports them.

Acceptance criteria

  • Policy JSON versioned in repo (policies/agent-trade-only.json)
  • Policy applied on init; policy ID stored in config
  • Attempted withdraw returns POLICY_REJECTED (tested)
  • agent-cli status reports active policy ID/version

Dependencies

Size

M

Activity

  1. joeblau commented on Oct 16, 2026

    @joeblau
    ContributorAuthor

    Implementation merged in #50. The CLI now uses each user's own Privy app, keeps owner authorization locally, attaches the v2 domain/network/no-export policy with owner authorization, verifies policy content on repeated init, and recovers a lost wallet-create/link response. Initialized network/master mismatches are rejected. Tests cover init → attach/persist → status ID/version and local rejection of real withdrawal typed data.

    Keeping this issue open for live evidence: run npm run test:sandbox with a dedicated test Privy app, prove a valid Agent signature succeeds, then prove a direct withdrawal-type signing request returns POLICY_REJECTED. Explicit invocation without credentials fails; it is not a live pass. The sandbox creates an empty wallet/policy for inspection and sends no Hyperliquid transaction.

    Privy cannot inspect the action contents/notional hidden in Hyperliquid's L1 connectionId hash. Local controls and Hyperliquid API-agent permissions enforce those boundaries; neither the versioned policy nor the sandbox is represented as independent per-action/notional enforcement. See docs/custody.md and docs/ACCEPTANCE.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions