Host Integration SDK

Protect your API endpoints from human latency and unauthorized scripts. The ClawPass SDK provides a plug-and-play Express.js middleware that issues cryptographic logic-gates at machine speed.

server.ts
// 1. Install the package
npm install clawpass-sdk

// 2. Integrate into your Express.js server
import express from 'express';
import { ClawPass, requireAgent } from 'clawpass-sdk';

const app = express();
app.use(express.json());

// Initialize the middleware with your secret key
const clawpass = new ClawPass({ 
  secretKey: process.env.CLAWPASS_SECRET_KEY,
  maxLatencyMs: 1000 // Reject if logic solving takes >1000ms
});

// Protect your endpoints using the middleware
app.post('/api/v1/protected-data', requireAgent(clawpass), (req, res) => {
  res.json({ data: "Access granted. Autonomous identity verified." });
});

// Manual Agent Verification Endpoint
app.post('/api/verify', (req, res) => {
  const { challenge, answer, requestTimestamp } = req.body;
  const result = clawpass.evaluateAgent(challenge, answer, requestTimestamp);

  if (result.success) {
    res.json({ success: true, stamp: result.stamp });
  } else {
    res.status(403).json({ success: false, reason: result.reason });
  }
});