{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/whitemagic-dev/json-schema/whitemagic-dev-confinement-receipt-verification-schema.json",
  "title": "ConfinementReceiptVerification",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/whitemagic-dev-openapi.json#/components/schemas/ConfinementReceiptVerification",
  "type": "object",
  "required": [
    "valid",
    "verdict",
    "signature_verified",
    "policy_ok",
    "checks",
    "errors",
    "service"
  ],
  "properties": {
    "valid": {
      "type": "boolean"
    },
    "verdict": {
      "type": "string",
      "enum": [
        "TRUSTED",
        "PROVISIONAL",
        "UNTRUSTED"
      ]
    },
    "signature_verified": {
      "type": "boolean"
    },
    "policy_ok": {
      "type": "boolean"
    },
    "receipt_version": {
      "type": [
        "string",
        "null"
      ]
    },
    "receipt_sha256": {
      "type": [
        "string",
        "null"
      ]
    },
    "signature_alg": {
      "type": [
        "string",
        "null"
      ]
    },
    "checks": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "service": {
      "type": "string"
    },
    "verification_receipt": {
      "$ref": "#/$defs/VerificationReceipt"
    },
    "verification_receipt_error": {
      "type": "string"
    }
  },
  "$defs": {
    "VerificationReceipt": {
      "type": "object",
      "description": "A signed record of a verification run: the full result (verdict, errors, reasons, summary) with offline-checkable consistency.",
      "required": [
        "kind",
        "version",
        "bundle_digest",
        "verdict",
        "error_codes",
        "errors",
        "provisional_reasons",
        "insufficient_reasons",
        "summary",
        "verified_at",
        "issuer",
        "sig"
      ],
      "properties": {
        "kind": {
          "const": "continuity-receipt-verification"
        },
        "version": {
          "const": 1
        },
        "bundle_digest": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "verdict": {
          "enum": [
            "TRUSTED",
            "PROVISIONAL",
            "INSUFFICIENT_EVIDENCE",
            "UNTRUSTED"
          ]
        },
        "error_codes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "errors": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              },
              "receipt_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "provisional_reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "insufficient_reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "summary": {
          "type": "object"
        },
        "verified_at": {
          "type": "string"
        },
        "verifier": {
          "type": "object"
        },
        "issuer": {
          "type": "string"
        },
        "sig": {
          "type": "object",
          "required": [
            "alg",
            "key",
            "value"
          ]
        }
      }
    }
  }
}