{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.install-identity.v1.schema.json",
  "title": "cApp install identity v1",
  "type": "object",
  "required": [
    "protocol",
    "installId",
    "keyId",
    "algorithm",
    "publicKeyJwk"
  ],
  "properties": {
    "protocol": {
      "const": "capp.install-identity.v1"
    },
    "installId": {
      "type": "string",
      "minLength": 1
    },
    "keyId": {
      "type": "string",
      "minLength": 1
    },
    "algorithm": {
      "const": "Ed25519"
    },
    "appId": {
      "type": [
        "string",
        "null"
      ]
    },
    "siteId": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "storageProtection": {
      "type": [
        "string",
        "null"
      ]
    },
    "hardwareBacked": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "publicKeyJwk": {
      "type": "object",
      "required": [
        "kty",
        "crv",
        "x"
      ],
      "properties": {
        "kty": {
          "const": "OKP"
        },
        "crv": {
          "const": "Ed25519"
        },
        "x": {
          "type": "string",
          "minLength": 40
        },
        "kid": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
