diff --git a/backend/app/routers/auth.py b/backend/app/routers/auth.py index 2175626..02e7f24 100644 --- a/backend/app/routers/auth.py +++ b/backend/app/routers/auth.py @@ -132,7 +132,11 @@ async def verify_challenge( detail="Challenge invalide", ) - # 4. Verify signature (bypass for demo profiles in dev/demo mode) + # 4. Verify signature + # TODO: trustWallet — déléguer la vérification au protocole trustWallet (librodrome) + # Quand trustWallet sera disponible : remplacer le bloc ci-dessous par une vérification + # du token signé fourni par trustWallet (JWT ou preuve Ed25519 via iframe postMessage). + # Le bypass DEMO_MODE sera alors supprimé. _demo_addresses = {p["address"] for p in DEV_PROFILES} is_demo_bypass = (settings.DEMO_MODE or settings.ENVIRONMENT == "development") and payload.address in _demo_addresses diff --git a/backend/app/tests/test_middleware.py b/backend/app/tests/test_middleware.py index eab2912..5f0b79f 100644 --- a/backend/app/tests/test_middleware.py +++ b/backend/app/tests/test_middleware.py @@ -14,8 +14,21 @@ from __future__ import annotations import pytest from httpx import ASGITransport, AsyncClient +import app.models # noqa: F401 — registers all models with Base.metadata before create_all +from app.database import init_db from app.main import app + +@pytest.fixture(scope="module", autouse=True) +async def _create_tables(): + """Create DB tables once for this module. + + ASGITransport does not trigger the FastAPI lifespan, so init_db() would + never run. Tests that hit endpoints backed by the DB need the tables to + exist beforehand. + """ + await init_db() + ORIGIN = "http://localhost:3002" CHALLENGE_URL = "/api/v1/auth/challenge" VERIFY_URL = "/api/v1/auth/verify" diff --git a/frontend/app/pages/login.vue b/frontend/app/pages/login.vue index 6ba7d2a..1f37039 100644 --- a/frontend/app/pages/login.vue +++ b/frontend/app/pages/login.vue @@ -100,6 +100,8 @@ const activeStepIndex = computed(() => { } }) +const isProtoMode = computed(() => devProfiles.value.length > 0) + onMounted(() => { if (auth.isAuthenticated) { router.push('/') @@ -166,45 +168,50 @@ onMounted(() => { Connecte. Redirection... - - - - -
+ Authentification trustWallet à venir — intégration librodrome +
- Aucun mot de passe. Authentification par signature cryptographique. -
+ + + ++ Aucun mot de passe. Authentification par signature cryptographique. +
+