{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://iamar.world/schemas/signature-0.schema.json",
  "title": "iamar world package signature (format 0)",
  "description": "signature.json beside manifest.json. Signs the SHA-256 of every other file in the package. See docs/WORLD_FORMAT.md, 'Signing'.",
  "type": "object",
  "required": ["format", "format_version", "algorithm", "key_id", "public_key", "files", "signature"],
  "additionalProperties": false,
  "properties": {
    "format": {"const": "iamar-signature"},
    "format_version": {"const": 0},
    "algorithm": {"const": "RSA-PKCS1-v1_5-SHA256"},
    "signer": {"type": "string", "maxLength": 80, "description": "The signer's own claim; informational."},
    "key_id": {"type": "string", "pattern": "^rsa:[0-9a-f]{32}$", "description": "rsa: + first 16 bytes (hex) of SHA-256 over the DER SubjectPublicKeyInfo."},
    "public_key": {"type": "string", "description": "PEM 'PUBLIC KEY' (SubjectPublicKeyInfo), RSA 2048 bits or more."},
    "signed_at": {"type": "string", "description": "ISO 8601 UTC; informational."},
    "files": {
      "type": "object",
      "description": "Every file of the package except signature.json itself: path -> lowercase hex SHA-256.",
      "additionalProperties": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
    },
    "signature": {"type": "string", "description": "Base64 RSA signature over the signing text (see docs)."}
  }
}
