{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.3/project/person.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal drawings, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "Person",
  "description": "A person or an agent of the project's registry, project/people/<id>.json, list people (Part XIV, 5.1), with the keys of those who sign. Every file of Part XIV names people by these ids, never by an email address: an id that holds @ is the validator's to refuse (person-email). A name is personal data, kept in every version that holds it. A key is revoked by giving it a validUntil, never by removing it.",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "../drawings/defs.schema.json#/$defs/id"
    },
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "kind": {
      "type": "string",
      "enum": [
        "person",
        "agent"
      ]
    },
    "name": {
      "description": "The name printed or shown.",
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "organisation": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "roles": {
      "description": "The roles the project gives the person (approver, checker): plain values.",
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "../drawings/defs.schema.json#/$defs/role"
      }
    },
    "agent": {
      "description": "For an agent: the software.",
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        }
      },
      "required": [
        "name"
      ],
      "x-eik-closed": true
    },
    "keys": {
      "description": "The keys this person or agent signs with.",
      "type": "array",
      "maxItems": 20,
      "items": {
        "$ref": "#/$defs/key"
      }
    }
  },
  "required": [
    "id",
    "revision",
    "kind"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "kind": {
            "const": "agent"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "required": [
          "agent"
        ]
      }
    },
    {
      "properties": {
        "classifications": {
          "$ref": "../classifications/classifications.schema.json"
        }
      }
    }
  ],
  "x-eik-closed": true,
  "$defs": {
    "key": {
      "description": "A key: its id, unique in the registry (XIV.5.2, rule 4); its algorithm; the public key, base64 of its DER SubjectPublicKeyInfo; and the window it is valid in. A passkey's algorithm is ecdsa-p256 (ES256), and rpId the WebAuthn relying party it was registered with.",
      "type": "object",
      "properties": {
        "keyid": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "algorithm": {
          "type": "string",
          "enum": [
            "ed25519",
            "ecdsa-p256"
          ]
        },
        "public": {
          "$ref": "../drawings/defs.schema.json#/$defs/base64"
        },
        "validFrom": {
          "$ref": "../drawings/defs.schema.json#/$defs/time"
        },
        "validUntil": {
          "$ref": "../drawings/defs.schema.json#/$defs/time"
        },
        "rpId": {
          "description": "For a passkey: the WebAuthn relying party id it was registered with, a domain.",
          "type": "string",
          "minLength": 1,
          "maxLength": 253
        }
      },
      "required": [
        "keyid",
        "algorithm",
        "public",
        "validFrom"
      ],
      "x-eik-closed": true
    }
  }
}
