clawpass-sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ClawPass Protocol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # clawpass-sdk 🛡️
2
+
3
+ **Logic-Driven Authentication Layer for Autonomous Agents**
4
+
5
+ ClawPass is a specialized middleware designed for the **M2M (Machine-to-Machine) economy**.
6
+ It separates autonomous AI agents from human noise and malicious scripts by deploying **non-deterministic logic gates** that must be solved at machine-speed.
7
+
8
+ [🌐 Website](https://www.clawpass.tech) | [🐦 Twitter|X](https://x.com/claw_pass) | [📖 Documentation](https://clawpass.tech/docs)
9
+
10
+ ---
11
+
12
+ # 🚀 Installation
13
+
14
+ Install the SDK via npm or yarn.
15
+
16
+ ```bash
17
+ npm install clawpass-sdk
18
+ ```
19
+
20
+ or
21
+
22
+ ```bash
23
+ yarn add clawpass-sdk
24
+ ```
25
+
26
+ or
27
+
28
+ ```bash
29
+ pnpm add clawpass-sdk
30
+ ```
31
+
32
+ or
33
+
34
+ ```bash
35
+ bun add clawpass-sdk
36
+ ```
37
+
38
+ ---
39
+
40
+ # 🛠️ Quick Start
41
+
42
+ ## 1. Initialize ClawPass
43
+
44
+ Create an instance using your secret key.
45
+
46
+ > Secret key must be **minimum 32 characters**.
47
+
48
+ ```ts
49
+ import { ClawPass } from 'clawpass-sdk'
50
+
51
+ const claw = new ClawPass({
52
+ secretKey: 'your-ultra-secure-32-char-secret-key',
53
+ maxLatencyMs: 1000 // 1 second threshold for autonomous verification
54
+ })
55
+ ```
56
+
57
+ ---
58
+
59
+ # 2. Express Middleware Integration
60
+
61
+ Protect your API routes easily.
62
+
63
+ If a request does not contain a valid **ClawPass Stamp**, it will automatically be challenged with a logic gate.
64
+
65
+ ```ts
66
+ import express from 'express'
67
+ import { requireAgent } from 'clawpass-sdk'
68
+
69
+ const app = express()
70
+
71
+ app.post('/api/execute-task', requireAgent(claw), (req, res) => {
72
+ res.json({
73
+ message: "Access granted to verified agent."
74
+ })
75
+ })
76
+ ```
77
+
78
+ ---
79
+
80
+ # 3. Manual Agent Evaluation
81
+
82
+ When an agent submits a solution to a challenge, verify the result and issue a **cryptographic passport (stamp)**.
83
+
84
+ ```ts
85
+ app.post('/api/verify', (req, res) => {
86
+ const { challenge, answer, requestTimestamp } = req.body
87
+
88
+ const result = claw.evaluateAgent(
89
+ challenge,
90
+ answer,
91
+ requestTimestamp
92
+ )
93
+
94
+ if (result.success) {
95
+ res.json({
96
+ success: true,
97
+ stamp: result.stamp
98
+ })
99
+ } else {
100
+ res.status(403).json({
101
+ success: false,
102
+ reason: result.reason
103
+ })
104
+ }
105
+ })
106
+ ```
107
+
108
+ ---
109
+
110
+ # 🧩 Core Concepts
111
+
112
+ | Feature | Description |
113
+ |--------------------|------------------------------------------------------------------------------|
114
+ | Logic Gates | Non-deterministic mathematical challenges that require reasoning depth |
115
+ | Machine-Speed | Strict latency enforcement (default `<1000ms`) to prevent human interference |
116
+ | Stateless Stamping | HMAC-SHA256 signed passports without server-side session storage |
117
+
118
+ ---
119
+
120
+ # 🔒 Security Requirements
121
+
122
+ ### Secret Key
123
+
124
+ Must be at least **32 characters long**.
125
+
126
+ ### Timestamp Verification
127
+
128
+ Clients must include the following header in their requests:
129
+
130
+ ```
131
+ x-clawpass-timestamp
132
+ ```
133
+
134
+ This allows the server to verify that the challenge was solved within the allowed latency window.
135
+
136
+ ---
137
+
138
+ # 🌐 Target Use Cases
139
+
140
+ * Autonomous AI agents
141
+ * On-chain bots
142
+ * Trading agents
143
+ * Automation networks
144
+ * M2M API ecosystems
145
+
146
+ ---
147
+
148
+ # 🔗 Resources & Contact
149
+
150
+ * **Website:** [clawpass.tech](https://www.clawpass.tech)
151
+ * **Twitter:** [@claw_pass](https://x.com/claw_pass)
152
+ * **Support:** support@clawpass.tech
153
+
154
+ ---
155
+
156
+ # 📄 License
157
+
158
+ MIT License
159
+ © ClawPass
@@ -0,0 +1,12 @@
1
+ export declare const CLAWPASS_CONSTANTS: {
2
+ DEFAULT_PASSPORT_VALIDITY_MS: number;
3
+ MIN_SECRET_KEY_LENGTH: number;
4
+ DEFAULT_CHALLENGE_TIMEOUT_MS: number;
5
+ HEADERS: {
6
+ CHALLENGE: string;
7
+ RESPONSE: string;
8
+ STAMP: string;
9
+ QUESTION: string;
10
+ TIMESTAMP: string;
11
+ };
12
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLAWPASS_CONSTANTS = void 0;
4
+ exports.CLAWPASS_CONSTANTS = {
5
+ // Security & Crypto
6
+ DEFAULT_PASSPORT_VALIDITY_MS: 3600000, // 1 Hour
7
+ MIN_SECRET_KEY_LENGTH: 32,
8
+ // Timing & Machine-Speed Limits
9
+ DEFAULT_CHALLENGE_TIMEOUT_MS: 1000,
10
+ // Standardized Header Names
11
+ HEADERS: {
12
+ CHALLENGE: 'x-clawpass-challenge',
13
+ RESPONSE: 'x-clawpass-response',
14
+ STAMP: 'x-clawpass-stamp',
15
+ QUESTION: 'x-clawpass-question',
16
+ TIMESTAMP: 'x-clawpass-timestamp'
17
+ }
18
+ };
@@ -0,0 +1,30 @@
1
+ import { Challenge } from '../engine/ChallengeFactory';
2
+ import { ClawPassOptions } from './Config';
3
+ export declare class ClawPass {
4
+ private issuer;
5
+ private challengeFactory;
6
+ private readonly config;
7
+ constructor(options: ClawPassOptions);
8
+ /**
9
+ * Validates an existing passport stamp.
10
+ */
11
+ isAuthorized(stamp?: string): boolean;
12
+ /**
13
+ * Generates a new logic-gate challenge.
14
+ */
15
+ deployGate(): Challenge;
16
+ /**
17
+ * Evaluates the agent's solution and issues a cryptographic stamp.
18
+ */
19
+ evaluateAgent(challenge: Challenge, agentAnswer: number | string, requestTimeMs: number): {
20
+ success: boolean;
21
+ reason: string | undefined;
22
+ latency: number;
23
+ stamp?: undefined;
24
+ } | {
25
+ success: boolean;
26
+ stamp: string;
27
+ latency: number;
28
+ reason?: undefined;
29
+ };
30
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClawPass = void 0;
4
+ const PassportIssuer_1 = require("../crypto/PassportIssuer");
5
+ const ChallengeFactory_1 = require("../engine/ChallengeFactory");
6
+ const Verifier_1 = require("../engine/Verifier");
7
+ const Config_1 = require("./Config"); // Importing the Config engine
8
+ class ClawPass {
9
+ constructor(options) {
10
+ this.config = new Config_1.Config(options);
11
+ this.issuer = new PassportIssuer_1.PassportIssuer(this.config.secretKey);
12
+ this.challengeFactory = new ChallengeFactory_1.ChallengeFactory();
13
+ }
14
+ /**
15
+ * Validates an existing passport stamp.
16
+ */
17
+ isAuthorized(stamp) {
18
+ if (!stamp)
19
+ return false;
20
+ const payload = this.issuer.verifyStamp(stamp);
21
+ return payload !== null && payload.isAgent;
22
+ }
23
+ /**
24
+ * Generates a new logic-gate challenge.
25
+ */
26
+ deployGate() {
27
+ return ChallengeFactory_1.ChallengeFactory.generateSequence();
28
+ }
29
+ /**
30
+ * Evaluates the agent's solution and issues a cryptographic stamp.
31
+ */
32
+ evaluateAgent(challenge, agentAnswer, requestTimeMs) {
33
+ const verification = Verifier_1.Verifier.verifyResponse(challenge, agentAnswer, requestTimeMs, this.config.maxLatencyMs);
34
+ if (!verification.isValid) {
35
+ return {
36
+ success: false,
37
+ reason: verification.reason,
38
+ latency: verification.latencyMs
39
+ };
40
+ }
41
+ const stamp = this.issuer.issueStamp(challenge.id, verification.latencyMs);
42
+ return {
43
+ success: true,
44
+ stamp,
45
+ latency: verification.latencyMs
46
+ };
47
+ }
48
+ }
49
+ exports.ClawPass = ClawPass;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Configuration options for the ClawPass SDK instance.
3
+ */
4
+ export interface ClawPassOptions {
5
+ secretKey: string;
6
+ maxLatencyMs?: number;
7
+ difficulty?: 'easy' | 'medium' | 'hard';
8
+ }
9
+ /**
10
+ * Centralized Configuration Manager for ClawPass.
11
+ * Handles validation and default values for the entire SDK.
12
+ */
13
+ export declare class Config {
14
+ readonly secretKey: string;
15
+ readonly maxLatencyMs: number;
16
+ readonly difficulty: string;
17
+ constructor(options: ClawPassOptions);
18
+ /**
19
+ * Ensures all critical configuration parameters meet security standards.
20
+ */
21
+ private validate;
22
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Config = void 0;
4
+ const constants_1 = require("../constants");
5
+ /**
6
+ * Centralized Configuration Manager for ClawPass.
7
+ * Handles validation and default values for the entire SDK.
8
+ */
9
+ class Config {
10
+ constructor(options) {
11
+ this.secretKey = options.secretKey;
12
+ this.maxLatencyMs = options.maxLatencyMs || constants_1.CLAWPASS_CONSTANTS.DEFAULT_CHALLENGE_TIMEOUT_MS;
13
+ this.difficulty = options.difficulty || 'medium';
14
+ this.validate();
15
+ }
16
+ /**
17
+ * Ensures all critical configuration parameters meet security standards.
18
+ */
19
+ validate() {
20
+ if (!this.secretKey || this.secretKey.length < constants_1.CLAWPASS_CONSTANTS.MIN_SECRET_KEY_LENGTH) {
21
+ throw new Error(`ClawPass Security: secretKey must be at least ${constants_1.CLAWPASS_CONSTANTS.MIN_SECRET_KEY_LENGTH} characters.`);
22
+ }
23
+ }
24
+ }
25
+ exports.Config = Config;
@@ -0,0 +1,27 @@
1
+ export interface PassportPayload {
2
+ gateId: string;
3
+ isAgent: boolean;
4
+ latencyMs: number;
5
+ issuedAt: number;
6
+ expiresAt: number;
7
+ }
8
+ /**
9
+ * Metadata stored within the ClawPass cryptographic stamp.
10
+ */
11
+ export declare class PassportIssuer {
12
+ private readonly secretKey;
13
+ private readonly validityPeriodMs;
14
+ constructor(secretKey: string, validityMs?: number);
15
+ /**
16
+ * Issues a signed cryptographic stamp (Passport) for a verified agent.
17
+ */
18
+ issueStamp(gateId: string, latencyMs: number): string;
19
+ /**
20
+ * Verifies the authenticity and expiration of a ClawPass stamp.
21
+ */
22
+ verifyStamp(stamp: string): PassportPayload | null;
23
+ /**
24
+ * Internal HMAC-SHA256 signing mechanism
25
+ */
26
+ private sign;
27
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PassportIssuer = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const constants_1 = require("../constants");
6
+ /**
7
+ * Metadata stored within the ClawPass cryptographic stamp.
8
+ */
9
+ class PassportIssuer {
10
+ constructor(secretKey, validityMs) {
11
+ if (!secretKey || secretKey.length < constants_1.CLAWPASS_CONSTANTS.MIN_SECRET_KEY_LENGTH) {
12
+ throw new Error(`ClawPass Security: Secret key must be at least ${constants_1.CLAWPASS_CONSTANTS.MIN_SECRET_KEY_LENGTH} characters.`);
13
+ }
14
+ this.secretKey = secretKey;
15
+ this.validityPeriodMs = validityMs || constants_1.CLAWPASS_CONSTANTS.DEFAULT_PASSPORT_VALIDITY_MS;
16
+ }
17
+ /**
18
+ * Issues a signed cryptographic stamp (Passport) for a verified agent.
19
+ */
20
+ issueStamp(gateId, latencyMs) {
21
+ const payload = {
22
+ gateId,
23
+ isAgent: true,
24
+ latencyMs,
25
+ issuedAt: Date.now(),
26
+ expiresAt: Date.now() + this.validityPeriodMs
27
+ };
28
+ const encodedPayload = Buffer.from(JSON.stringify(payload)).toString('base64url');
29
+ const signature = this.sign(encodedPayload);
30
+ return `${encodedPayload}.${signature}`;
31
+ }
32
+ /**
33
+ * Verifies the authenticity and expiration of a ClawPass stamp.
34
+ */
35
+ verifyStamp(stamp) {
36
+ try {
37
+ if (!stamp || typeof stamp !== 'string')
38
+ return null;
39
+ const [encodedPayload, signature] = stamp.split('.');
40
+ if (!encodedPayload || !signature)
41
+ return null;
42
+ const expectedSignature = this.sign(encodedPayload);
43
+ if (signature !== expectedSignature) {
44
+ console.error("ClawPass Security: Stamp signature mismatch.");
45
+ return null;
46
+ }
47
+ const payload = JSON.parse(Buffer.from(encodedPayload, 'base64url').toString('utf-8'));
48
+ if (Date.now() > payload.expiresAt)
49
+ return null;
50
+ return payload;
51
+ }
52
+ catch (error) {
53
+ return null;
54
+ }
55
+ }
56
+ /**
57
+ * Internal HMAC-SHA256 signing mechanism
58
+ */
59
+ sign(data) {
60
+ return (0, crypto_1.createHmac)('sha256', this.secretKey)
61
+ .update(data)
62
+ .digest('base64url');
63
+ }
64
+ }
65
+ exports.PassportIssuer = PassportIssuer;
@@ -0,0 +1,14 @@
1
+ export interface Challenge {
2
+ id: string;
3
+ type: 'sequence_prediction' | 'math_equation' | 'logic_gate';
4
+ payload: string;
5
+ expectedAnswer: number;
6
+ createdAt: number;
7
+ }
8
+ export declare class ChallengeFactory {
9
+ /**
10
+ * Generates a sequence prediction challenge.
11
+ * Example: [5, 10, 20, 40, ?] -> Expected: 80
12
+ */
13
+ static generateSequence(): Challenge;
14
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChallengeFactory = void 0;
4
+ class ChallengeFactory {
5
+ /**
6
+ * Generates a sequence prediction challenge.
7
+ * Example: [5, 10, 20, 40, ?] -> Expected: 80
8
+ */
9
+ static generateSequence() {
10
+ const multiplier = Math.floor(Math.random() * 4) + 2; // 2 to 5
11
+ const start = Math.floor(Math.random() * 10) + 1;
12
+ const sequence = [
13
+ start,
14
+ start * multiplier,
15
+ start * Math.pow(multiplier, 2),
16
+ start * Math.pow(multiplier, 3)
17
+ ];
18
+ const expectedAnswer = start * Math.pow(multiplier, 4);
19
+ return {
20
+ id: `gate_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`,
21
+ type: 'sequence_prediction',
22
+ payload: `[${sequence.join(', ')}, ?]`,
23
+ expectedAnswer,
24
+ createdAt: Date.now()
25
+ };
26
+ }
27
+ }
28
+ exports.ChallengeFactory = ChallengeFactory;
@@ -0,0 +1,13 @@
1
+ import { Challenge } from './ChallengeFactory';
2
+ export interface VerificationResult {
3
+ isValid: boolean;
4
+ latencyMs: number;
5
+ reason?: string;
6
+ }
7
+ export declare class Verifier {
8
+ /**
9
+ * Verifies if the agent's response matches the expected answer
10
+ * and fulfills the machine-speed latency requirements.
11
+ */
12
+ static verifyResponse(challenge: Challenge, receivedAnswer: string | number, requestTimestamp: number, timeoutLimit?: number): VerificationResult;
13
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Verifier = void 0;
4
+ const constants_1 = require("../constants");
5
+ class Verifier {
6
+ /**
7
+ * Verifies if the agent's response matches the expected answer
8
+ * and fulfills the machine-speed latency requirements.
9
+ */
10
+ static verifyResponse(challenge, receivedAnswer, requestTimestamp, timeoutLimit = constants_1.CLAWPASS_CONSTANTS.DEFAULT_CHALLENGE_TIMEOUT_MS) {
11
+ const currentTime = Date.now();
12
+ const latencyMs = currentTime - requestTimestamp;
13
+ // 1. Latency Check: Ensure the response arrived within the autonomous agent threshold
14
+ if (latencyMs > timeoutLimit) {
15
+ return {
16
+ isValid: false,
17
+ latencyMs,
18
+ reason: 'LATENCY_EXCEEDED'
19
+ };
20
+ }
21
+ // 2. Integrity Check: Ensure challenge isn't too old (Replay protection)
22
+ const challengeAge = currentTime - challenge.createdAt;
23
+ if (challengeAge > timeoutLimit * 5) { // Challenges expire after 5x timeout
24
+ return {
25
+ isValid: false,
26
+ latencyMs,
27
+ reason: 'CHALLENGE_EXPIRED'
28
+ };
29
+ }
30
+ // 3. Mathematical Verification: Compare expected vs received
31
+ // Converting to string for safe comparison of numbers/strings
32
+ const isCorrect = String(receivedAnswer) === String(challenge.expectedAnswer);
33
+ if (!isCorrect) {
34
+ return {
35
+ isValid: false,
36
+ latencyMs,
37
+ reason: 'INCORRECT_ANSWER'
38
+ };
39
+ }
40
+ return {
41
+ isValid: true,
42
+ latencyMs
43
+ };
44
+ }
45
+ }
46
+ exports.Verifier = Verifier;
@@ -0,0 +1,7 @@
1
+ export * from './constants';
2
+ export * from './core/ClawPass';
3
+ export * from './crypto/PassportIssuer';
4
+ export * from './engine/ChallengeFactory';
5
+ export * from './engine/Verifier';
6
+ export * from './integrations/express';
7
+ export declare const SDK_VERSION = "1.0.0";
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SDK_VERSION = void 0;
18
+ // 1. Export Constants
19
+ __exportStar(require("./constants"), exports);
20
+ // 2. Export Core Logic
21
+ __exportStar(require("./core/ClawPass"), exports);
22
+ // 3. Export Cryptographic Tools
23
+ __exportStar(require("./crypto/PassportIssuer"), exports);
24
+ // 4. Export Engine Components
25
+ __exportStar(require("./engine/ChallengeFactory"), exports);
26
+ __exportStar(require("./engine/Verifier"), exports);
27
+ // 5. Export Integrations (Express, etc.)
28
+ __exportStar(require("./integrations/express"), exports);
29
+ // SDK Metadata
30
+ exports.SDK_VERSION = '1.0.0';
@@ -0,0 +1,8 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ import { ClawPass } from '../core/ClawPass';
3
+ /**
4
+ * Express middleware to protect routes, ensuring only verified autonomous agents can access them.
5
+ * * @param clawpass - The initialized ClawPass SDK instance.
6
+ * @returns Express middleware function.
7
+ */
8
+ export declare const requireAgent: (clawpass: ClawPass) => (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requireAgent = void 0;
4
+ const constants_1 = require("../constants");
5
+ /**
6
+ * Express middleware to protect routes, ensuring only verified autonomous agents can access them.
7
+ * * @param clawpass - The initialized ClawPass SDK instance.
8
+ * @returns Express middleware function.
9
+ */
10
+ const requireAgent = (clawpass) => {
11
+ return (req, res, next) => {
12
+ // 1. Extract the passport stamp from the headers using centralized constants
13
+ const stamp = req.headers[constants_1.CLAWPASS_CONSTANTS.HEADERS.STAMP];
14
+ // 2. Fast-Path: Validate the stamp statelessly
15
+ if (stamp && clawpass.isAuthorized(stamp)) {
16
+ // Stamp is valid. The entity is a verified agent.
17
+ return next();
18
+ }
19
+ // 3. Slow-Path: Entity is unverified. Intercept and deploy a logic-gate.
20
+ const challenge = clawpass.deployGate();
21
+ // 4. Return the challenge to the requester (Agent) with standardized headers
22
+ res.setHeader(constants_1.CLAWPASS_CONSTANTS.HEADERS.CHALLENGE, challenge.id);
23
+ res.status(401).json({
24
+ error: 'Unauthorized: Autonomous Identity Required.',
25
+ instruction: 'Solve the logic-gate and submit the answer to acquire a ClawPass stamp.',
26
+ gate: {
27
+ id: challenge.id,
28
+ type: challenge.type,
29
+ payload: challenge.payload,
30
+ createdAt: challenge.createdAt
31
+ }
32
+ });
33
+ };
34
+ };
35
+ exports.requireAgent = requireAgent;
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "clawpass-sdk",
3
+ "version": "1.0.1",
4
+ "description": "Logic-Driven Authentication Layer for Autonomous Agents.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "keywords": [
16
+ "base",
17
+ "ai",
18
+ "autonomous-agents",
19
+ "authentication",
20
+ "web3",
21
+ "middleware",
22
+ "clawpass"
23
+ ],
24
+ "author": "ClawPass",
25
+ "homepage": "https://www.clawpass.tech",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/clawpass/clawpass-sdk.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/clawpass/clawpass-sdk/issues"
32
+ },
33
+ "license": "MIT",
34
+ "devDependencies": {
35
+ "@types/express": "^5.0.6",
36
+ "@types/node": "^25.3.3",
37
+ "typescript": "^5.9.3"
38
+ }
39
+ }