﻿{
  "$schema": "https://json-schema.org",
  "$id": "https://ai-project-mark.org",
  "title": "C2PA Code & Creative Provenance Manifest",
  "description": "Out-of-tree C2PA ES256 provenance manifest stored in Git Notes (refs/notes/c2pa) or attached to creative deliverables.",
  "type": "object",
  "required": ["claim_generator", "assertion"],
  "properties": {
    "claim_generator": { "type": "string", "minLength": 1 },
    "assertion": {
      "type": "object",
      "required": [
        "project_id",
        "human_initiator_did",
        "model_id",
        "model_version",
        "timestamp_utc",
        "compute_cost_micros",
        "ai_generated_lines",
        "total_committed_lines",
        "commit_sha"
      ],
      "properties": {
        "project_id": { "type": "string", "format": "uuid" },
        "human_initiator_did": { "type": "string", "pattern": "^did:[a-z0-9]+:.+" },
        "model_id": { "type": "string", "minLength": 1 },
        "model_version": { "type": "string", "minLength": 1 },
        "timestamp_utc": { "type": "string", "format": "date-time" },
        "generation_seed": { "type": ["integer", "null"], "minimum": 0 },
        "compute_cost_micros": { "type": "integer", "minimum": 0, "description": "Verified AI compute cost in micro-dollars (1 USD = 1,000,000 micros)." },
        "ai_generated_lines": { "type": "integer", "minimum": 0 },
        "total_committed_lines": { "type": "integer", "minimum": 0 },
        "commit_sha": { "type": "string", "pattern": "^[0-9a-f]{40,64}$" }
      },
      "additionalProperties": false
    },
    "signature": {
      "type": ["object", "null"],
      "required": ["alg", "key_id", "value"],
      "properties": {
        "alg": { "type": "string", "const": "ES256" },
        "key_id": { "type": "string", "minLength": 1 },
        "value": { "type": "string", "description": "Base64-encoded 64-byte raw (r || s) ECDSA P-256 signature." }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
