Skip to main content

ASGI middleware for Caracal mandate verification (FastAPI, Starlette, Quart)

Project description

caracalai-asgi

ASGI middleware for Caracal mandate verification. Protects FastAPI, Starlette, Quart, and any other ASGI application with fail-closed verification of Caracal-issued mandates.

Part of Caracal: a security-first authority and delegation system for AI agents.

Install

pip install caracalai-asgi

Use

from caracalai_asgi import CaracalASGIAuth
from caracalai_revocation import InMemoryRevocationStore
from fastapi import FastAPI

app = FastAPI()
app.add_middleware(
    CaracalASGIAuth,
    audience="resource://billing-api",
    revocations=InMemoryRevocationStore(),
    routes={"/payouts": {"required_scopes": ["billing:payout"], "require_delegation": True}},
    exclude=["/healthz"],
)

The issuer defaults to CARACAL_STS_URL and the zone to CARACAL_ZONE_ID. Verified claims are available as request.state.caracal.

Links

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

caracalai_asgi-0.1.5.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

caracalai_asgi-0.1.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: caracalai_asgi-0.1.5.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for caracalai_asgi-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c6cfdaaf85348ecd0e035dc093bb5f2285a7e45e90e3450dfe64e39eae921111
MD5 4bdfb2f8d57ce6431a0628f65748319e
BLAKE2b-256 2483d3b8634ef3eda798581f426dfc53f05a0e61c13f0163b2f47f53d586936c

See more details on using hashes here.

Provenance

The following attestation bundles were made for caracalai_asgi-0.1.5.tar.gz:

Publisher: publishPypi.yml on Garudex-Labs/caracal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: caracalai_asgi-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for caracalai_asgi-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aa03f1e5c49efdd5dcb660ee7d8ba2306a4432e29b795ce442dddaf55ed4d72b
MD5 c835dcc836eed547cabb0036888063dc
BLAKE2b-256 a32ba175bfaa67dae70ea7715e9545b0b8d8511f50b890ffe3a8ab75e5b7f154

See more details on using hashes here.

Provenance

The following attestation bundles were made for caracalai_asgi-0.1.5-py3-none-any.whl:

Publisher: publishPypi.yml on Garudex-Labs/caracal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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