{
  "$id": "https://KATA.org/schemas/external-evidence.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "External evidence",
  "description": "Evidence a verifier returns for KATA to record. This object is not a KATA decision. result is valid, invalid, or unverifiable. It is not ALLOW, BLOCK, or any other decision outcome.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "source",
    "issuer",
    "subject",
    "claims",
    "verified_at",
    "key_id",
    "result",
    "reason",
    "payload_hash"
  ],
  "properties": {
    "source": {
      "description": "Verifier family. Later protocol adapters register their own source name. This phase ships synthetic and jwt.",
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "issuer": {
      "description": "Issuer identifier from the evidence, or an empty string when it could not be read.",
      "type": "string",
      "maxLength": 200
    },
    "subject": {
      "description": "Pseudonymous subject from the evidence. Government identifier numbers are not a subject.",
      "type": "string",
      "maxLength": 200
    },
    "claims": {
      "description": "Scalar claims kept after dropping government-identifier names. The raw signed payload is not stored.",
      "type": "object",
      "maxProperties": 16,
      "additionalProperties": {
        "type": ["string", "number", "boolean", "null"]
      }
    },
    "verified_at": {
      "description": "When the verifier finished, UTC, second resolution.",
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "key_id": {
      "description": "Key id the verifier used, or an empty string when no key was selected.",
      "type": "string",
      "maxLength": 200
    },
    "result": {
      "description": "Verifier outcome. This is not a KATA decision.",
      "enum": ["valid", "invalid", "unverifiable"]
    },
    "reason": {
      "description": "Stable reason code for the result.",
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "payload_hash": {
      "description": "SHA-256 hex of the signed payload bytes. Not the raw payload.",
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    }
  }
}
