{
  "$id": "https://sessionpipe.org/schema/v1/control-key.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 16,
          "maxLength": 1400,
          "pattern": "^[A-Za-z0-9_-]*$"
        },
        "alg": {
          "anyOf": [
            {
              "type": "number",
              "const": -7
            },
            {
              "type": "number",
              "const": -257
            }
          ]
        },
        "spki": {
          "type": "string",
          "minLength": 1,
          "pattern": "^[A-Za-z0-9_-]*$"
        }
      },
      "required": [
        "id",
        "alg",
        "spki"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{43}$"
        },
        "alg": {
          "type": "number",
          "const": -7
        },
        "spki": {
          "type": "string",
          "minLength": 1,
          "pattern": "^[A-Za-z0-9_-]*$"
        },
        "type": {
          "type": "string",
          "const": "device"
        },
        "store": {
          "type": "string",
          "const": "hardware"
        },
        "uv": {
          "type": "string",
          "const": "each-use"
        }
      },
      "required": [
        "id",
        "alg",
        "spki",
        "type",
        "store",
        "uv"
      ],
      "additionalProperties": false
    }
  ]
}
