{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flint-network/json-schema/flint-network-x401-verify-response-schema.json",
  "title": "X401VerifyResponse",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flint-network-openapi.json#/components/schemas/X401VerifyResponse",
  "type": "object",
  "required": [
    "ok",
    "protocol",
    "route",
    "verdict",
    "score",
    "record_id",
    "signed_record",
    "record",
    "x401"
  ],
  "properties": {
    "ok": {
      "const": true
    },
    "protocol": {
      "const": "x401"
    },
    "route": {
      "const": "/api/x401/verify"
    },
    "verdict": {
      "$ref": "#/$defs/VerdictDecision"
    },
    "score": {
      "type": "number",
      "minimum": 0,
      "maximum": 100
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "top_reasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "record_id": {
      "type": "string",
      "pattern": "^frv_"
    },
    "signed_record": {
      "type": "string"
    },
    "record": {
      "$ref": "#/$defs/HybridEnvelope"
    },
    "x401": {
      "type": "object",
      "required": [
        "request_id",
        "principal_attestation_source",
        "principal"
      ],
      "properties": {
        "request_id": {
          "const": "flint-principal-identity-v1"
        },
        "principal_attestation_source": {
          "const": "x401"
        },
        "principal": {
          "type": "object"
        }
      }
    }
  },
  "$defs": {
    "HybridEnvelope": {
      "type": "object",
      "required": [
        "jws"
      ],
      "properties": {
        "envelope_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "jws": {
          "type": "string",
          "description": "ES256 compact JWS."
        },
        "pq_signature": {
          "type": [
            "string",
            "null"
          ],
          "description": "Parallel ML-DSA-65 signature when configured."
        },
        "pq_kid": {
          "type": [
            "string",
            "null"
          ]
        },
        "pq_alg": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "VerdictDecision": {
      "type": "string",
      "enum": [
        "allow",
        "step_up",
        "review",
        "block"
      ]
    }
  }
}