V3 S6 : confiance (révocation, quota, appareils, conflits) + import + onboarding

Backend : token_version (000022, claim tv, 401 si révoqué, bump au
password — fin limite V1), quota (000023 idempotente, colonne héritée
de 000001, 413 QUOTA_EXCEEDED, GET /users/me/usage), devices
(GET + DELETE révocation, EnforceDeviceExists en prod), renames
concurrents transparents (baseUpdatedAt + conflicts[] non-fataux,
tolérance 2 s). Tests service + handlers + migrations + auth.

Mobile : pipeline conflits (DTO + SyncConflictStore + worker + dialogue),
baseUpdatedAt prêt, liens 7j par défaut, écran Appareils (+ quota),
import classeur unifié (scan/note/dossier), onboarding cercle Famille.

Contrat docs/api-v1.md, V3.md (S6 livré).
This commit is contained in:
venture
2026-09-26 11:56:39 +02:00
parent 37dc36f1f2
commit 1e38e6e4ee
65 changed files with 1880 additions and 53 deletions
+9 -1
View File
@@ -60,7 +60,7 @@ func RequireAuth(c *gin.Context) {
// Le store peut être nil dans les tests middleware purs ; sinon on vérifie
// que le compte existe toujours (supprimé → accès refusé).
if Store != nil && Store.Repository != nil {
_, err := Store.Repository.Users.GetByID(identity.UserID)
user, err := Store.Repository.Users.GetByID(identity.UserID)
if errors.Is(err, repository.ErrNotFound) {
api.Error(c, http.StatusUnauthorized, "UNAUTHORIZED", "account no longer exists")
c.Abort()
@@ -71,6 +71,14 @@ func RequireAuth(c *gin.Context) {
c.Abort()
return
}
// V3 S6 : révocation — un changement de mot de passe (bump de
// token_version) invalide tous les tokens antérieurs, même non expirés.
if identity.TokenVersion != user.TokenVersion {
log.Printf("auth: token révoqué rejeté (user=%s tv=%d, attendu %d)", identity.UserID, identity.TokenVersion, user.TokenVersion)
api.Error(c, http.StatusUnauthorized, "UNAUTHORIZED", "token revoked")
c.Abort()
return
}
}
if EnforceDeviceExists && Store != nil && Store.Repository != nil {