{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://zk-sbom-passport.org/spec/eu-cra-audit-dossier-v1.schema.json",
  "title": "ZK-SBOM-PASSPORT EU CRA Regulatory Audit Dossier v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "payload", "dual_signature"],
  "properties": {
    "schema_version": { "type": "string", "const": "eu-cra-audit-dossier/v1" },
    "payload": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "dossier_id",
        "exported_at",
        "exporter_notes",
        "regulatory_frameworks",
        "manifest",
        "artifacts",
        "exporter_keys"
      ],
      "properties": {
        "dossier_id": { "type": "string", "pattern": "^[0-9a-f]{32}$" },
        "exported_at": { "type": "string", "format": "date-time" },
        "exporter_notes": { "type": "string", "maxLength": 512 },
        "regulatory_frameworks": {
          "type": "array",
          "minItems": 1,
          "maxItems": 16,
          "items": { "type": "string", "minLength": 2, "maxLength": 64 }
        },
        "manifest": {
          "type": "object",
          "additionalProperties": false,
          "required": ["passport_sha256", "policy_bundle_sha256"],
          "properties": {
            "passport_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "policy_bundle_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "revocation_list_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "scitt_consistency_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "annex7_vault_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "w3c_vc_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "status_list_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "sd_jwt_vc_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "rfc3161_timestamp_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
          }
        },
        "artifacts": {
          "type": "object",
          "additionalProperties": false,
          "required": ["passport", "policy_bundle"],
          "properties": {
            "passport": { "type": "object" },
            "policy_bundle": { "type": "object" },
            "revocation_list": { "type": "object" },
            "scitt_consistency": { "type": "object" },
            "annex7_vault": { "type": "object" },
            "w3c_vc": { "type": "object" },
            "status_list": { "type": "object" },
            "sd_jwt_vc": { "type": "string", "minLength": 20, "maxLength": 524288 },
            "rfc3161_timestamp_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{32,262144}$" }
          }
        },
        "exporter_keys": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": ["key_id", "ed25519_pk_b64u", "mldsa65_pk_b64u"],
              "properties": {
                "key_id": { "type": "string", "minLength": 3, "maxLength": 64 },
                "pq_alg": { "const": "ml-dsa-65" },
                "ed25519_pk_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" },
                "mldsa65_pk_b64u": { "type": "string", "minLength": 2000, "maxLength": 3000 }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": ["key_id", "pq_alg", "ed25519_pk_b64u", "mldsa87_pk_b64u"],
              "properties": {
                "key_id": { "type": "string", "minLength": 3, "maxLength": 64 },
                "pq_alg": { "const": "ml-dsa-87" },
                "ed25519_pk_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$" },
                "mldsa87_pk_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{3456}$" }
              }
            }
          ]
        }
      }
    },
    "dual_signature": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["digest_sha256", "ed25519_sig_b64u", "mldsa65_sig_b64u"],
          "properties": {
            "digest_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "pq_alg": { "const": "ml-dsa-65" },
            "ed25519_sig_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$" },
            "mldsa65_sig_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{4410,4420}$" }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["digest_sha256", "pq_alg", "ed25519_sig_b64u", "mldsa87_sig_b64u"],
          "properties": {
            "digest_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
            "pq_alg": { "const": "ml-dsa-87" },
            "ed25519_sig_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$" },
            "mldsa87_sig_b64u": { "type": "string", "pattern": "^[A-Za-z0-9_-]{6170}$" }
          }
        }
      ]
    }
  }
}
