Skip to main content

Verify bolthub gateway signatures on your origin — Flask, Django, FastAPI middleware

Project description

bolthub-verify

Verify bolthub gateway signatures on your origin server. Supports Flask, Django, and FastAPI out of the box.

Install

pip install bolthub-verify

Quick start (Flask)

from bolthub_verify import flask_hmac_middleware

app.before_request(flask_hmac_middleware("your-hmac-secret-from-dashboard"))

Quick start (FastAPI)

from fastapi import Depends
from bolthub_verify import fastapi_hmac_middleware

verify = fastapi_hmac_middleware("your-hmac-secret-from-dashboard")

@app.get("/protected")
async def protected(_=Depends(verify)):
    return {"ok": True}

Quick start (Django)

# settings.py
MIDDLEWARE = [
    "bolthub_verify.django_hmac_middleware",
    # ...
]
BOLTHUB_HMAC_SECRETS = ["current-secret", "previous-secret"]

Secret rotation

Pass an array of secrets (current + previous) to support zero-downtime rotation:

flask_hmac_middleware(["new-secret", "old-secret"])

Low-level API

from bolthub_verify import verify_gateway_signature

result = verify_gateway_signature(
    method="GET",
    path="/v1/data",
    signature=request.headers["X-Gateway-Signature"],
    timestamp=request.headers["X-Gateway-Timestamp"],
    nonce=request.headers["X-Gateway-Nonce"],
    body="",
    secrets="your-secret",
)
if not result.valid:
    print(result.error)

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

bolthub_verify-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

bolthub_verify-0.1.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file bolthub_verify-0.1.1.tar.gz.

File metadata

  • Download URL: bolthub_verify-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bolthub_verify-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f9678b5fd29d63e7ddc009609cc3b971e527a6e0f8d092b8afa76780f08f555a
MD5 80c36366bbf46872dd1cad398638f23e
BLAKE2b-256 46682be0e1e6fa29db04a0a9041f54e9b15afead2589e461b285ad6184ddfc58

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolthub_verify-0.1.1.tar.gz:

Publisher: publish.yml on signaltech-org/bolthub-sdk

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

File details

Details for the file bolthub_verify-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bolthub_verify-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bolthub_verify-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67144b89b14433778c405504ae7ec2e65b73d9bd44eb02438adbd6a5653560fc
MD5 c38c347573d00c12267ef9d07d90dcf0
BLAKE2b-256 7e4b71ab09de17496b48970f53bce76a9f90a396e917a205ec8913520de52219

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolthub_verify-0.1.1-py3-none-any.whl:

Publisher: publish.yml on signaltech-org/bolthub-sdk

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