{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://makewine.app/spec/provenance/v1/proof.schema.json",
  "title": "MakeWine provenance proof bundle, merkle-v1 (DRAFT 1.0.0-draft)",
  "description": "A verification bundle for one signing that also carries the text of one or more leaves that were hidden on the page (SPEC.md section 10.2). A schema check is not a verification: run the steps of SPEC.md section 11.",
  "type": "object",
  "required": ["kind", "format", "specVersion", "publicToken", "wineId", "signerUserId", "signedAt", "signing",
    "keyId", "publicKeyPem", "previousRoot", "root", "message", "signature", "leaves", "proof"],
  "additionalProperties": false,
  "properties": {
    "kind": { "const": "proof" },
    "format": { "$ref": "bundle.schema.json#/$defs/format" },
    "specVersion": { "$ref": "bundle.schema.json#/$defs/specVersion" },
    "publicToken": { "$ref": "bundle.schema.json#/$defs/publicToken" },
    "wineId": { "$ref": "bundle.schema.json#/$defs/decimalId" },
    "signerUserId": { "$ref": "bundle.schema.json#/$defs/decimalId" },
    "signedAt": { "$ref": "bundle.schema.json#/$defs/signedAt" },
    "signing": { "$ref": "bundle.schema.json#/$defs/signing" },
    "keyId": { "$ref": "bundle.schema.json#/$defs/hex64" },
    "publicKeyPem": { "$ref": "bundle.schema.json#/$defs/publicKeyPem" },
    "previousRoot": { "$ref": "bundle.schema.json#/$defs/previousRoot" },
    "root": { "$ref": "bundle.schema.json#/$defs/hex64" },
    "message": { "$ref": "bundle.schema.json#/$defs/message" },
    "signature": { "$ref": "bundle.schema.json#/$defs/signature" },
    "leaves": { "$ref": "bundle.schema.json#/$defs/leaves" },
    "certificateLeaves": { "$ref": "bundle.schema.json#/$defs/certificateLeaves" },
    "proof": { "$ref": "#/$defs/proofInfo" }
  },
  "$defs": {
    "proofInfo": {
      "type": "object",
      "required": ["revealed", "generatedAt", "generatedBy"],
      "additionalProperties": false,
      "properties": {
        "revealed": { "type": "array", "minItems": 1, "items": { "$ref": "bundle.schema.json#/$defs/revealedName" } },
        "generatedAt": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" },
        "generatedBy": { "type": "string", "minLength": 1, "maxLength": 200 }
      }
    }
  }
}
