{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xcim.invalid/ietf/p1/schemas/common.schema.json",
  "title": "P1 local development definitions; not a published schema URI",
  "$defs": {
    "hash32": {"type": "string", "minLength": 43, "maxLength": 43, "pattern": "^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$"},
    "signature64": {"type": "string", "minLength": 86, "maxLength": 86, "pattern": "^[A-Za-z0-9_-]{85}[AQgw]$"},
    "segment": {"type": "string", "minLength": 1, "maxLength": 65536, "pattern": "^[A-Za-z0-9_-]+$"},
    "epoch": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
    "time": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},
    "kid": {"type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[A-Za-z0-9._~:/#-]+$"},
    "issuer": {"type": "string", "format": "uri", "maxLength": 2048, "pattern": "^https://[^\\s]+$"},
    "app_id": {"type": "string", "maxLength": 256, "pattern": "^urn:xcim:app:[A-Za-z0-9._~-]+$"},
    "receipt_id": {"type": "string", "maxLength": 256, "pattern": "^urn:xcim:receipt:[A-Za-z0-9._~-]+$"},
    "permission_id": {"type": "string", "maxLength": 256, "pattern": "^urn:xcim:permission:[A-Za-z0-9._~-]+$"},
    "purpose_id": {"type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9._~:-]+$"},
    "domain": {"type": "string", "format": "hostname", "maxLength": 253, "pattern": "^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$"},
    "domains": {"type": "array", "minItems": 1, "maxItems": 64, "uniqueItems": true, "items": {"$ref": "#/$defs/domain"}},
    "public_jwk": {
      "type": "object", "additionalProperties": false,
      "required": ["kty", "crv", "x"],
      "properties": {"kty": {"const": "OKP"}, "crv": {"const": "Ed25519"}, "x": {"$ref": "#/$defs/hash32"}}
    }
  }
}
