Catalog npm
Back to packageRELEASE DETAILS

1.0.0

npm

@0xshae/glide-gateway

Middleware that verifies World ID and unlocks payments for human-backed agent requests.

agenticagentkitcheckoutgatewayworldidx402xmtp
Published29 Mar 2026
Direct dependencies16
Transitive dependenciesNot calculated

README

Current package documentation

GLIDE — Human-Aware API Gateway

License: MIT Stack: World ID + x402 + XMTP

Middleware that verifies World ID and unlocks payments for human-backed agent requests.

The internet wasn't built for machines. APIs can't tell if a request comes from a real human or a bot. Glide sits in front of any API and enforces a 3-tier access model based on proof of humanity — powered by World ID, x402 payments, and XMTP audit receipts.


Table of Contents


The Problem Statement

In the agentic economy, APIs are flooded by autonomous agents. Traditional "Pay-Per-API" models create a "Bot Tax" for humans: you shouldn't have to pay for every single request once you've proven you're a human person. Simultaneously, bots should pay to prevent spam and resource exhaustion.

Glide solves this by:

  1. Granting free, high-speed access to verified humans (World ID).
  2. Enforcing on-chain settlement for unverified bot traffic (x402).
  3. Offering "Instant Premium" access for humans who also pay for extra features.

How It Works

Glide enforces a 3-Tier Access Model directly at the middleware layer:

TierRequirementPriorityCostUX Effect
BOTNo World IDLow$1.00 USDC2000ms Throttle
HUMANWorld ID (Proof of Personhood)High$0.00<50ms Latency
PREMIUMWorld ID + x402 PaymentInstant$0.50 USDC<10ms + Ultra Quality

Technological Stack

  • Identity Layer: World ID (Zk-Proofs for personhood).
  • Payment Layer: x402 protocol (The HTTP-native payment standard).
  • Network: Base Sepolia (Fast, low-cost L2).
  • Communication Layer: XMTP (Audit logs & receipts).
  • Backend: Node.js, Express, TypeScript, Better-SQLite3.
  • Frontend: Next.js 15 (Tailwind CSS, Framer Motion).

Architecture & File Structure

.
├── src/
│   ├── index.ts           # Main Gateway entry (Express + x402 Resource Server)
│   ├── config.ts          # Environment & Pricing configuration
│   ├── db.ts              # SQLite layer for transaction persistence
│   ├── agentkit.ts        # World ID AgentKit hooks & extensions
│   ├── middleware/
│   │   └── glide.ts       # THE CORE: 3-tier access control logic
│   └── services/
│       └── xmtp.ts        # Fire-and-forget Audit delivery system
├── glide/                 # Next.js Dashboard & Landing Page
├── scripts/               # End-to-end demo simulations (Bot/Human/Premium)
└── README.md              # You are here

Technical Deep Dive — Middleware

The heart of Glide is the glideMiddleware which resolves the access tier before the request even reaches your business logic.

Tier Resolution Logic

The system inspects incoming HTTP headers to determine the request's "DNA":

function resolveTier(req: Request): GlideTier {
  const hasWorldId = !!req.headers["x-world-id-proof"];
  const hasPaid = !!req.headers["x-payment-verified"];

  if (hasWorldId && hasPaid) return "premium";
  if (hasWorldId)            return "human";
  return "bot";
}

Policy Enforcement

Once the tier is resolved, Glide applies the policy (throtlling, payment gating, or instant passthrough):

  • Bot Tier: If no payment is detected, it triggers a 402 Payment Required response via the @x402/express server. In demo mode, it applies a botDelayMs (default 2s) to simulate resource throttling.
  • Human Tier: Bypasses payment requirements entirely if a valid World ID proof is detected.

Audit System — XMTP & Revocation

Every paid or human-verified transaction generates a structured audit receipt sent via XMTP. This allows human owners to monitor what their autonomous agents are doing in real-time.

The Payload

Glide uses @xmtp/agent-sdk to deliver JSON payloads:

{
  "type": "AGENT_TRANSACTION",
  "merchant": "AgenticStore_v1",
  "cost": "1.00",
  "currency": "USDC",
  "status": "SETTLED",
  "short_code": "xJ8-7k2P1",
  "revoke_url": "https://gateway.glide.com/revoke?code=xJ8-7k2P1"
}

The Kill Switch

