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.5rc3.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.5rc3-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: caracalai_asgi-0.1.5rc3.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.5rc3.tar.gz
Algorithm Hash digest
SHA256 8f9cc99191068925f595a0f242f526041e5bce953c7cc1be41c7fe867c88e1ad
MD5 dcadde2dd71eb6bf9c324f0b502edc89
BLAKE2b-256 aba4a71166667cc41b3566812bb757836e93c3197c19255942e88b60f5b47fc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for caracalai_asgi-0.1.5rc3.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.5rc3-py3-none-any.whl.

File metadata

File hashes

Hashes for caracalai_asgi-0.1.5rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 04a0d09215845db0fdb2c32056ca0258cc72d12bc6d3c5126496092e89fa27eb
MD5 27bf681ce0081a60e1fb2b85f152e0a7
BLAKE2b-256 8bbe3a23ba4f1e55289c261bc68e2b5be4342a17b78bbbbbe428cb166d77a888

See more details on using hashes here.

Provenance

The following attestation bundles were made for caracalai_asgi-0.1.5rc3-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