Index <= Page index / Phase => Phase 2 – Docs + .enc files (fake crypto)
CRUD endpoints, binaries + JSON metadata, content still in clear (real crypto in phase 6).
storage/docs/<doc_id>.bin.storage/meta/<doc_id>.json with sha256, size, enc (false for now), tags, timestamps.{
"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"
}
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"]
}'
curl http://localhost:8000/api/v1/docs/DOC-0001
curl -X DELETE http://localhost:8000/api/v1/docs/DOC-0001
Receive content_b64, decode to SPIFFS or SD (test mode). Minimal snippet:
#include <Base64.h>
// Pseudocode : write decoded bytes to SPIFFS
// fs::File f = SPIFFS.open("/doc.bin", "w");
// f.write(decoded, decodedLen);