@gvnrdao/lit-ops-server
v0.0.35
Published
HTTP REST service for LIT Protocol operations - handles credits and PKP management
Downloads
291
Readme
@gvnrdao/lit-ops-server
HTTP REST service for LIT Protocol operations - handles credits and PKP management
Description
A production-ready HTTP REST server that manages LIT Protocol operations for the Diamond Hands Protocol. This service handles PKP (Programmable Key Pair) creation, authorization, and LIT Actions execution in a secure, scalable manner.
Installation
npm install @gvnrdao/lit-ops-serverUsage
Basic Server Setup
import { LitOpsServer } from "@gvnrdao/lit-ops-server";
const server = new LitOpsServer({
port: 3001,
network: "datil",
privateKey: process.env.WALLET_PRIVATE_KEY,
debug: true,
});
await server.start();Configuration
Set up environment variables:
# Required
PRIVATE_KEY=0x...
# Chipotle network/API credential required at server startup
LIT_CHIPOTLE_API_KEY=your_chipotle_api_key
# Supported: naga, naga-test, naga-dev (default: naga)
LIT_NETWORK=chipotle
# Lit usage API key for the price-oracle lit-action only (X-Api-Key on POST /core/v1/lit_action).
# Other lit-actions will use their own LIT_ACTION_<name>_API_KEY vars over time.
LIT_ACTION_PRICE_ORACLE_API_KEY=your_lit_usage_key_for_price_oracle
# Lit Core base URL for Chipotle execution (default: hosted dev API)
LIT_CORE_API_BASE_URL=https://api.dev.litprotocol.com
# Set to false to force legacy Naga executeJs for the registry priceOracle CID (not recommended)
# LIT_PRICE_ORACLE_USE_CORE=false
# Exchange / market-data keys are passed by callers as js_params.priceProviders.
# Optional
PORT=3001
DEBUG=trueAPI Endpoints
Health Check
GET /healthPKP Operations
POST /pkp/create
POST /pkp/authorize
POST /pkp/execute-actionRunning the Server
# Development
npm run dev
# Production
npm run build
npm startFeatures
- ✅ REST API: Clean HTTP interface for LIT Protocol operations
- ✅ PKP Management: Secure creation and authorization of PKPs
- ✅ LIT Actions Execution: Execute custom LIT Actions remotely
- ✅ Security: Helmet protection, CORS configuration
- ✅ Logging: Comprehensive Winston-based logging
- ✅ Health Monitoring: Built-in health check endpoints
- ✅ TypeScript: Full type safety and IntelliSense support
API Documentation
Visit http://localhost:3001 when the server is running for interactive API documentation.
Security Considerations
- Always use environment variables for sensitive configuration
- Enable HTTPS in production
- Implement proper authentication for production deployments
- Monitor logs for security events
License
MIT
