{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://cladone.com/schemas/publisher-feed.schema.json",
  "title": "Cladone publisher feed",
  "description": "A signed document maintained by the publisher listing the components known to fit together (Gate One versions, external components, plugins), their version-compatibility rules and their revocation status. The feed only narrows trust (revocations) and advises (compatibility); the operator's local trust store stays authoritative.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "kind",
    "signature"
  ],
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 1,
      "description": "Feed schema version. Always 1."
    },
    "kind": {
      "type": "string",
      "const": "publisher-feed",
      "description": "Document kind. Always publisher-feed."
    },
    "publisher": {
      "type": "string",
      "description": "Publisher identity."
    },
    "generatedAt": {
      "type": "string",
      "description": "RFC 3339 timestamp of generation."
    },
    "validUntil": {
      "type": "string",
      "description": "RFC 3339 timestamp after which the feed is stale. In enforce mode a stale feed refuses new plugin loads."
    },
    "hosts": {
      "type": "array",
      "description": "Compatible Gate One releases.",
      "items": {
        "$ref": "#/definitions/host"
      }
    },
    "externalComponents": {
      "type": "array",
      "description": "Compatible non-Gate-One components (Redis, an IdP, …).",
      "items": {
        "$ref": "#/definitions/externalComponent"
      }
    },
    "plugins": {
      "type": "array",
      "description": "Known plugin releases and their status.",
      "items": {
        "$ref": "#/definitions/plugin"
      }
    },
    "revocations": {
      "type": "array",
      "description": "Revoked artefact digests or signing keys.",
      "items": {
        "$ref": "#/definitions/revocation"
      }
    },
    "signature": {
      "$ref": "#/definitions/signature"
    }
  },
  "definitions": {
    "host": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Component name (for example gate-one)."
        },
        "version": {
          "type": "string",
          "description": "Known-good version."
        },
        "hostAPI": {
          "type": "string",
          "description": "Host API constraint, for example >=1.0 <2.0."
        }
      }
    },
    "externalComponent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Component name (for example redis)."
        },
        "role": {
          "type": "string",
          "description": "Role in the deployment (session-store, idp, …)."
        },
        "constraint": {
          "type": "string",
          "description": "Supported version constraint."
        }
      }
    },
    "plugin": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Reverse-DNS plugin name."
        },
        "version": {
          "type": "string",
          "description": "Plugin version."
        },
        "digest": {
          "type": "string",
          "description": "Artefact digest (sha256:<hex>)."
        },
        "publisher": {
          "type": "string",
          "description": "Author/company that published the plugin (shown in a registry page)."
        },
        "distribution": {
          "type": "string",
          "description": "URL where the plugin (artefact + signed manifest + public key) is distributed."
        },
        "hostAPI": {
          "type": "string",
          "description": "Host API constraint, for example >=1.0 <2.0."
        },
        "capabilities": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Declared capabilities."
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "deprecated",
            "revoked"
          ],
          "description": "Release status. revoked refuses the plugin in enforce mode (when a digest is present)."
        },
        "requires": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Version constraints on other components, for example {\"gate-one\": \">=1.4 <2.0\"}."
        }
      }
    },
    "revocation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "digest": {
          "type": "string",
          "description": "Revoked artefact digest."
        },
        "keyId": {
          "type": "string",
          "description": "Revoked signing key id."
        },
        "reason": {
          "type": "string",
          "description": "misbehaviour, key-compromise, author-request, superseded, …"
        },
        "severity": {
          "type": "string",
          "description": "low, medium, high."
        },
        "revokedAt": {
          "type": "string",
          "description": "RFC 3339 timestamp."
        }
      }
    },
    "signature": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "alg",
        "keyId",
        "value"
      ],
      "properties": {
        "alg": {
          "type": "string",
          "const": "ed25519",
          "description": "Signature algorithm. Always ed25519."
        },
        "keyId": {
          "type": "string",
          "description": "Signing key id; must be in publisherFeed.keys."
        },
        "value": {
          "type": "string",
          "description": "Ed25519 signature (base64 raw URL) over the JCS canonical form of the feed with the signature removed."
        }
      }
    }
  }
}
