{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/methodology-version-commitment-v1.json",
  "title": "Methodology Version Commitment Receipt, v1",
  "description": "Canonical schema for the Hive methodology version commitment receipt, canonical type methodology.version. The instrument records a schedule of methodology versions, each identified by the SHA-256 digest of its document, with document publication, notice, optional consultation and effective instants, and a set of published values, each presented as a salted commitment, with the instant it was published and the digest of the version declared in force for it. The service computes, and the verifier recomputes, whether each value fell inside the effective window of its declared version, before that version took effect, after a later version superseded it, under a digest not in the schedule, or in a window the drift bounds cannot settle. The documents and the values never enter the signed body.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_methodology[.]version_[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",
        "methodology_id",
        "salt_commitment",
        "versions",
        "values",
        "summary",
        "committed_at",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "methodology.version"
        },
        "schema": {
          "type": "string",
          "const": "r1.0.0"
        },
        "methodology_id": {
          "type": "string",
          "pattern": "^meth_[0-9a-z][0-9a-z._-]{0,47}$"
        },
        "salt_commitment": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "versions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 256,
          "description": "Methodology versions in the order they took effect. A version is superseded at the effective instant of the next entry.",
          "items": {
            "type": "object",
            "required": [
              "version_label",
              "methodology_digest",
              "document_published_at",
              "notice_at",
              "consultation",
              "effective_from"
            ],
            "additionalProperties": false,
            "properties": {
              "version_label": {
                "type": "string",
                "pattern": "^[0-9a-zA-Z][0-9a-zA-Z._-]{0,31}$"
              },
              "methodology_digest": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "Lowercase hex SHA-256 over the methodology document as published. The document is never carried here."
              },
              "document_published_at": {
                "type": "object",
                "required": [
                  "utc",
                  "drift_seconds"
                ],
                "additionalProperties": false,
                "properties": {
                  "utc": {
                    "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$"
                  },
                  "drift_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 86400
                  }
                }
              },
              "notice_at": {
                "type": "object",
                "required": [
                  "utc",
                  "drift_seconds"
                ],
                "additionalProperties": false,
                "properties": {
                  "utc": {
                    "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$"
                  },
                  "drift_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 86400
                  }
                }
              },
              "consultation": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Null when no consultation was recorded for this version.",
                "required": [
                  "opened_at",
                  "closed_at"
                ],
                "additionalProperties": false,
                "properties": {
                  "opened_at": {
                    "type": "object",
                    "required": [
                      "utc",
                      "drift_seconds"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "utc": {
                        "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$"
                      },
                      "drift_seconds": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 86400
                      }
                    }
                  },
                  "closed_at": {
                    "type": "object",
                    "required": [
                      "utc",
                      "drift_seconds"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "utc": {
                        "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$"
                      },
                      "drift_seconds": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 86400
                      }
                    }
                  }
                }
              },
              "effective_from": {
                "type": "object",
                "required": [
                  "utc",
                  "drift_seconds"
                ],
                "additionalProperties": false,
                "properties": {
                  "utc": {
                    "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$"
                  },
                  "drift_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 86400
                  }
                }
              }
            }
          }
        },
        "values": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10000,
          "items": {
            "type": "object",
            "required": [
              "value_commitment",
              "published_at",
              "methodology_digest",
              "classification"
            ],
            "additionalProperties": false,
            "properties": {
              "value_commitment": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$",
                "description": "Salted commitment over the value descriptor. The value never enters the signed body."
              },
              "published_at": {
                "type": "object",
                "required": [
                  "utc",
                  "drift_seconds"
                ],
                "additionalProperties": false,
                "properties": {
                  "utc": {
                    "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$"
                  },
                  "drift_seconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 86400
                  }
                }
              },
              "methodology_digest": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "classification": {
                "type": "string",
                "enum": [
                  "in_force",
                  "before_effective",
                  "after_supersession",
                  "version_not_recorded",
                  "indeterminate"
                ]
              }
            }
          }
        },
        "summary": {
          "type": "object",
          "required": [
            "value_count",
            "in_force_count",
            "before_effective_count",
            "after_supersession_count",
            "version_not_recorded_count",
            "indeterminate_count",
            "flagged_count"
          ],
          "additionalProperties": false,
          "properties": {
            "value_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "in_force_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "before_effective_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "after_supersession_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "version_not_recorded_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "indeterminate_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            },
            "flagged_count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          }
        },
        "committed_at": {
          "type": "object",
          "required": [
            "utc",
            "drift_seconds"
          ],
          "additionalProperties": false,
          "properties": {
            "utc": {
              "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$"
            },
            "drift_seconds": {
              "type": "integer",
              "minimum": 0,
              "maximum": 86400
            }
          }
        },
        "boundary": {
          "type": "string",
          "minLength": 1,
          "const": "This receipt records which methodology version, identified by the digest of its document, was declared in force for each published value, presented as a salted commitment, together with the recorded document publication, notice, consultation and effective instants of each version, and the classification Hive recomputed for each value from those instants under the declared drift bounds. Hive records and checks; it does not decide, block, enforce or sit in the access path. A receipt shows what was recorded and when, not that it was correct. It does not establish that any methodology is sound, that any notice or consultation was adequate, that any value is accurate, or that any version was in fact applied to produce any value. The methodology documents and the values themselves never enter this receipt, and every instant is presented as reported by the recording party, except the recording instant, which is the signing instant of this envelope."
        }
      }
    }
  }
}