Index <= Page index / Phase => Phase 2 – Docs + fichiers .enc (fake crypto)

Détails – Phase 2 – Docs + fichiers .enc (fake crypto)

Endpoints CRUD documents, stockage binaire + métadonnées JSON, contenu encore en clair (chiffrement réel prévu en phase 6).

Arborescence & métadonnées

{
  "doc_id": "DOC-0001",
  "name": "circular_mayors.pdf",
  "sha256": "abc123...",
  "size": 123456,
  "enc": false,
  "tags": ["p1", "mayor", "doc"],
  "created_at": "2025-12-10T14:00:00Z",
  "updated_at": "2025-12-10T14:00:00Z"
}

Endpoints CRUD documents (Fake crypto)

POST /api/v1/docs

curl -X POST http://localhost:8000/api/v1/docs \
  -H "Content-Type: application/json" \
  -d '{
    "doc_id": "DOC-0001",
    "name": "circular_mayors.pdf",
    "content_b64": "...",
    "tags": ["p1","mayor"]
  }'

GET /api/v1/docs/{doc_id}

curl http://localhost:8000/api/v1/docs/DOC-0001

DELETE /api/v1/docs/{doc_id}

curl -X DELETE http://localhost:8000/api/v1/docs/DOC-0001

ESP32 (base64 → SPIFFS)

Réception du content_b64, décodage vers SPIFFS ou SD (mode test). Exemple minimal :

#include <Base64.h>
// Pseudocode : write decoded bytes to SPIFFS
// fs::File f = SPIFFS.open("/doc.bin", "w");
// f.write(decoded, decodedLen);

À retenir / Suites