Documentation Index
Fetch the complete documentation index at: https://policykit.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Lit Client
TheLitClient integrates with Lit Protocol v8 (Naga network) to execute off-chain rule evaluations and produce signed attestations.
Usage
Constructor
LitConfig
| Option | Type | Required | Description |
|---|---|---|---|
network | "naga" | Yes | Lit Protocol network |
litActionCID | string | Yes | CID of the deployed Lit Action |
pkpPublicKey | string | No | PKP public key (auto-provisioned if not set) |
debug | boolean | No | Enable debug logging |
Methods
connect()
Connect to the Lit Protocol network. Must be called before any other method.
Promise<void>
disconnect()
Disconnect from the Lit Protocol network. Should be called when done.
Promise<void>
requestAttestation(params)
Execute the Lit Action to evaluate Tier 3 rules and produce a signed attestation.
| Parameter | Type | Description |
|---|---|---|
params.policyCID | string | IPFS CID of the policy |
params.target | Address | Transaction target address |
params.value | bigint | Transaction ETH value |
params.data | Hex | Transaction calldata |
params.chainId | number | Chain ID for the transaction |
Promise<Attestation>
- Fetches the policy from IPFS
- Evaluates all Tier 3 rules against the transaction
- If all rules pass, threshold-signs an EIP-712
PolicyApproval - Returns the signature and metadata
isConnected()
Check if the client is connected to the Lit network.
boolean
Attestation Format
The attestation uses the EIP-712 typed data standard:Error Handling
| Error | Description |
|---|---|
LitConnectionError | Failed to connect to Lit network |
LitActionError | Lit Action execution failed |
LitAttestationError | Attestation signing failed |
LitTimeoutError | Lit Action exceeded timeout |
Lit Protocol Requirements
To use Tier 3 rules, you need:- Lit Action deployed to IPFS — Install
@policy-kit/lit-actionsand upload the pre-built bundle atbuild/policyEvaluator.action.jsto IPFS to get the CID - PKP (Programmable Key Pair) — Provisioned through Lit Protocol
- Capacity Credits — To pay for Lit network usage
@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.
