Skip to main content

FastAPI SDK adapter for saastore HMAC-signed identity headers

Project description

saastore-fastapi

FastAPI dependency that authenticates incoming requests via HMAC-signed identity headers issued by the saastore edge proxy.

Install

pip install saastore-fastapi

Use

from fastapi import Depends, FastAPI
from saastore_fastapi import SaastoreUser, saastore_user

app = FastAPI()

@app.get("/dashboard")
def dashboard(user: SaastoreUser = Depends(saastore_user)):
    return {"email": user.email, "plan": user.plan}

Environment

Variable Required Description
SAASTORE_HMAC_SECRET Yes Provided by saastore at container provision time. 64-character hex string.

What this rejects

  • Missing identity headers — 401
  • Bad signature — 401
  • Timestamp more than 5 minutes off the container's clock — 401 (configurable freshness window in verify.py)
  • SAASTORE_HMAC_SECRET env var unset — 500 (config error, not auth)

Wire format

See docs/superpowers/specs/2026-05-22-hosted-apps-poc-design.md section 5 in the saastore monorepo. The canonical signature string is user_id|email|plan|timestamp, signed with HMAC-SHA256 and hex-encoded.

Development

From the monorepo root:

cd sdks/saastore-fastapi
uv run --with fastapi --with httpx --with pytest pytest -v

License

MIT

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

saastore_fastapi-0.1.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

saastore_fastapi-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file saastore_fastapi-0.1.0.tar.gz.

File metadata

  • Download URL: saastore_fastapi-0.1.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for saastore_fastapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7df91c57dc6e809a30fb7b67aa1a92b1e6d230caa8e8a793700f9de585bfbfcc
MD5 6282c549ebabbc0b52c55540f770e211
BLAKE2b-256 5f216e57b85ab8d558cfc78696b95d09752197baf6129a07ccf2646673903f8f

See more details on using hashes here.

File details

Details for the file saastore_fastapi-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for saastore_fastapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c16335cfafb5538e5e7bd03416bf16fd4136b1ca7f2466f894d174882485511
MD5 b9fa5604ed1667b0cd72a2ac955ccee5
BLAKE2b-256 b12acdff08f88592a9be4e34acafad606fb6161ebb43cd0fd5ef704d26f89d41

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