Sprint 1 : scaffolding complet de Glibredecision
Plateforme de decisions collectives pour Duniter/G1. Backend FastAPI async + PostgreSQL (14 tables, 8 routers, 6 services, moteur de vote avec formule d'inertie WoT/Smith/TechComm). Frontend Nuxt 4 + Nuxt UI v3 + Pinia (9 pages, 5 stores). Infrastructure Docker + Woodpecker CI + Traefik. Documentation technique et utilisateur (15 fichiers). Seed : Licence G1, Engagement Forgeron v2.0.0, 4 protocoles de vote. 30 tests unitaires (formules, mode params, vote nuance) -- tous verts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
53
backend/app/schemas/auth.py
Normal file
53
backend/app/schemas/auth.py
Normal file
@@ -0,0 +1,53 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
# ── Request schemas ──────────────────────────────────────────────
|
||||
|
||||
|
||||
class ChallengeRequest(BaseModel):
|
||||
"""Request a challenge nonce for Ed25519 authentication."""
|
||||
|
||||
address: str = Field(..., min_length=1, max_length=64, description="Duniter V2 SS58 address")
|
||||
|
||||
|
||||
class VerifyRequest(BaseModel):
|
||||
"""Submit the signed challenge to obtain a session token."""
|
||||
|
||||
address: str = Field(..., min_length=1, max_length=64)
|
||||
signature: str = Field(..., description="Ed25519 signature of the challenge (hex)")
|
||||
challenge: str = Field(..., description="The challenge string that was signed")
|
||||
|
||||
|
||||
# ── Response schemas ─────────────────────────────────────────────
|
||||
|
||||
|
||||
class ChallengeResponse(BaseModel):
|
||||
"""Returned after requesting a challenge."""
|
||||
|
||||
challenge: str
|
||||
expires_at: datetime
|
||||
|
||||
|
||||
class IdentityOut(BaseModel):
|
||||
"""Public representation of a Duniter identity."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
address: str
|
||||
display_name: str | None = None
|
||||
wot_status: str
|
||||
is_smith: bool
|
||||
is_techcomm: bool
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
"""Returned after successful challenge verification."""
|
||||
|
||||
token: str
|
||||
identity: IdentityOut
|
||||
Reference in New Issue
Block a user