{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://commoninstant.org/ai/specs/attestation-schema.json",
  "title": "CTCL challenge-bound T2 attested-now response",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "attestation",
    "signature"
  ],
  "properties": {
    "attestation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema",
        "instant_id",
        "unix_ns",
        "timescale",
        "nonce",
        "context_digest",
        "source_profile",
        "source_class",
        "source_protocol",
        "source_provider",
        "trust_tier",
        "precision",
        "estimated_uncertainty_ns"
      ],
      "properties": {
        "schema": {
          "const": "ctcl/attested-now/v1"
        },
        "instant_id": {
          "type": "string",
          "pattern": "^ctcl:instant:[0-9a-f-]{36}$"
        },
        "unix_ns": {
          "type": "string",
          "pattern": "^[0-9]+$"
        },
        "timescale": {
          "const": "utc"
        },
        "nonce": {
          "type": "string",
          "pattern": "^[0-9a-f]{32,128}$"
        },
        "context_digest": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "source_profile": {
          "const": "ctcl/edge-wall-clock/t2/v1"
        },
        "source_class": {
          "const": "edge_wall_clock"
        },
        "source_protocol": {
          "const": "cloudflare-edge"
        },
        "source_provider": {
          "const": "cloudflare"
        },
        "trust_tier": {
          "const": "T2"
        },
        "precision": {
          "const": "millisecond_representation"
        },
        "estimated_uncertainty_ns": {
          "const": 5000000
        }
      }
    },
    "signature": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "alg",
        "key_id",
        "signed_fields",
        "value",
        "verify"
      ],
      "properties": {
        "alg": {
          "const": "Ed25519"
        },
        "key_id": {
          "type": "string",
          "pattern": "^ctcl-ed25519-[1-9][0-9]*$"
        },
        "signed_fields": {
          "const": "CTCL-ATTEST-NOW/V1|canonical_json(attestation)"
        },
        "value": {
          "type": "string",
          "minLength": 1
        },
        "verify": {
          "type": "string",
          "pattern": "^/v1/pubkey(?:\\?key_id=ctcl-ed25519-[1-9][0-9]*)?$"
        }
      }
    }
  }
}
