From fb91c4545c757711e1b5fd354ca4b311c89fd2c0 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sun, 9 Aug 2026 04:39:34 +0200 Subject: feat(hub): add production hub — config, auth, API routers, tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit config.py: TOML + env var priority. auth.py: Argon2id passwords, JWT EdDSA with jti, refresh token hashed (blake3). Routers: hub (info/pubkey), users (register/login/refresh/pubkeys), nodes (announce/get), groups (create/gek-bundle/gek-retrieve). Rate limiting via slowapi. app.py factory with lifespan. All 40 tests pass (SQLite in-memory, no PostgreSQL required). Fix: remove tests/__init__.py to resolve namespace conflicts. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- packages/meshbay-hub/src/meshbay_hub/api/hub.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/meshbay-hub/src/meshbay_hub/api/hub.py (limited to 'packages/meshbay-hub/src/meshbay_hub/api/hub.py') diff --git a/packages/meshbay-hub/src/meshbay_hub/api/hub.py b/packages/meshbay-hub/src/meshbay_hub/api/hub.py new file mode 100644 index 0000000..00aba28 --- /dev/null +++ b/packages/meshbay-hub/src/meshbay_hub/api/hub.py @@ -0,0 +1,26 @@ +"""Hub info endpoints — /v1/hub/*""" + +from fastapi import APIRouter +from meshbay_common import MNP_VERSION, MHP_VERSION +from meshbay_hub import __version__ +from meshbay_hub.auth import hub_public_key_pem +from meshbay_hub.db.engine import get_engine + +router = APIRouter(prefix="/v1/hub", tags=["hub"]) + + +@router.get("/info") +async def hub_info(): + engine = get_engine() + return { + "hub_version": __version__, + "mnp_version": MNP_VERSION, + "mhp_version": MHP_VERSION, + "db_dialect": engine.dialect.name, + } + + +@router.get("/pubkey") +async def hub_pubkey(): + """Hub Ed25519 public key PEM — cached by nodes on first contact.""" + return {"pk_hub_pem": hub_public_key_pem().decode()} -- cgit v1.2.3