{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:trust-revocation-snapshot:0.1",
  "title": "Kompletny snapshot unieważnień delegacji Junexis 0.1",
  "description": "Podpisany, kompletny zestaw unieważnionych delegacji dla dokładnych bajtów jednej rewizji junexis.trust-store/0.2.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "trustStoreRevision",
    "trustStoreSha256",
    "snapshotRevision",
    "issuedAt",
    "expiresAt",
    "revocations",
    "algorithm",
    "keyId",
    "signature"
  ],
  "properties": {
    "schemaVersion": { "const": "junexis.trust-revocation-snapshot/0.1" },
    "trustStoreRevision": { "type": "integer", "minimum": 1 },
    "trustStoreSha256": { "$ref": "#/$defs/sha256" },
    "snapshotRevision": { "type": "integer", "minimum": 1 },
    "issuedAt": { "$ref": "#/$defs/timestamp" },
    "expiresAt": { "$ref": "#/$defs/timestamp" },
    "revocations": {
      "type": "array",
      "maxItems": 256,
      "uniqueItems": true,
      "items": { "$ref": "#/$defs/revocation" }
    },
    "algorithm": { "const": "ecdsa-p256-sha256-der" },
    "keyId": { "$ref": "#/$defs/keyId" },
    "signature": {
      "type": "string",
      "minLength": 1,
      "contentEncoding": "base64"
    }
  },
  "$defs": {
    "keyId": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}(?![\\s\\S])"
    },
    "timestamp": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "revocation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["delegationKeyId", "kind", "revokedAt", "reason"],
      "properties": {
        "delegationKeyId": { "$ref": "#/$defs/keyId" },
        "kind": {
          "enum": ["security", "operational", "superseded"]
        },
        "revokedAt": { "$ref": "#/$defs/timestamp" },
        "reason": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      }
    }
  }
}
