{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:bringpass:draft:0.3:diagnostic-message",
  "title": "BringPass 0.3 diagnostic signed-message envelope",
  "description": "Not an HTTP API or NFC binding. Receivers MUST perform semantic and cryptographic checks; schema validation alone grants no authority. Sign the canonical bytes, not JSON text.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "fields",
    "signature"
  ],
  "properties": {
    "fields": {
      "oneOf": [
        {
          "type": "array",
          "prefixItems": [
            {
              "const": "CHALLENGE"
            },
            {
              "const": "0.3"
            },
            {
              "const": "Ed25519"
            },
            {
              "type": "string",
              "enum": [
                "REGISTER",
                "USE",
                "REVOKE",
                "RETRACT"
              ]
            },
            {
              "type": "string",
              "pattern": "^[0-9a-f]{32}$"
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            }
          ],
          "items": false,
          "minItems": 11,
          "maxItems": 11
        },
        {
          "type": "array",
          "prefixItems": [
            {
              "const": "PROOF"
            },
            {
              "const": "0.3"
            },
            {
              "const": "Ed25519"
            },
            {
              "type": "string",
              "enum": [
                "REGISTER",
                "USE",
                "REVOKE",
                "RETRACT"
              ]
            },
            {
              "type": "string",
              "pattern": "^[0-9a-f]{32}$"
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            }
          ],
          "items": false,
          "minItems": 11,
          "maxItems": 11
        },
        {
          "type": "array",
          "prefixItems": [
            {
              "const": "RESULT"
            },
            {
              "const": "0.3"
            },
            {
              "const": "Ed25519"
            },
            {
              "type": "string",
              "enum": [
                "REGISTER",
                "USE",
                "REVOKE",
                "RETRACT"
              ]
            },
            {
              "type": "string",
              "pattern": "^[0-9a-f]{32}$"
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            },
            {
              "type": "string",
              "maxLength": 4096
            }
          ],
          "items": false,
          "minItems": 14,
          "maxItems": 14
        }
      ]
    },
    "signature": {
      "type": "string",
      "pattern": "^[0-9a-f]{128}$"
    }
  }
}
