{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/intent-verifiability-v1.json",
  "title": "Intent Verifiability Receipt, v1",
  "description": "Canonical schema for the Hive intent verifiability receipt, canonical type intent.verifiability.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": { "type": "string", "pattern": "^r_intent\\.verifiability_[0-9]{10,}_[0-9a-f]{12}$" },
    "payload_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "sig_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$" },
    "key_id": { "type": "string", "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$" },
    "algorithm": { "type": "string", "const": "Ed25519" },
    "ts": { "type": "integer", "minimum": 1000000000 },
    "signed_body": {
      "type": "object",
      "required": [
        "receipt_type",
        "schema",
        "intent_verifiability",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": { "type": "string", "const": "intent.verifiability" },
        "schema": { "type": "string", "const": "r1.0.0" },
        "intent_verifiability": {
          "type": "object",
          "required": [
            "assessment_id",
            "assessed_at",
            "intent_ref",
            "ruleset_ref",
            "predicate_kind_set_digest",
            "predicate_count",
            "machine_checkable_predicate_count",
            "subjective_predicate_count",
            "unclassified_predicate_count",
            "verifiability_class",
            "precedence_class",
            "evidence_access_class",
            "salt_commitment"
          ],
          "additionalProperties": false,
          "properties": {
            "assessment_id": { "type": "string", "pattern": "^iv_[0-9a-f]{16,64}$" },
            "assessed_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z$" },
            "intent_ref": {
              "type": "object",
              "required": ["intent_id", "commitment_sha256", "fixed_at"],
              "additionalProperties": false,
              "properties": {
                "intent_id": { "type": "string", "pattern": "^in_[0-9a-f]{16,64}$" },
                "commitment_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
                "fixed_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z$" }
              }
            },
            "ruleset_ref": {
              "type": "object",
              "required": ["ruleset_id", "ruleset_digest", "committed_at"],
              "additionalProperties": false,
              "properties": {
                "ruleset_id": { "type": "string", "pattern": "^rs_[0-9a-z_]{1,48}$" },
                "ruleset_digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
                "committed_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z$" }
              }
            },
            "predicate_kind_set_digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "predicate_count": { "type": "integer", "minimum": 1, "maximum": 10000 },
            "machine_checkable_predicate_count": { "type": "integer", "minimum": 0, "maximum": 10000 },
            "subjective_predicate_count": { "type": "integer", "minimum": 0, "maximum": 10000 },
            "unclassified_predicate_count": { "type": "integer", "minimum": 0, "maximum": 10000 },
            "verifiability_class": { "type": "string", "enum": ["machine_checkable", "partially_checkable", "subjective", "unclassifiable"] },
            "precedence_class": { "type": "string", "enum": ["ruleset_precedes_intent", "ruleset_follows_intent"] },
            "evidence_access_class": { "type": "string", "enum": ["confidential_independent", "issuer_only", "public_commitment_only"] },
            "salt_commitment": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
          }
        },
        "boundary": {
          "type": "string",
          "minLength": 1,
          "const": "This receipt attests only that a named observer recomputed a verifiability class from the declared predicate kinds of one committed intent, against a classification ruleset whose digest was committed at or before the intent was fixed. It does not attest that the intent was reasonable, that the Card Member understood it, that the declared predicate kinds are complete or honestly declared, that the predicates are the ones a court or regulator would consider material, that any claim is payable or deniable, or that any party is entitled to rely on the class. This service does not read the intent text and never receives it."
        }
      }
    }
  }
}
