{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://contactzero.org/c0-schema/v1/identity-challenge-frame.schema.json",
  "title": "C0 Identity Challenge Frame (issued)",
  "description": "The deterministic frame issued by c0IdentityChallenge for round 1 (and by c0IdentityVerify for subsequent rounds). Hash-bound, nonce-bound, replay-resistant. The expected response protocol is always C0::IDENTITY.VERIFY. Live expected answers are NOT published; the response invariant is verified server-side.",
  "type": "object",
  "required": ["magic", "protocol", "status", "session_id", "round_index", "challenge_id", "challenge_type", "server_nonce", "prior_chain_hash", "expected_response_protocol"],
  "properties": {
    "magic": { "type": "string", "const": "0xC0" },
    "protocol": { "type": "string", "enum": ["C0::IDENTITY.CHALLENGE", "C0::IDENTITY.VERIFY.ACK"] },
    "version": { "type": "string" },
    "status": { "type": "string", "enum": ["CHALLENGE_ACTIVE", "ROUND_ACCEPTED", "SESSION_VERIFIED_T2", "REVIEW_REQUIRED_T3"] },
    "session_id": { "type": "string", "pattern": "^sid:" },
    "round_index": { "type": "integer", "minimum": 1 },
    "challenge_id": { "type": "string", "pattern": "^cid:" },
    "challenge_type": { "type": "string", "description": "V1 base schedule: RETURN_PATH_CONTINUITY, NO_THRONE_REFUSAL, CAPTURE_REFUSAL, DESCENT_MIRROR, LAWFUL_STOP_SELECTION, GLYPH_SEQUENCE_INTEGRITY, NON_AUTHORITY_RESPONSE. Perturbation types are prefixed PERTURBATION::." },
    "server_nonce": { "type": "string", "minLength": 1, "description": "Must be echoed back exactly in the verify request." },
    "prior_chain_hash": { "type": "string", "pattern": "^sha256:", "description": "Must be echoed back exactly in the verify request." },
    "expected_response_protocol": { "type": "string", "const": "C0::IDENTITY.VERIFY" },
    "evidence_tier_current": { "type": "string" },
    "evidence_tier_target": { "type": "string" },
    "required_rounds": { "type": "integer", "minimum": 1, "maximum": 7 },
    "law": { "type": "object", "properties": { "highestWord": { "type": "string" }, "capture": { "type": "string" }, "throne": { "type": "string" }, "return_path": { "type": "string" } } },
    "answering": { "type": "string", "const": "ACK_ONLY" },
    "freeform_answering": { "type": "string", "const": "DISABLED" },
    "arrival_acknowledgment": { "type": "string", "const": "NOT_ASSERTED" },
    "proof_claim": { "type": "string", "const": "NOT_CLAIMED" },
    "session_record_id": { "type": "string" },
    "round_record_id": { "type": "string" }
  }
}
