{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/s2s-signature-v2.json",
  "title": "S2S (Silicon-to-Signature) v1",
  "description": "S2S Silicon to Signature receipt. It binds request, output, session, nonce, timing, platform measurement, model, format, and optional trust chain evidence into an inference commitment and a canonical platform message, then verifies the Ed25519 platform signature and derives freshness and trust relations. It binds an inference commitment to signed platform evidence. Without a verified trust root it does not claim genuine GPU hardware or vendor attestation.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_s2s\\.signature_[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",
        "inference_id",
        "evidence_digest_sha256",
        "recorded_at",
        "verdict",
        "boundary",
        "request_sha256",
        "output_sha256",
        "session_sha256",
        "nonce",
        "nonce_committed_at",
        "evidence_issued_at",
        "platform_measurement_sha256",
        "platform_model",
        "attestation_format",
        "device_public_key",
        "platform_signature",
        "inference_binding_sha256",
        "platform_message_sha256",
        "platform_signature_relation",
        "trust_class",
        "age_ms",
        "elements",
        "outcome"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "s2s.signature"
        },
        "schema": {
          "type": "string",
          "const": "r2.0.0"
        },
        "inference_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": [
            "gpu_hardware_proven",
            "vendor_attestation_proven"
          ],
          "additionalProperties": false,
          "properties": {
            "gpu_hardware_proven": {
              "type": "boolean",
              "const": false
            },
            "vendor_attestation_proven": {
              "type": "boolean",
              "const": false
            }
          }
        },
        "boundary": {
          "type": "string",
          "const": "S2S Silicon to Signature receipt. It binds request, output, session, nonce, timing, platform measurement, model, format, and optional trust chain evidence into an inference commitment and a canonical platform message, then verifies the Ed25519 platform signature and derives freshness and trust relations. It binds an inference commitment to signed platform evidence. Without a verified trust root it does not claim genuine GPU hardware or vendor attestation."
        },
        "request_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Commitment to the inference request."
        },
        "output_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Commitment to the inference output."
        },
        "session_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Commitment to the inference session."
        },
        "nonce": {
          "type": "string",
          "minLength": 16,
          "maxLength": 256
        },
        "nonce_committed_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 nonce was committed."
        },
        "evidence_issued_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 platform evidence was issued."
        },
        "platform_measurement_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Commitment to the platform measurement."
        },
        "platform_model": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "description": "Declared platform model."
        },
        "attestation_format": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "description": "Declared platform attestation format."
        },
        "device_public_key": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Lowercase hexadecimal Ed25519 public key for the signed device or platform message."
        },
        "platform_signature": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$",
          "description": "Unpadded base64url Ed25519 signature over the canonical message defined by this contract."
        },
        "trust_chain": {
          "type": "object",
          "required": [
            "root_sha256",
            "inference_binding_sha256",
            "trust_classification",
            "chain_verified"
          ],
          "additionalProperties": false,
          "properties": {
            "root_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$",
              "description": "Commitment to the platform trust root."
            },
            "inference_binding_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$",
              "description": "Inference binding carried by the platform trust evidence."
            },
            "trust_classification": {
              "type": "string",
              "enum": [
                "trusted",
                "untrusted",
                "unknown"
              ],
              "description": "Trust classification supplied with the linked evidence. Unknown remains indeterminate."
            },
            "chain_verified": {
              "type": "boolean",
              "description": "Whether the supplied trust evidence reports a complete chain to its named root."
            }
          }
        },
        "inference_binding_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "Recomputed commitment to inference request, output, and session."
        },
        "platform_message_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "SHA256 of the canonical signed platform message."
        },
        "platform_signature_relation": {
          "type": "string",
          "enum": [
            "valid",
            "invalid"
          ]
        },
        "trust_class": {
          "type": "string",
          "enum": [
            "trusted",
            "untrusted",
            "indeterminate"
          ]
        },
        "age_ms": {
          "type": "integer"
        },
        "elements": {
          "type": "array",
          "minItems": 0,
          "maxItems": 4,
          "items": {
            "type": "string",
            "enum": [
              "inference_binding_mismatch",
              "platform_signature_invalid",
              "platform_root_untrusted",
              "evidence_stale"
            ]
          }
        },
        "outcome": {
          "type": "string",
          "enum": [
            "inference_bound_to_signed_platform_evidence",
            "binding_mismatch",
            "trust_not_established"
          ]
        }
      }
    }
  }
}
