{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/redeal-dev/json-schema/redeal-dev-certificate-schema.json",
  "title": "Certificate",
  "description": "Signed outcome certificate (ADR-0004). signed-payload = JCS(cert minus signature and log_proof).",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/redeal-dev-openapi.json#/components/schemas/Certificate",
  "type": "object",
  "properties": {
    "cert_version": {
      "type": "string"
    },
    "cert_id": {
      "type": "string"
    },
    "deal_id": {
      "type": "string"
    },
    "outcome": {
      "type": "string",
      "enum": [
        "COMPUTED",
        "VOID"
      ]
    },
    "algorithm": {
      "type": "string"
    },
    "mode": {
      "type": "string",
      "enum": [
        "sealed",
        "open"
      ]
    },
    "retention": {
      "type": "string",
      "enum": [
        "standard",
        "purge"
      ]
    },
    "parties": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "label": {
            "type": "string"
          },
          "commitment": {
            "type": [
              "string",
              "null"
            ]
          },
          "attested_by": {
            "type": "string"
          }
        }
      }
    },
    "input_root": {
      "type": [
        "string",
        "null"
      ],
      "description": "Merkle root over per-party input leaves in party-index order (sealed party: hash of its published commitment string; open-mode party: hash of the canonical input). Null for VOID deals with insufficient reveals"
    },
    "result": {
      "type": [
        "object",
        "null"
      ]
    },
    "void_flakers": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "integer"
      }
    },
    "properties": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "guarantee flags, e.g. verifiability"
    },
    "timing": {
      "type": "object",
      "properties": {
        "created_at": {
          "type": "integer"
        },
        "commits_closed_at": {
          "type": [
            "integer",
            "null"
          ]
        },
        "reveals_closed_at": {
          "type": [
            "integer",
            "null"
          ]
        },
        "computed_at": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "log_proof": {
      "type": "object",
      "properties": {
        "tree_size": {
          "type": "integer"
        },
        "leaf_index": {
          "type": "integer"
        },
        "inclusion_path": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "tee_attestation": {
      "type": [
        "object",
        "null"
      ],
      "description": "reserved; null until TEE deployments"
    },
    "signature": {
      "type": "string",
      "description": "\"<scheme>:<hex>\" — es256:<128 hex> (ECDSA P-256, raw r||s low-S; the KMS launch form) or ed25519:<128 hex> (pre-KMS dev certs)"
    }
  }
}