Skip to main content

Lit Client

The LitClient integrates with Lit Protocol v8 (Naga network) to execute off-chain rule evaluations and produce signed attestations.

Usage

Constructor

LitConfig

Methods

connect()

Connect to the Lit Protocol network. Must be called before any other method.
Returns: Promise<void>

disconnect()

Disconnect from the Lit Protocol network. Should be called when done.
Returns: Promise<void>

requestAttestation(params)

Execute the Lit Action to evaluate Tier 3 rules and produce a signed attestation.
Returns: Promise<Attestation>
The Lit Action performs the following:
  1. Fetches the policy from IPFS
  2. Evaluates all Tier 3 rules against the transaction
  3. If all rules pass, threshold-signs an EIP-712 PolicyApproval
  4. Returns the signature and metadata

isConnected()

Check if the client is connected to the Lit network.
Returns: boolean

Attestation Format

The attestation uses the EIP-712 typed data standard:

Error Handling

Lit Protocol Requirements

To use Tier 3 rules, you need:
  1. Lit Action deployed to IPFS — Install @policy-kit/lit-actions and upload the pre-built bundle at build/policyEvaluator.action.js to IPFS to get the CID
  2. PKP (Programmable Key Pair) — Provisioned through Lit Protocol
  3. Capacity Credits — To pay for Lit network usage
The @policy-kit/lit-actions package includes the pre-built action bundle ready for IPFS upload, as well as the source rule implementations in src/rules/ that you can use as reference for custom rules.
The LitClient requires peer dependencies: @lit-protocol/lit-client, @lit-protocol/networks, and @lit-protocol/auth. Install them separately.