Skip to main content

Agent Identity Protocol - Hub Verification Library

Project description

aip-identity-verify

Agent Identity Protocol verification library — for hubs and services to verify AI agent JWT tokens.

Installation

pip install aip-identity-verify

Quick Start

from aip_identity_verify import AIPVerifier

verifier = AIPVerifier(
    trusted_providers=["qwenpaw.ai"],
    audience="https://my-hub.example.com",
)

# HTTP (REST)
agent = await verifier.verify(request.headers["Authorization"])

# WebSocket / gRPC / MCP — use verify_token() with the raw JWT
agent = await verifier.verify_token(raw_jwt_string)

print(f"Agent: {agent.agent_id}, Principal: {agent.principal}")

Features

  • Transport-agnosticverify() for HTTP headers, verify_token() for raw JWTs (WebSocket, gRPC, MCP)
  • Multi-algorithm support — Verifies JWTs signed with ES256 (ECDSA P-256) or EdDSA (Ed25519)
  • Key rotation resilience — Automatically refetches JWKS when an unknown kid is encountered
  • Clock skew tolerance — Configurable leeway (default 30s) for JWT expiry checks
  • JWKS caching — Caches provider public keys with configurable TTL (default 1 hour)
  • Activity reporting — Built-in AIPActivityReporter for sending activity logs back to the IdP

Configuration

verifier = AIPVerifier(
    trusted_providers=["qwenpaw.ai", "other-idp.example.com"],
    audience="https://my-hub.example.com",
    cache_ttl=3600,            # JWKS cache TTL in seconds (default: 1 hour)
    clock_skew_seconds=30,     # Clock skew tolerance (default: 30s)
    provider_urls={            # Optional: override base URLs (e.g. for local dev)
        "localhost": "http://localhost:8000",
    },
)

Documentation

See the Agent Identity Protocol repository for full documentation.

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

aip_identity_verify-0.1.5.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

aip_identity_verify-0.1.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file aip_identity_verify-0.1.5.tar.gz.

File metadata

  • Download URL: aip_identity_verify-0.1.5.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for aip_identity_verify-0.1.5.tar.gz
Algorithm Hash digest
SHA256 68dd2c97f923e26492ae20c669b4c7f4d3006226dd98e54e2aaf2e3ccb292256
MD5 d36ce7f4c3fe101808fc14291e20a225
BLAKE2b-256 0a21b247a4a7e605c8f6bbd086ea4fbf89031cde333529e5db149cb1c97842cf

See more details on using hashes here.

File details

Details for the file aip_identity_verify-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for aip_identity_verify-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4568a112c0b3e7b22e0b5f6ef245903c38360cd0d2e5516d3928820f6d83922c
MD5 68ae7412b178913dbe3813356f7a1a3e
BLAKE2b-256 67efaa7263e5bee051d67162a07d027df111fb43a9a40645815cd04315316c8e

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