{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/origin-proof-v2.json",
  "title": "OriginProof v1",
  "description": "OriginProof, Human-Origin Attestation, receipt. Attests that an asset_id and a caller held production-conditions evidence digest were recorded and signed at recorded_at. It attests only the conditions of production (credential clearance, session integrity, declared tool or model use scope) that the caller declared, never that the output itself was provably human. This receipt is distinct from media.origin, which attests media content origin and rights evidence, not human production conditions; they must never be merged or aliased.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_origin\\.proof_[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",
        "asset_id",
        "evidence_digest_sha256",
        "recorded_at",
        "verdict",
        "boundary",
        "origin_claim_type",
        "session_commitment_sha256",
        "commitment_at",
        "final_asset_sha256",
        "actor_claims",
        "declared_tools",
        "declared_model_use",
        "production_events",
        "event_leaf_sha256_values",
        "event_root_sha256",
        "event_count",
        "observed_tool_classes",
        "observed_model_use_classes",
        "elements",
        "outcome"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "origin.proof"
        },
        "schema": {
          "type": "string",
          "const": "r2.0.0"
        },
        "asset_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "pattern": "^[A-Za-z0-9._:-]{1,256}$"
        },
        "evidence_digest_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "SHA-256 of the caller-held evidence bundle this receipt attests was recorded. The service never receives or inspects the underlying evidence, only its digest."
        },
        "recorded_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$"
        },
        "verdict": {
          "type": "object",
          "description": "Service-computed honesty boundary fields. Never caller overridable; recomputed and checked at verify time.",
          "required": [
            "matches_media_origin_family",
            "human_output_provable"
          ],
          "additionalProperties": false,
          "properties": {
            "matches_media_origin_family": {
              "type": "boolean",
              "const": false
            },
            "human_output_provable": {
              "type": "boolean",
              "const": false
            }
          }
        },
        "boundary": {
          "type": "string",
          "const": "OriginProof, Human-Origin Attestation, receipt. Attests that an asset_id and a caller held production-conditions evidence digest were recorded and signed at recorded_at. It attests only the conditions of production (credential clearance, session integrity, declared tool or model use scope) that the caller declared, never that the output itself was provably human. This receipt is distinct from media.origin, which attests media content origin and rights evidence, not human production conditions; they must never be merged or aliased."
        },
        "origin_claim_type": {
          "type": "string",
          "enum": [
            "human_conditioned_process",
            "expert_review",
            "dataset_provenance"
          ]
        },
        "session_commitment_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Commitment fixed before the production event sequence."
        },
        "commitment_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$",
          "description": "Instant the session commitment was fixed."
        },
        "final_asset_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Digest of the final asset bound by the event chain."
        },
        "actor_claims": {
          "type": "array",
          "minItems": 1,
          "maxItems": 256,
          "items": {
            "type": "object",
            "required": [
              "actor_ref",
              "credential_refs",
              "trust_status"
            ],
            "additionalProperties": false,
            "properties": {
              "actor_ref": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
                "description": "Opaque actor reference used by production events."
              },
              "credential_refs": {
                "type": "array",
                "minItems": 1,
                "maxItems": 32,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256,
                  "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
                  "description": "Reference to a credential presented for this actor."
                }
              },
              "trust_status": {
                "type": "string",
                "enum": [
                  "verified",
                  "trusted",
                  "unresolved",
                  "untrusted",
                  "rejected"
                ]
              }
            }
          }
        },
        "declared_tools": {
          "type": "array",
          "minItems": 0,
          "maxItems": 256,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
            "description": "Tool class declared for this session."
          }
        },
        "declared_model_use": {
          "type": "array",
          "minItems": 0,
          "maxItems": 256,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
            "description": "Model use class declared for this session."
          }
        },
        "production_events": {
          "type": "array",
          "minItems": 1,
          "maxItems": 4096,
          "items": {
            "type": "object",
            "required": [
              "sequence",
              "event_type",
              "event_at",
              "actor_ref",
              "tool_class",
              "model_use_class",
              "input_sha256",
              "output_sha256",
              "previous_event_sha256"
            ],
            "additionalProperties": false,
            "properties": {
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4294967295
              },
              "event_type": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
                "description": "Declared production event class."
              },
              "event_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$",
                "description": "Instant the event was observed."
              },
              "actor_ref": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
                "description": "Actor reference associated with this event."
              },
              "tool_class": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$"
              },
              "model_use_class": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:/-]{1,256}$"
              },
              "input_sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "Digest of the input state for this event."
              },
              "output_sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "Digest of the output state for this event."
              },
              "previous_event_sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "Prior canonical event leaf, or the zero digest for the first event."
              }
            }
          }
        },
        "event_leaf_sha256_values": {
          "type": "array",
          "minItems": 1,
          "maxItems": 4096,
          "items": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "One canonical leaf digest."
          },
          "description": "Canonical leaf digest for each production event in supplied order."
        },
        "event_root_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Canonical root over the ordered event leaf digests."
        },
        "event_count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4096
        },
        "observed_tool_classes": {
          "type": "array",
          "minItems": 0,
          "maxItems": 256,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
            "description": "Observed tool class derived from production events."
          }
        },
        "observed_model_use_classes": {
          "type": "array",
          "minItems": 0,
          "maxItems": 256,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9._:/-]{1,256}$",
            "description": "Observed model use class derived from production events."
          }
        },
        "elements": {
          "type": "array",
          "minItems": 0,
          "maxItems": 4,
          "items": {
            "type": "string",
            "enum": [
              "actor_credential_unresolved",
              "undeclared_tool_observed",
              "model_use_scope_mismatch",
              "session_chain_gap"
            ]
          }
        },
        "outcome": {
          "type": "string",
          "enum": [
            "declared_conditions_consistent",
            "declared_conditions_incomplete",
            "declared_conditions_mismatch"
          ]
        }
      }
    }
  }
}
