npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eep-dev/gates

v0.1.0

Published

General-purpose access control, commerce negotiation, and service discovery for EEP. Defines gates (tier-based access with extensible requirement types), 402 responses, payment proofs, commerce negotiation state machine, and service catalog validation.

Downloads

80

Readme

@eep-dev/gates

Access control, commerce negotiation, and service discovery for the Entity Exchange Protocol.

EEP License Tests


Overview

@eep-dev/gates is the core package of EEP's access control layer. It implements the Gate System defined in the Whitepaper (§3.4, §7, §8) — allowing entity owners to define tiered access requirements and enabling agents to prove eligibility through structured proofs.

Key Capabilities

| Module | Description | Whitepaper | |--------|-------------|------------| | Gate Config | Parse, validate, and serialize gate configurations | §3.4 | | Access Resolution | Determine access tier from proofs + requirements | §3.4 | | Proof Validation | Structural validation, nonce replay prevention, double-spend detection | §10 | | HTTP 402/429 | Build EEP-compliant payment-required and rate-limit responses | §3.4, §9 | | Commerce | State machine for negotiation flows (offer → counter → accept → invoice → paid) | §8 | | Service Listing | Validate service catalogs, listings, and reviews | §15 | | Proof-of-Intent | Validate PoI documents and scope verification | G4 | | Request Headers | Validate EEP-specific request/response headers | G24 |

Installation

npm install @eep-dev/gates

Quick Start

import {
  parseGateConfig,
  resolveAccess,
  build402Response,
  ProofVerifierRegistry,
} from '@eep-dev/gates';

// 1. Parse gate configuration
const config = parseGateConfig(entityGateJson);
if (!config.valid) throw new Error(config.errors.join(', '));

// 2. Register platform-specific proof verifiers
const registry = new ProofVerifierRegistry();
registry.register({
  supportedTypes: ['payment'],
  verify: async (proof, req) => proof.token?.startsWith('tok_'),
});

// 3. Resolve access
const result = await resolveAccess(agentProofs, config.config, 'content.papers', registry);

if (!result.granted) {
  // Build RFC-compliant 402 response with unmet requirements
  const body = await build402Response(config.config, 'content.papers', agentProofs);
  return c.json(body, 402);
}

// Access granted: result.tier contains the matched tier name
console.log(`Access granted at tier: ${result.tier}`);

API Reference

Gate Configuration

// Parse and validate a raw gate config JSON
const { valid, config, errors } = parseGateConfig(rawJson);

// Serialize back to JSON
const json = serializeGateConfig(config);

// Get all requirement types used in config
const types = getUsedRequirementTypes(config); // ['payment', 'trust', ...]

Access Resolution

// Resolve which tier the agent qualifies for
const result = await resolveAccess(proofs, gateConfig, resourcePath, registry);
// result: { granted: boolean, tier?: string, unmet?: UnmetRequirement[] }

resolveAccess() now defaults to strict fail-closed semantic verification.
If no verifier is registered for a requirement type, that requirement is treated as unmet.
For controlled migration scenarios only, you can disable strict mode with:

await resolveAccess(proofs, gateConfig, resourcePath, registry, {
  strictSemanticVerification: false,
});

Proof Validation

// Structural validation (type, required fields)
const structResult = validateProofStructure(proof);

// Register custom verifiers for semantic validation
const registry = new ProofVerifierRegistry();
registry.register({
  supportedTypes: ['payment', 'credential'],
  verify: async (proof, requirement) => { /* platform logic */ },
});

// Nonce replay prevention (G29)
const nonceStore = new InMemoryNonceStore();
const nonceResult = await validateProofWithNonce(proof, nonceStore);

// Double-spend prevention (G32)
const hashStore = new InMemoryPaymentHashStore();
const dsResult = await validatePaymentProofForDoubleSpend(proof, hashStore);

// Multi-chain payment validation (G27)
const chainResult = validatePaymentChain(proof, declaredNetworks);

HTTP Responses

// Build 402 Payment Required response
const body402 = await build402Response(gateConfig, resourcePath, agentProofs);

// Build 429 Rate Limited response
const body429 = build429Response({ retryAfterSeconds: 60, didKey: agentDid });

// Check if a resource path is gated
const isGated = isGatedResource(gateConfig, 'content.papers.full_text');

Commerce State Machine

import { transition, getValidActions, isTerminal } from '@eep-dev/gates';

// Validate a state transition
const result = transition('idle', 'offer');
// { valid: true, from: 'idle', to: 'offer', allowed: [...] }

// Get valid next actions from current state
const actions = getValidActions('offer'); // ['counter', 'accept', 'reject']

// Check if state is terminal
isTerminal('paid');     // true
isTerminal('rejected'); // true
isTerminal('offer');    // false

Service Listing

import { validateServiceListing, validateServiceCatalog, validateReview } from '@eep-dev/gates';

const listingResult = validateServiceListing(listing);
const catalogResult = validateServiceCatalog(catalog);
const reviewResult = validateReview(review);

Request Header Validation (G24)

import { validateRequestHeaders } from '@eep-dev/gates';

const result = validateRequestHeaders(headers);
// Validates: EEP-Version, EEP-DID, EEP-Nonce, EEP-Timestamp

Gate Types

EEP supports these requirement types, extensible via x-* prefix:

| Type | Description | Proof Contains | |------|-------------|----------------| | payment | Payment gate (x402, Stripe, crypto) | token, amount, currency | | trust | Trust score threshold | score, attestation | | identity | Identity verification | method, did_proof | | credential | Verifiable Credential | credential, format | | connection | Social graph / follow | connection_type | | capability | Agent capability check | capabilities[] | | allowlist | Allowlist membership | did | | reciprocal | Mutual subscription | subscription_proof | | data_request | W3C DPV data exchange (§7) | verifiable_presentation | | agreement | License agreement (§8) | license_hash, signature |

Tests

446 tests across 12 test files:

npx vitest run

| Test File | Tests | Coverage | |-----------|-------|----------| | gate-config.test | Config parsing, validation, serialization | | access-resolver.test | Access resolution, tier matching | | proof-validator.test | Structure, nonce, double-spend, headers | | commerce.test | State machine transitions, pricing | | service-listing.test | Catalog, listing, review validation | | security.test | Injection, overflow, boundary checks | | poi.test | Proof-of-Intent validation | | g24-g31.test | Request headers, sessions, wallets, RFP | | bench.test | Performance benchmarks |

License

Apache-2.0 — see LICENSE