{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Protected per-transaction enrollment configuration, format 1",
  "description": "Protected per-transaction enrollment configuration. Runtime validates identity-source pins, requester permissions, mapping/alias correspondence, connection/OID selection and cross-field limits. Dynamic SCEP requires distinct target/message parent namespaces. PKCS11 sessions use fixed issuance/document workers and original-capsule cleanup. Registration/profile budgets and pinned contract contents are validated before use.",
  "type": "object",
  "required": [
    "schema_version",
    "enabled",
    "profile",
    "crypto",
    "certificate_policy",
    "document_key_fingerprints",
    "access_configuration_sha256",
    "manager",
    "rest_identity",
    "issuance",
    "connections_configuration_sha256"
  ],
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "const": 1
    },
    "enabled": {
      "const": true
    },
    "profile": {
      "oneOf": [
        {
          "$ref": "#/$defs/legacyProfile"
        },
        {
          "$ref": "#/$defs/estProfile"
        }
      ]
    },
    "crypto": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "backend",
            "directory",
            "identity",
            "password_file"
          ],
          "additionalProperties": false,
          "properties": {
            "backend": {
              "const": "PKCS12"
            },
            "directory": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            },
            "identity": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            },
            "password_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        },
        {
          "type": "object",
          "required": [
            "backend",
            "directory",
            "identity",
            "pin_file",
            "module_file",
            "module_sha256",
            "slot",
            "token_label",
            "token_serial"
          ],
          "additionalProperties": false,
          "properties": {
            "backend": {
              "const": "PKCS11"
            },
            "directory": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            },
            "identity": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            },
            "pin_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            },
            "module_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            },
            "module_sha256": {
              "type": "string",
              "minLength": 64,
              "maxLength": 64,
              "pattern": "^[a-f0-9]{64}$"
            },
            "slot": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775807
            },
            "token_label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32,
              "pattern": "^[ -~]+$"
            },
            "token_serial": {
              "type": "string",
              "minLength": 1,
              "maxLength": 16,
              "pattern": "^[ -~]+$"
            }
          }
        }
      ]
    },
    "certificate_policy": {
      "type": "object",
      "required": [
        "roots",
        "crls",
        "maximum_lifetime_seconds",
        "maximum_backdating_seconds",
        "minimum_remaining_seconds",
        "staging_retention_seconds",
        "content_commitment",
        "extended_key_usages",
        "certificate_policies",
        "signature_oids",
        "revocation",
        "maximum_crl_age_seconds"
      ],
      "additionalProperties": false,
      "properties": {
        "roots": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/publicFile"
          },
          "maxItems": 8,
          "minItems": 1,
          "uniqueItems": true
        },
        "crls": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/publicFile"
          },
          "maxItems": 8,
          "minItems": 0,
          "uniqueItems": true
        },
        "maximum_lifetime_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 31622400
        },
        "maximum_backdating_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 604800
        },
        "minimum_remaining_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 31622400
        },
        "staging_retention_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2592000
        },
        "content_commitment": {
          "type": "boolean"
        },
        "extended_key_usages": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 3,
            "maxLength": 128
          },
          "maxItems": 8,
          "minItems": 0,
          "uniqueItems": true
        },
        "certificate_policies": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 3,
            "maxLength": 128
          },
          "maxItems": 8,
          "minItems": 0,
          "uniqueItems": true
        },
        "signature_oids": {
          "type": "array",
          "items": {
            "enum": [
              "1.2.840.113549.1.1.11",
              "1.2.840.113549.1.1.12",
              "1.2.840.113549.1.1.13",
              "1.2.840.10045.4.3.2",
              "1.2.840.10045.4.3.3",
              "1.2.840.10045.4.3.4"
            ]
          },
          "maxItems": 8,
          "minItems": 1,
          "uniqueItems": true
        },
        "revocation": {
          "enum": [
            "EXPLICIT_NONE",
            "REQUIRE_OFFLINE_CRLS"
          ]
        },
        "maximum_crl_age_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 604800
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "revocation": {
                "const": "EXPLICIT_NONE"
              }
            }
          },
          "then": {
            "properties": {
              "crls": {
                "maxItems": 0
              },
              "maximum_crl_age_seconds": {
                "const": 0
              }
            }
          },
          "else": {
            "properties": {
              "crls": {
                "minItems": 1
              },
              "maximum_crl_age_seconds": {
                "minimum": 1
              }
            }
          }
        }
      ]
    },
    "document_key_fingerprints": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 64,
        "maxLength": 64,
        "pattern": "^[a-f0-9]{64}$"
      },
      "maxItems": 256,
      "minItems": 0,
      "uniqueItems": true
    },
    "rest": {
      "type": "object",
      "required": [
        "submit",
        "lookup",
        "request_template",
        "response_mapping",
        "lookup_response_mapping",
        "registered_values",
        "maximum_exchange_ms"
      ],
      "additionalProperties": false,
      "properties": {
        "submit": {
          "type": "object",
          "required": [
            "endpoint",
            "authentication"
          ],
          "additionalProperties": false,
          "properties": {
            "endpoint": {
              "$ref": "#/$defs/endpoint"
            },
            "authentication": {
              "$ref": "#/$defs/authentication"
            }
          }
        },
        "lookup": {
          "type": "object",
          "required": [
            "endpoint",
            "authentication",
            "method",
            "append_reference"
          ],
          "additionalProperties": false,
          "properties": {
            "endpoint": {
              "$ref": "#/$defs/endpoint"
            },
            "authentication": {
              "$ref": "#/$defs/authentication"
            },
            "method": {
              "enum": [
                "GET",
                "POST"
              ]
            },
            "append_reference": {
              "type": "boolean"
            },
            "request_template": {
              "$ref": "external-pki-rest.request-template.schema.json"
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "method": {
                    "const": "GET"
                  }
                }
              },
              "then": {
                "properties": {
                  "append_reference": {
                    "const": true
                  }
                },
                "not": {
                  "required": [
                    "request_template"
                  ]
                }
              },
              "else": {
                "required": [
                  "request_template"
                ]
              }
            }
          ]
        },
        "request_template": {
          "$ref": "external-pki-rest.request-template.schema.json"
        },
        "response_mapping": {
          "$ref": "external-pki-rest.response-mapping.schema.json"
        },
        "lookup_response_mapping": {
          "$ref": "external-pki-rest.response-mapping.schema.json"
        },
        "registered_values": {
          "type": "object",
          "maxProperties": 0
        },
        "maximum_exchange_ms": {
          "type": "integer",
          "minimum": 100,
          "maximum": 30000
        }
      }
    },
    "scep": {
      "type": "object",
      "required": [
        "remote",
        "ca_chain",
        "response_signer",
        "request_encryption",
        "challenge_file",
        "challenge_sha256",
        "protocol_directory",
        "maximum_exchange_ms"
      ],
      "additionalProperties": false,
      "properties": {
        "remote": {
          "type": "object",
          "required": [
            "endpoint",
            "authentication"
          ],
          "additionalProperties": false,
          "properties": {
            "endpoint": {
              "$ref": "#/$defs/endpoint"
            },
            "authentication": {
              "oneOf": [
                {
                  "$ref": "#/$defs/authentication"
                },
                {
                  "type": "object",
                  "required": [
                    "type",
                    "not_before",
                    "expires_at"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "type": {
                      "const": "SCEP_NATIVE"
                    },
                    "not_before": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096,
                      "format": "date-time"
                    },
                    "expires_at": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096,
                      "format": "date-time"
                    }
                  }
                }
              ]
            }
          }
        },
        "ca_chain": {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/publicFile"
          }
        },
        "response_signer": {
          "$ref": "#/$defs/publicFile"
        },
        "request_encryption": {
          "$ref": "#/$defs/publicFile"
        },
        "challenge_file": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "challenge_sha256": {
          "type": "string",
          "minLength": 64,
          "maxLength": 64,
          "pattern": "^[a-f0-9]{64}$"
        },
        "protocol_directory": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "response_content": {
          "enum": [
            "RFC_DATA",
            "XIPKI_6_7_1_TYPED_ENVELOPE"
          ],
          "default": "RFC_DATA"
        },
        "maximum_exchange_ms": {
          "type": "integer",
          "minimum": 100,
          "maximum": 30000
        }
      }
    },
    "est": {
      "type": "object",
      "required": [
        "remote",
        "ca_chain",
        "csr_attributes_profile",
        "identity_pop_linkage",
        "maximum_exchange_ms"
      ],
      "additionalProperties": false,
      "properties": {
        "remote": {
          "type": "object",
          "required": [
            "endpoint",
            "authentication"
          ],
          "additionalProperties": false,
          "properties": {
            "endpoint": {
              "allOf": [
                {
                  "$ref": "#/$defs/endpoint"
                },
                {
                  "properties": {
                    "url": {
                      "type": "string",
                      "maxLength": 2036,
                      "pattern": "^https://[^?#%]+/$"
                    }
                  }
                }
              ]
            },
            "authentication": {
              "$ref": "#/$defs/estAuthentication"
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "authentication": {
                    "properties": {
                      "type": {
                        "const": "MTLS"
                      }
                    }
                  }
                }
              },
              "then": {
                "properties": {
                  "endpoint": {
                    "required": [
                      "client_identity"
                    ]
                  }
                }
              }
            }
          ]
        },
        "ca_chain": {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/publicFile"
          }
        },
        "csr_attributes_profile": {
          "enum": [
            "RFC9908",
            "XIPKI_6_7_1_LEGACY_RSA_HINTS"
          ]
        },
        "identity_pop_linkage": {
          "const": "UNLINKED",
          "description": "Required linkage modes are unsupported and reject before key work; no invented tls-unique/exporter."
        },
        "maximum_exchange_ms": {
          "type": "integer",
          "minimum": 100,
          "maximum": 30000
        }
      }
    },
    "access_configuration_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "manager": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "directory",
        "maximum_operations",
        "maximum_sessions",
        "public_retention_seconds",
        "reconciliation_interval_ms",
        "maximum_reconciliations"
      ],
      "properties": {
        "directory": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "maximum_operations": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096
        },
        "maximum_sessions": {
          "type": "integer",
          "minimum": 1,
          "maximum": 64
        },
        "public_retention_seconds": {
          "type": "integer",
          "minimum": 60,
          "maximum": 2592000
        },
        "reconciliation_interval_ms": {
          "type": "integer",
          "minimum": 100,
          "maximum": 30000
        },
        "maximum_reconciliations": {
          "type": "integer",
          "minimum": 1,
          "maximum": 96
        }
      }
    },
    "rest_identity": {
      "type": "object",
      "maxProperties": 8,
      "additionalProperties": false,
      "patternProperties": {
        "^[A-Za-z][A-Za-z0-9_]{0,63}$": {
          "type": "string",
          "format": "uri",
          "maxLength": 256
        }
      }
    },
    "issuance": {
      "type": "array",
      "minItems": 1,
      "maxItems": 16,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "connection": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"
          },
          "requesters": {
            "type": "array",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 256
            }
          },
          "identity_anchor_attribute": {
            "type": "string",
            "format": "uri",
            "maxLength": 256
          },
          "rdns": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "oid"
              ],
              "properties": {
                "oid": {
                  "type": "string",
                  "pattern": "^[0-9]+(\\.[0-9]+)+$"
                },
                "attribute": {
                  "type": "string",
                  "format": "uri",
                  "maxLength": 256
                },
                "constant": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                }
              },
              "oneOf": [
                {
                  "required": [
                    "attribute"
                  ],
                  "not": {
                    "required": [
                      "constant"
                    ]
                  }
                },
                {
                  "required": [
                    "constant"
                  ],
                  "not": {
                    "required": [
                      "attribute"
                    ]
                  }
                }
              ]
            }
          },
          "alternative_names": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "enum": [
                    "URI",
                    "DNS",
                    "EMAIL"
                  ]
                },
                "attribute": {
                  "type": "string",
                  "format": "uri",
                  "maxLength": 256
                },
                "constant": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                }
              },
              "oneOf": [
                {
                  "required": [
                    "attribute"
                  ],
                  "not": {
                    "required": [
                      "constant"
                    ]
                  }
                },
                {
                  "required": [
                    "constant"
                  ],
                  "not": {
                    "required": [
                      "attribute"
                    ]
                  }
                }
              ]
            }
          },
          "rsa_bits": {
            "enum": [
              2048,
              3072,
              4096
            ]
          },
          "maximum_identity_age_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          },
          "maximum_live_issuance_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          },
          "maximum_polls": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32
          },
          "maximum_continuations": {
            "type": "integer",
            "minimum": 0,
            "maximum": 32
          }
        },
        "required": [
          "connection",
          "requesters",
          "identity_anchor_attribute",
          "rdns",
          "alternative_names",
          "rsa_bits",
          "maximum_identity_age_seconds",
          "maximum_live_issuance_seconds",
          "maximum_polls",
          "maximum_continuations"
        ]
      }
    },
    "connections_configuration_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "native_environment": {
      "$ref": "#/$defs/publicFile",
      "description": "Mandatory protected exact native environment-file pin for PKCS11 dynamic document sessions; forbidden for PKCS12."
    }
  },
  "allOf": [
    {
      "oneOf": [
        {
          "required": [
            "rest"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "scep"
                ]
              },
              {
                "required": [
                  "est"
                ]
              }
            ]
          }
        },
        {
          "required": [
            "scep"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "rest"
                ]
              },
              {
                "required": [
                  "est"
                ]
              }
            ]
          }
        },
        {
          "required": [
            "est"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "rest"
                ]
              },
              {
                "required": [
                  "scep"
                ]
              }
            ]
          }
        }
      ]
    },
    {
      "if": {
        "required": [
          "est"
        ]
      },
      "then": {
        "properties": {
          "profile": {
            "$ref": "#/$defs/estProfile"
          }
        }
      },
      "else": {
        "properties": {
          "profile": {
            "$ref": "#/$defs/legacyProfile"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "crypto": {
            "properties": {
              "backend": {
                "const": "PKCS11"
              }
            }
          }
        }
      },
      "then": {
        "required": [
          "native_environment"
        ]
      },
      "else": {
        "not": {
          "required": [
            "native_environment"
          ]
        }
      }
    },
    {
      "if": {
        "not": {
          "required": [
            "est"
          ]
        }
      },
      "then": {
        "properties": {
          "issuance": {
            "items": {
              "properties": {
                "maximum_continuations": {
                  "const": 0
                }
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "est"
        ],
        "properties": {
          "profile": {
            "required": [
              "request_contract"
            ],
            "properties": {
              "request_contract": {
                "const": "NATIVE_SYNCHRONOUS"
              }
            }
          }
        }
      },
      "then": {
        "properties": {
          "issuance": {
            "items": {
              "properties": {
                "maximum_continuations": {
                  "const": 0
                }
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "est"
        ],
        "properties": {
          "profile": {
            "required": [
              "request_contract"
            ],
            "properties": {
              "request_contract": {
                "const": "REGISTERED_STATIC_CSR_REPEAT"
              }
            }
          }
        }
      },
      "then": {
        "properties": {
          "issuance": {
            "items": {
              "properties": {
                "maximum_continuations": {
                  "minimum": 1,
                  "maximum": 32
                }
              }
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "publicFile": {
      "type": "object",
      "required": [
        "file",
        "sha256"
      ],
      "additionalProperties": false,
      "properties": {
        "file": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "sha256": {
          "type": "string",
          "minLength": 64,
          "maxLength": 64,
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "clientIdentity": {
      "type": "object",
      "required": [
        "file",
        "password_file",
        "alias",
        "certificate_sha256",
        "public_key_fingerprint"
      ],
      "additionalProperties": false,
      "properties": {
        "file": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "password_file": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "alias": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
        },
        "certificate_sha256": {
          "type": "string",
          "minLength": 64,
          "maxLength": 64,
          "pattern": "^[a-f0-9]{64}$"
        },
        "public_key_fingerprint": {
          "type": "string",
          "minLength": 64,
          "maxLength": 64,
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "endpoint": {
      "type": "object",
      "required": [
        "url",
        "connect_address",
        "trust_roots"
      ],
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048,
          "pattern": "^https://",
          "format": "uri"
        },
        "connect_address": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "trust_roots": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/publicFile"
          },
          "maxItems": 8,
          "minItems": 1,
          "uniqueItems": true
        },
        "client_identity": {
          "$ref": "#/$defs/clientIdentity"
        }
      }
    },
    "authentication": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "MTLS"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at",
            "username",
            "secret_file"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "BASIC"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "username": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "secret_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at",
            "header",
            "secret_file"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "API_KEY"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "header": {
              "type": "string",
              "minLength": 3,
              "maxLength": 63,
              "pattern": "^X-[A-Za-z0-9-]{1,61}$"
            },
            "secret_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at",
            "secret_file"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "BEARER"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "secret_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at",
            "token_endpoint",
            "client_id",
            "secret_file",
            "scopes",
            "parameters"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "OAUTH2_CLIENT_CREDENTIALS"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "token_endpoint": {
              "$ref": "#/$defs/endpoint"
            },
            "client_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "secret_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            },
            "scopes": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[\\x21\\x23-\\x5b\\x5d-\\x7e]+$"
              },
              "maxItems": 8,
              "minItems": 1,
              "uniqueItems": true
            },
            "parameters": {
              "type": "object",
              "required": [],
              "additionalProperties": false,
              "properties": {
                "audience": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512
                },
                "resource": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512
                }
              }
            }
          }
        }
      ]
    },
    "legacyProfile": {
      "type": "object",
      "required": [
        "provider",
        "profile",
        "correlation",
        "lookup_contract"
      ],
      "additionalProperties": false,
      "properties": {
        "provider": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
        },
        "profile": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
        },
        "correlation": {
          "enum": [
            "ISSUER_ORDER_ID",
            "CLIENT_OPERATION_ID"
          ]
        },
        "lookup_contract": {
          "const": "REGISTERED_READ_ONLY"
        }
      }
    },
    "estProfile": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "provider",
            "profile",
            "correlation",
            "request_contract"
          ],
          "additionalProperties": false,
          "properties": {
            "provider": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
            },
            "profile": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
            },
            "correlation": {
              "const": "NONE"
            },
            "request_contract": {
              "const": "NATIVE_SYNCHRONOUS"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "provider",
            "profile",
            "correlation",
            "request_contract",
            "maximum_continuations",
            "repeat_registration"
          ],
          "additionalProperties": false,
          "properties": {
            "provider": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
            },
            "profile": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
            },
            "correlation": {
              "const": "NONE"
            },
            "request_contract": {
              "const": "REGISTERED_STATIC_CSR_REPEAT"
            },
            "maximum_continuations": {
              "type": "integer",
              "minimum": 1,
              "maximum": 32
            },
            "repeat_registration": {
              "type": "object",
              "required": [
                "contract_id",
                "contract"
              ],
              "additionalProperties": false,
              "description": "Trusted installation registration backed by an owner-only pinned local contract document. Config-check validates references only; online preflight verifies document/hash and exact endpoint/provider/profile/budget. The record asserts separately verified remote semantics; it is not proof supplied by HTTP202.",
              "properties": {
                "contract_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
                },
                "contract": {
                  "$ref": "#/$defs/publicFile"
                }
              }
            }
          }
        }
      ]
    },
    "estAuthentication": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "MTLS"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type",
            "not_before",
            "expires_at",
            "username",
            "secret_file"
          ],
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "BASIC"
            },
            "not_before": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "expires_at": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "format": "date-time"
            },
            "username": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "secret_file": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        }
      ]
    }
  }
}
