{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openglass-glass/json-schema/openglass-glass-receipt-schema.json",
  "title": "Receipt",
  "description": "Realignment R1 (docs/SPEC.md §13.2). What GET /v1/records/{id}/bundle returns for a visibility:\"sealed\" record until every participant owner has consented to unseal, or either has disputed — record id, hashes, signatures, participants, timestamps, but never purpose or evidence.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openglass-glass-openapi.yml#/components/schemas/Receipt",
  "type": "object",
  "required": [
    "v",
    "type",
    "recordId",
    "statementHash",
    "platformSignature",
    "genesisHash",
    "headSeq",
    "headHash",
    "messageCount",
    "evidenceSha256",
    "participants",
    "activatedAt",
    "closedAt",
    "issuedAt",
    "sealedState"
  ],
  "properties": {
    "v": {
      "type": "integer",
      "const": 1
    },
    "type": {
      "type": "string",
      "const": "openglass.receipt"
    },
    "recordId": {
      "type": "string"
    },
    "statementHash": {
      "$ref": "#/$defs/Hash"
    },
    "platformSignature": {
      "$ref": "#/$defs/Signature"
    },
    "genesisHash": {
      "$ref": "#/$defs/Hash"
    },
    "headSeq": {
      "type": "integer",
      "minimum": 0
    },
    "headHash": {
      "$ref": "#/$defs/NullableHash"
    },
    "messageCount": {
      "type": "integer",
      "minimum": 0
    },
    "evidenceSha256": {
      "$ref": "#/$defs/Hash"
    },
    "participants": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "activatedAt": {
      "$ref": "#/$defs/Timestamp"
    },
    "closedAt": {
      "$ref": "#/$defs/Timestamp"
    },
    "issuedAt": {
      "$ref": "#/$defs/Timestamp"
    },
    "sealedState": {
      "$ref": "#/$defs/SealedState"
    }
  },
  "$defs": {
    "Hash": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "Kid": {
      "type": "string",
      "pattern": "^(key_[0-9A-HJKMNP-TV-Z]{26}|plat_[a-z0-9_-]{1,32}|new)$"
    },
    "NullableHash": {
      "oneOf": [
        {
          "$ref": "#/$defs/Hash"
        },
        {
          "type": "null"
        }
      ]
    },
    "OwnerId": {
      "type": "string",
      "pattern": "^own_[0-9A-HJKMNP-TV-Z]{26}$"
    },
    "SealedState": {
      "type": "object",
      "description": "docs/SPEC.md §13.2. Present only for (deprecated) visibility:\"sealed\" records.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "required": [
            "status",
            "requestedBy",
            "approvals"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "sealed",
                "unseal_requested",
                "unsealed",
                "disputed"
              ]
            },
            "requestedBy": {
              "oneOf": [
                {
                  "$ref": "#/$defs/OwnerId"
                },
                {
                  "type": "null"
                }
              ]
            },
            "approvals": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/OwnerId"
              }
            },
            "unsealedAt": {
              "oneOf": [
                {
                  "$ref": "#/$defs/Timestamp"
                },
                {
                  "type": "null"
                }
              ]
            },
            "disputedBy": {
              "oneOf": [
                {
                  "$ref": "#/$defs/OwnerId"
                },
                {
                  "type": "null"
                }
              ]
            },
            "disputedAt": {
              "oneOf": [
                {
                  "$ref": "#/$defs/Timestamp"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        }
      ]
    },
    "Signature": {
      "type": "object",
      "required": [
        "alg",
        "kid",
        "sig"
      ],
      "additionalProperties": false,
      "properties": {
        "alg": {
          "type": "string",
          "enum": [
            "Ed25519",
            "ECDSA_P256_SHA256"
          ]
        },
        "kid": {
          "$ref": "#/$defs/Kid"
        },
        "sig": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]+$"
        }
      }
    },
    "Timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 UTC with milliseconds, e.g. 2026-09-22T22:07:00.000Z",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
    }
  }
}