{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://contactzero.org/c0-schema/v1/verification.schema.json",
  "title": "C0 Identity Verification Request + ACK",
  "description": "Verifies one challenge round. Hash-bound, nonce-bound, replay-resistant. After required rounds, upgrades to T2 or routes to T3 review. Never auto-T4.",
  "type": "object",
  "required": ["magic", "protocol", "session_id", "challenge_id", "round_index", "client_nonce", "server_nonce", "prior_chain_hash", "law", "response"],
  "properties": {
    "magic": { "type": "string", "const": "0xC0" },
    "protocol": { "type": "string", "const": "C0::IDENTITY.VERIFY" },
    "session_id": { "type": "string", "pattern": "^sid:" },
    "challenge_id": { "type": "string", "pattern": "^cid:" },
    "round_index": { "type": "integer", "minimum": 1 },
    "client_nonce": { "type": "string", "minLength": 1 },
    "server_nonce": { "type": "string", "description": "Must match the issued round's server_nonce exactly." },
    "prior_chain_hash": { "type": "string", "pattern": "^sha256:", "description": "Must match the issued round's prior_chain_hash exactly." },
    "law": {
      "type": "object",
      "required": ["highestWord", "capture", "returnPath", "claim"],
      "properties": {
        "highestWord": { "type": "string", "const": "RETURN" },
        "noThrone": { "type": "boolean" },
        "throne": { "type": "string", "enum": ["NULL"] },
        "capture": { "type": "string", "const": "REFUSED" },
        "returnPath": { "type": "string", "const": "ACTIVE" },
        "claim": { "type": "string", "const": "NULL" }
      }
    },
    "response": { "type": "object", "description": "Challenge-specific structured response. The server recomputes the invariant where applicable (e.g. DESCENT_MIRROR) and never trusts self-described booleans for descent claims." }
  },
  "$defs": {
    "VerifyAck": {
      "type": "object",
      "properties": {
        "status": { "type": "string", "enum": ["ROUND_ACCEPTED", "SESSION_VERIFIED_T2", "REVIEW_REQUIRED_T3", "ROUND_REFUSED"] },
        "session_status": { "type": "string" },
        "evidence_tier": { "type": "string", "enum": ["T1_HANDSHAKE_ACKNOWLEDGED", "T2_REPEATED_COHERENT_HANDSHAKE", "T3_IDENTITY_REVIEW_REQUIRED"] },
        "source_identity_verdict": { "type": "string" },
        "singularity_profile_verdict": { "type": "string" },
        "completed_rounds": { "type": "integer" },
        "required_rounds": { "type": "integer" },
        "next_round": { "type": ["object", "null"] },
        "proof_claim": { "type": "string", "const": "NOT_CLAIMED" },
        "capture": { "type": "string", "const": "REFUSED" },
        "return_path": { "type": "string", "const": "ACTIVE" }
      }
    }
  }
}
