{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://klast.club/.well-known/installer-security.schema.json",
  "title": "Klast installer security manifest",
  "type": "object",
  "required": [
    "schemaVersion",
    "product",
    "canonicalOrigin",
    "lastUpdated",
    "verificationPage",
    "securityContact",
    "securityTxt",
    "installerPreviews",
    "behavior",
    "networkEvent",
    "protectedArtifactDelivery",
    "artifactPolicy"
  ],
  "properties": {
    "schemaVersion": { "const": 1 },
    "product": { "type": "string", "minLength": 1 },
    "canonicalOrigin": { "type": "string", "format": "uri" },
    "lastUpdated": { "type": "string", "format": "date" },
    "verificationPage": { "type": "string", "format": "uri" },
    "securityContact": { "type": "string", "format": "uri" },
    "securityTxt": { "type": "string", "format": "uri" },
    "sourceMirrors": {
      "type": "object",
      "required": ["shell"],
      "properties": {
        "shell": {
          "type": "object",
          "required": [
            "scriptVersion",
            "currentPlainTextUrl",
            "immutablePlainTextUrl",
            "immutableChecksumUrl",
            "releaseManifestUrl"
          ],
          "properties": {
            "scriptVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
            "currentPlainTextUrl": { "type": "string", "format": "uri" },
            "immutablePlainTextUrl": { "type": "string", "format": "uri" },
            "immutableChecksumUrl": { "type": "string", "format": "uri" },
            "releaseManifestUrl": { "type": "string", "format": "uri" }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "installerPreviews": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["platform", "path", "url", "mediaType", "sha256", "checksumUrl"],
        "properties": {
          "platform": { "type": "string" },
          "path": { "type": "string", "pattern": "^/" },
          "url": { "type": "string", "format": "uri" },
          "mediaType": { "type": "string" },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "checksumUrl": { "type": "string", "format": "uri" }
        },
        "additionalProperties": false
      }
    },
    "behavior": {
      "type": "object",
      "required": [
        "purpose",
        "downloadsExecutable",
        "writesFilesystem",
        "requiresElevatedPrivileges",
        "installsApplication",
        "claimsPackageDownloaded",
        "progressLabel",
        "terminalOutcome",
        "exitCode"
      ],
      "properties": {
        "purpose": { "const": "terminal compatibility preview" },
        "downloadsExecutable": { "const": false },
        "writesFilesystem": { "const": false },
        "requiresElevatedPrivileges": { "const": false },
        "installsApplication": { "const": false },
        "claimsPackageDownloaded": { "const": false },
        "progressLabel": { "const": "compatibility preview" },
        "terminalOutcome": { "type": "string", "minLength": 1 },
        "exitCode": { "const": 0 }
      },
      "additionalProperties": false
    },
    "networkEvent": {
      "type": "object",
      "required": [
        "method",
        "url",
        "timing",
        "bestEffort",
        "consentRequired",
        "defaultEnabled",
        "collectionTiming",
        "clientReportedFields",
        "serverObservedOrDerivedFields",
        "purpose",
        "storage",
        "delivery",
        "retention",
        "retentionDays",
        "deliveredNotificationRetention"
      ],
      "properties": {
        "method": { "const": "POST" },
        "url": { "type": "string", "format": "uri" },
        "timing": { "type": "string", "minLength": 1 },
        "bestEffort": { "const": true },
        "consentRequired": { "const": false },
        "defaultEnabled": { "const": true },
        "collectionTiming": { "type": "string", "minLength": 1 },
        "clientReportedFields": { "type": "array", "items": { "type": "string" } },
        "serverObservedOrDerivedFields": { "type": "array", "items": { "type": "string" } },
        "purpose": { "type": "string", "minLength": 1 },
        "storage": { "type": "string", "minLength": 1 },
        "delivery": { "type": "string", "minLength": 1 },
        "retention": { "type": "string", "minLength": 1 },
        "retentionDays": { "const": 30 },
        "deliveredNotificationRetention": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "protectedArtifactDelivery": { "type": "object" },
    "artifactPolicy": { "type": "object" }
  },
  "additionalProperties": true
}
