Aller au contenu

Formats de données

Spécifications des formats JSON, NDJSON et envelopes

Document Metadata Format

{
  "id": "uuid-v4",
  "user_id": "uuid-v4",
  "filename": "document.pdf",
  "mime_type": "application/pdf",
  "size": 123456,
  "category": "BULLETIN_SALAIRE",
  "uploaded_at": "2025-11-23T20:00:00.000Z",
  "hash": {
    "algorithm": "SHA3-256",
    "value": "hex-encoded-hash"
  },
  "proof": {
    "timestamp": "2025-11-23T20:00:00.000Z",
    "blockchain": {
      "network": "ethereum",
      "txHash": "0x...",
      "blockNumber": 123456
    }
  },
  "encryption": {
    "algorithm": "AES-256-GCM",
    "key_id": "key-uuid"
  },
  "storage": {
    "provider": "aws-s3",
    "bucket": "probatiovault-documents",
    "key": "documents/uuid.enc",
    "tier": "GLACIER"
  }
}

NDJSON Batch Format

Pour upload de masse:

{"filename":"doc1.pdf","category":"FACTURE","metadata":{"numero":"001"}}
{"filename":"doc2.pdf","category":"FACTURE","metadata":{"numero":"002"}}
{"filename":"doc3.pdf","category":"BULLETIN","metadata":{"mois":"01"}}

Upload:

curl -X POST https://api.probatiovault.com/api/documents/batch \
  -H "Content-Type: application/x-ndjson" \
  --data-binary @documents.ndjson

Cryptographic Envelope

{
  "version": "1.0",
  "algorithm": "AES-256-GCM",
  "ciphertext": "base64-encoded-encrypted-data",
  "iv": "base64-encoded-iv",
  "auth_tag": "base64-encoded-tag",
  "key_envelope": {
    "encrypted_key": "base64-encrypted-K_doc",
    "kek_id": "key-encryption-key-id"
  },
  "metadata": {
    "content_type": "application/pdf",
    "original_size": 123456,
    "compressed": false
  }
}

Proof Format

{
  "document_id": "uuid",
  "hash": {
    "algorithm": "SHA3-256",
    "value": "hex-encoded"
  },
  "timestamp": {
    "rfc3161": "base64-encoded-tsa-token",
    "iso8601": "2025-11-23T20:00:00.000Z"
  },
  "blockchain": {
    "network": "ethereum",
    "contract": "0x...",
    "txHash": "0x...",
    "blockNumber": 123456,
    "confirmations": 12
  },
  "composite": {
    "proof_version": 2,
    "merkle_root": "hex-encoded",
    "inclusion_path": ["hex1", "hex2", "hex3"],
    "leaf_index": 42,
    "tree_size": 128,
    "event_hash": "hex-encoded",
    "hash_algorithm": "sha3-256"
  }
}

Audit Log Format

{
  "event_id": "uuid",
  "timestamp": "2025-11-23T20:00:00.000Z",
  "event_type": "document.accessed",
  "actor": {
    "user_id": "uuid",
    "ip_address": "1.2.3.4",
    "user_agent": "Mozilla/5.0..."
  },
  "resource": {
    "type": "document",
    "id": "uuid",
    "action": "read"
  },
  "result": {
    "status": "success",
    "details": "Document downloaded"
  },
  "compliance": {
    "gdpr": true,
    "retention": "10_years"
  }
}

Document créé lors de la réorganisation