{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xcim.invalid/ietf/p1/schemas/msa.schema.json",
  "title": "P1 Message Signer Authorization payload",
  "type": "object", "additionalProperties": false,
  "required": ["proposal_version", "object_type", "authorization_id", "app_id", "app_epoch", "authority_epoch", "message_key", "roles", "purpose_ids", "authorization_kinds", "from_domains", "dkim_domains", "iat", "exp"],
  "properties": {
    "proposal_version": {"const": "p1"}, "object_type": {"const": "message_signer_authorization"},
    "authorization_id": {"$ref": "common.schema.json#/$defs/hash32"},
    "app_id": {"$ref": "common.schema.json#/$defs/app_id"},
    "app_epoch": {"$ref": "common.schema.json#/$defs/epoch"},
    "authority_epoch": {"$ref": "common.schema.json#/$defs/epoch"},
    "message_key": {
      "type": "object", "additionalProperties": false,
      "required": ["kid", "alg", "public_jwk", "public_key_thumbprint"],
      "properties": {
        "kid": {"$ref": "common.schema.json#/$defs/kid"},
        "alg": {"const": "Ed25519"},
        "public_jwk": {"$ref": "common.schema.json#/$defs/public_jwk"},
        "public_key_thumbprint": {"$ref": "common.schema.json#/$defs/hash32"}
      }
    },
    "roles": {"type": "array", "minItems": 1, "maxItems": 1, "items": {"const": "message_presentation"}},
    "purpose_ids": {"type": "array", "minItems": 1, "maxItems": 64, "uniqueItems": true, "items": {"$ref": "common.schema.json#/$defs/purpose_id"}},
    "authorization_kinds": {"type": "array", "minItems": 1, "maxItems": 1, "items": {"const": "explicit_consent"}},
    "from_domains": {"$ref": "common.schema.json#/$defs/domains"},
    "dkim_domains": {"$ref": "common.schema.json#/$defs/domains"},
    "iat": {"$ref": "common.schema.json#/$defs/time"},
    "exp": {"$ref": "common.schema.json#/$defs/time"}
  },
  "$comment": "No wildcard, subdelegation, grant authority or status field. Current authority/MSA revocation is external, unresolved G04/G05."
}
