aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/api/hub.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/hub.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/hub.py26
1 files changed, 26 insertions, 0 deletions
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()}