veridian-sdk
ASGI middleware for Veridian. It reports each request of your app to the Veridian engine and answers 403 {"error": "blocked"} to any session, IP or user that is on the engine's blocklist.
Install
pip install veridian-sdk
Requires Python 3.12 or newer.
Usage
Works with any ASGI app (FastAPI, Starlette). Wrap the app and tell the middleware who the user and the session are:
import os
from fastapi import FastAPI
from veridian_sdk import VeridianMiddleware
app = FastAPI()
app = VeridianMiddleware(
app,
token=os.environ["VERIDIAN_TOKEN"],
base_url=os.environ["VERIDIAN_URL"],
user_id=lambda request: request.state.user_id if hasattr(request.state, "user_id") else None,
session_id=lambda request: request.cookies.get("sid"),
trusted_proxies=0,
)
user_idandsession_idare callables that take a StarletteRequestand return a string orNone. They run before the app (to enforce the blocklist) and again after it (the app may have just logged the user in). Requests with no user are not reported.- Pass a hash of the session cookie as
session_id, never the cookie itself. trusted_proxiesis the number of your own proxies in front of the app. With0the connection IP is used andX-Forwarded-Foris ignored, because any client can write it.exclude_paths(default("/static",)) lists path prefixes that pass straight through with no event and no blocklist check.
What is sent
One event per request, sent in the background in batches: id, ts, user_id, session_id, ip, user_agent (first 200 characters), device_id, method, route (the route template, for example /items/{item_id}), status and bytes.
The middleware also sets its own device cookie (vrd_did) in the user's browser.
What is never sent
Request and response bodies, and passwords, are never read into events.
Fail-open
If the engine is slow or down, your app is not delayed or broken: the middleware keeps using the last blocklist it knew.
License
MIT. See LICENSE.
Metadata
Release files for veridian-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| veridian_sdk-0.1.0.tar.gz | 6.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| veridian_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / veridian_sdk-0.1.0.tar.gz
| Download URL | veridian_sdk-0.1.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1990ea1bc9f898b65a4035cf35cd82dc74cbaf21cd7c81bfe336b202638686f
|
|
BLAKE2b-256 checksum How to use checksums |
6e7f16b9e7e1d9b039272bb2c19bfb819787217b5c311ad3e4aa59e87a737a70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / veridian_sdk-0.1.0-py3-none-any.whl
| Download URL | veridian_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a89580fb297db164f0db21a3cb1236a2394f0c6be0ca3a6bf5789880809ab540
|
|
BLAKE2b-256 checksum How to use checksums |
82d6760ec59afb386002e977c91acf447c3471fb9155e07457abea7687f81aaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logSecurity for veridian-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for veridian_sdk-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.