Skip to main content

appecosystem-auth

Shared HMAC-SHA256 request signing and verification for appEcosystem services.

Every request between ecosystem services is signed with a shared secret. The signed payload binds the method, canonical path, a timestamp and a unique nonce, plus a digest of the body — so a captured request cannot be replayed.

Third-party applications are issued their own key_id, sent alongside the signature, so their access can be identified, scoped and revoked independently of the first-party services.

Install

pip install appecosystem-auth

Requires Python 3.9+.

Signing a request

sign_request returns the headers to attach; it does not send anything.

import httpx
from ecosystem_auth.tokens import sign_request, get_ecosystem_secret

secret = get_ecosystem_secret()
body = {"type": "camera.motion", "source": "my-app", "data": {"camera": "front"}}

headers = sign_request(
    "POST",
    "/events/publish",
    secret,
    body=body,
    key_id="k_your_app_key",   # omit for first-party services
)

httpx.post("http://localhost:8500/events/publish", json=body, headers=headers)

body is the request body as a dict, not a pre-serialized string — it is digested as part of the signature.

Verifying a request (FastAPI)

from fastapi import Depends, FastAPI
from ecosystem_auth.middleware import require_ecosystem_auth

app = FastAPI()

@app.post("/webhook")
async def webhook(principal: dict = Depends(require_ecosystem_auth)):
    # principal carries the caller's identity and granted scopes
    return {"caller": principal.get("app_id"), "scopes": principal.get("scopes")}

An unsigned or badly-signed request is rejected before your handler runs.

Where the secret comes from

get_ecosystem_secret() resolves in this order:

  1. the ECOSYSTEM_SECRET environment variable
  2. the file-backed store at ~/.config/ecosystem/secret.env (mode 0600)

Every service on a machine must resolve the same secret, or signatures will not verify. Use ecosystem_auth.setup.generate_secret() / apply_secret() to provision one.

License

MIT — see LICENSE.

Metadata

Release files for appecosystem-auth 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for appecosystem-auth 0.4.0
File Size Uploaded
appecosystem_auth-0.4.0.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for appecosystem-auth 0.4.0
File Interpreter ABI Platform
appecosystem_auth-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.2 kB

Release files / appecosystem_auth-0.4.0.tar.gz

Download URL appecosystem_auth-0.4.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7058aad8f14b97267a295466b86708ffb5dbfeae52b718f48a0e5e93b418f27d
BLAKE2b-256 checksum
How to use checksums
8a6dfb05efc3ad1d7067c98efa5f4b0ee630ae2de76aa2b8fed7e84256c03bde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 13, 2026.

Transparency log

Release files / appecosystem_auth-0.4.0-py3-none-any.whl

Download URL appecosystem_auth-0.4.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45b2c52ef211340cff9d751d98c6c1cac0ebf5703efd4d8a5a47157f868148b4
BLAKE2b-256 checksum
How to use checksums
88271e859ced0f048977f6863d763138cf8b40ae6a50c8824bab82c48b655a36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page