{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/sigr-gca-v1.json",
  "title": "SiGR GCA v1, grounding claims attestation receipt",
  "description": "Canonical schema for the Hive GCA (Grounding Claims Attestation) receipt, canonical type sigr.gca. Binds a set of per-claim grounding assertions, each an optional support digest and a support strength, into one Ed25519 signature over a recomputable payload_sha256 and a recomputable claims_root. GCA proves that a claim has a named support reference and a declared support strength; it never proves that the claim is factually true. A claim with support null is recorded honestly as ungrounded, not silently upgraded.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_sigr\\.gca_[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",
        "answer_id",
        "tenant_id",
        "method_hash",
        "claims",
        "claims_root",
        "grounded_count",
        "attested_at",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": { "type": "string", "const": "sigr.gca" },
        "schema": { "type": "string", "const": "r1.0.0" },
        "answer_id": { "type": "string", "minLength": 1, "maxLength": 256 },
        "tenant_id": { "type": "string", "minLength": 1, "maxLength": 256 },
        "method_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Digest of the grounding method or retrieval configuration used to produce the claims array."
        },
        "claims": {
          "type": "array",
          "minItems": 1,
          "maxItems": 256,
          "items": {
            "type": "object",
            "required": ["claim_id", "claim_hash", "support_sha256", "support_strength_bp"],
            "additionalProperties": false,
            "properties": {
              "claim_id": { "type": "string", "minLength": 1, "maxLength": 256 },
              "claim_hash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
              "support_sha256": {
                "description": "Digest of the supporting source passage as a 64 character lowercase hex string, or JSON null when this claim has no support at all. No type keyword is declared here so this minimal validator does not reject the null case; verifySigrGca independently checks that a non-null value matches the 64 character lowercase hex digest shape and that a null value carries support_strength_bp of 0."
              },
              "support_strength_bp": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000,
                "description": "Basis points, 0 to 10000. Must be 0 when support_sha256 is null; a nonzero strength with no support digest is a schema violation, not a grounded claim."
              }
            }
          }
        },
        "claims_root": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "sha256 fold of claims in array order. Recomputed by the verifier; a caller supplied claims_root that does not match fails CLAIMS_ROOT."
        },
        "grounded_count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 256,
          "description": "Recomputed by the verifier: the count of claims entries whose support_sha256 is not null. Never accepted as a caller supplied count."
        },
        "attested_at": {
          "type": "string",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
        },
        "boundary": {
          "type": "string",
          "const": "This receipt attests that claims_root and grounded_count recompute exactly from the recorded claims array, and that a claim with support_sha256 null carries support_strength_bp of 0. It proves that each claim carries the recorded support reference and strength. It does not prove that any claim is factually true, that the named support passage actually supports the claim it is attached to, or that the grounding method itself is sound."
        }
      }
    }
  }
}