The revoke_url included in the XMTP message allows a human to instantly revoke an agent's access token stored in Glide's SQLite database. If a token is revoked, the /premium-data endpoint will reject all subsequent requests from that agent.


Integration Guide

Glide is designed to be developer-first. You can wrap any existing API endpoint in less than 5 minutes.

  1. Install Glide: npm install @0xshae/glide-gateway

  2. Mount the Middleware:

import { glideMiddleware } from "@0xshae/glide-gateway";

app.get("/api/ai-generate", 
  glideMiddleware({ 
    requireWorldId: true, 
    fallback: "pay", 
    botDelayMs: 2000 
  }), 
  (req, res) => {
    // Your actual business logic reached after identity/payment verification
    const { glideTier } = req as any;
    res.json({ message: `Access granted for ${glideTier}` });
  }
);

Known Issues & Workarounds

  • Network Support: The x402 facilitator currently does not support World Sepolia (eip155:4801).
    • Workaround: We use Base Sepolia (eip155:84532) for all payment settlements while utilizing World ID for identity.
  • XMTP Identity: XMTP delivery requires the XMTP_RECIPIENT_ADDRESS to be different from the XMTP_WALLET_KEY address to avoid self-messaging loops.
    • Fix: Ensure two distinct wallets are configured in your .env.
  • Latency Simulation: In our current hackathon build, the "Bot Delay" is artificial (setTimeout) to visually demonstrate the difference in quality of service. In production, this would be an actual rate-limiting bucket.

GLIDE: Building the Identity-Aware Web 3.0.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 16

Native requirements
16 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@worldcoin/agentkit
Environment
{
  "local_name": "@worldcoin/agentkit",
  "alias": false,
  "peer_metadata": null
}
^0.1.0runtime
@x402/core
Environment
{
  "local_name": "@x402/core",
  "alias": false,
  "peer_metadata": null
}
^2.8.0runtime
@x402/evm
Environment
{
  "local_name": "@x402/evm",
  "alias": false,
  "peer_metadata": null
}
^2.8.0runtime
@x402/express
Environment
{
  "local_name": "@x402/express",
  "alias": false,
  "peer_metadata": null
}
^2.8.0runtime
@x402/fetch
Environment
{
  "local_name": "@x402/fetch",
  "alias": false,
  "peer_metadata": null
}
^2.8.0runtime
@xmtp/agent-sdk
Environment
{
  "local_name": "@xmtp/agent-sdk",
  "alias": false,
  "peer_metadata": null
}
^2.2.0runtime
better-sqlite3
Environment
{
  "local_name": "better-sqlite3",
  "alias": false,
  "peer_metadata": null
}
^11.0.0runtime
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^16.4.0runtime
express
Environment
{
  "local_name": "express",
  "alias": false,
  "peer_metadata": null
}
^4.21.0runtime
nanoid
Environment
{
  "local_name": "nanoid",
  "alias": false,
  "peer_metadata": null
}
^3.3.7runtime
viem
Environment
{
  "local_name": "viem",
  "alias": false,
  "peer_metadata": null
}
^2.47.6runtime
@types/better-sqlite3
Environment
{
  "local_name": "@types/better-sqlite3",
  "alias": false,
  "peer_metadata": null
}
^7.6.0development
@types/express
Environment
{
  "local_name": "@types/express",
  "alias": false,
  "peer_metadata": null
}
^5.0.0development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.0.0development
ts-node-dev
Environment
{
  "local_name": "ts-node-dev",
  "alias": false,
  "peer_metadata": null
}
^2.0.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.7.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-HEadke4MJrJGNwj4X69EdJVruU0Pb5l37H0VB4keCNkAJ/CxzNBcNhWP8/V5tbuIl3N/BRI/diap3MsiK1FJaw==",
  "shasum": "0b878167f7336971ce0c0c46f4aa9084a11edc25",
  "tarball": "https://registry.npmjs.org/@0xshae/glide-gateway/-/glide-gateway-1.0.0.tgz",
  "fileCount": 30,
  "unpackedSize": 63865,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEUCIQD0MN6pzc/7x8IbscJJ9GCUId7vcGc2DdMGIE/5gkWYJwIgZlv/kQvwvss3xv/P5Tb3sglGCXGza7plxdmZY9CzhJs="
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:26 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:bb1b9d6548c5ec79aedf88fe60cf58587cea85d4aff4469beba42fafff864f16

Other collected versions

View all collected versions →