Skip to main content

EEP Gates — Access control, commerce, and service discovery for the Entity Engagement Protocol

Project description

eep-gates (Python)

Python port of @eep-dev/gates — access control, commerce negotiation, and service discovery for the Entity Engagement Protocol.

Install

pip install -e .

Usage

from eep_gates import (
    parse_gate_config,
    resolve_access,
    build_402_response,
    ProofVerifier,
    ProofVerifierRegistry,
)

# Parse gate config
config = parse_gate_config({
    "default_tier": "public",
    "tiers": {
        "public": {"requirements": [], "access": ["events.*"]},
        "premium": {
            "requirements": [{"type": "payment", "amount": 10, "currency": "usd", "per": "month"}],
            "access": ["*"],
        },
    },
})

# Resolve access
class PaymentVerifier(ProofVerifier):
    @property
    def supported_types(self):
        return ["payment"]

    async def verify(self, proof, requirement):
        return proof.get("type") == "payment" and bool(proof.get("token"))


registry = ProofVerifierRegistry()
registry.register(PaymentVerifier())
result = await resolve_access(proofs, config, "content.papers", verifier_registry=registry)

if not result.granted:
    resp = await build_402_response(config, "content.papers", proofs)
    return JSONResponse(resp, status_code=402)

Modules

Module Description
models Pydantic data models (requirements, proofs, tiers, commerce)
gate_config Parse, validate, and serialize gate configurations
resource_matcher Wildcard pattern matching for access control
access_resolver Determine tier access from proofs
proof_validator Structural validation + verifier registry
http_402 Build spec-compliant 402 responses
commerce Negotiation state machine + pricing validation
service_listing Service catalog and review validation

Tests

pip install -e ".[dev]"
pytest

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eep_gates-0.1.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eep_gates-0.1.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file eep_gates-0.1.0.tar.gz.

File metadata

  • Download URL: eep_gates-0.1.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for eep_gates-0.1.0.tar.gz
Algorithm Hash digest
SHA256 841c40bf9dc9ff80650acde0cc72f128e6383d70cdf04750001ebfa55cc3a740
MD5 bda475f553531ccbee017b80a38aa272
BLAKE2b-256 33cd9b727f7278b942641f68719aac1f3c372cb94dd7ae81c5ac3c5a66cbce15

See more details on using hashes here.

File details

Details for the file eep_gates-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: eep_gates-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for eep_gates-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52ae909da024831cdea5e2d01a18026b7ead0082c71a0559eb0ad86d0fd8a448
MD5 505158e4becad1c672c59d2b43380d97
BLAKE2b-256 21607ec3313eb1549ad59a526726de73c33daa477fdc8e1150ea70cd5bc12c74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page