{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/phala/json-schema/phala-on-chain-kms-response-schema.json",
  "title": "OnChainKmsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/phala-kms-api-openapi.yml#/components/schemas/OnChainKmsResponse",
  "properties": {
    "chain_name": {
      "type": "string",
      "title": "Chain Name"
    },
    "chain_id": {
      "type": "integer",
      "title": "Chain Id"
    },
    "contracts": {
      "items": {
        "$ref": "#/$defs/OnChainKmsContractOut"
      },
      "type": "array",
      "title": "Contracts"
    }
  },
  "type": "object",
  "required": [
    "chain_name",
    "chain_id",
    "contracts"
  ],
  "$defs": {
    "OnChainDeviceOut": {
      "properties": {
        "device_id": {
          "type": "string",
          "title": "Device Id"
        },
        "node_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Node Name",
          "description": "Physical node name if available"
        },
        "on_chain_allowed": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "On Chain Allowed",
          "description": "null if check failed"
        }
      },
      "type": "object",
      "required": [
        "device_id"
      ],
      "title": "OnChainDeviceOut"
    },
    "OnChainKmsContractOut": {
      "properties": {
        "contract_address": {
          "type": "string",
          "title": "Contract Address"
        },
        "chain_id": {
          "type": "integer",
          "title": "Chain Id"
        },
        "chain_name": {
          "type": "string",
          "title": "Chain Name"
        },
        "devices": {
          "items": {
            "$ref": "#/$defs/OnChainDeviceOut"
          },
          "type": "array",
          "title": "Devices"
        },
        "os_images": {
          "items": {
            "$ref": "#/$defs/OnChainOsImageOut"
          },
          "type": "array",
          "title": "Os Images"
        }
      },
      "type": "object",
      "required": [
        "contract_address",
        "chain_id",
        "chain_name",
        "devices",
        "os_images"
      ],
      "title": "OnChainKmsContractOut"
    },
    "OnChainOsImageOut": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "version": {
          "type": "string",
          "title": "Version"
        },
        "os_image_hash": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Os Image Hash"
        },
        "on_chain_allowed": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "On Chain Allowed",
          "description": "null if no hash or check failed"
        }
      },
      "type": "object",
      "required": [
        "name",
        "version"
      ],
      "title": "OnChainOsImageOut"
    }
  }
}