{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.native-auth-state.v1.schema.json",
  "title": "cApp native auth state v1",
  "type": "object",
  "required": [
    "protocol",
    "authenticated"
  ],
  "properties": {
    "protocol": {
      "const": "capp.native-auth-state.v1"
    },
    "ok": {
      "type": "boolean"
    },
    "authenticated": {
      "type": "boolean"
    },
    "lease": {
      "type": [
        "object",
        "null"
      ],
      "description": "Scrubbed non-secret lease metadata only."
    },
    "user": {
      "type": [
        "object",
        "null"
      ]
    },
    "storageProtection": {
      "type": [
        "string",
        "null"
      ]
    },
    "hardwareBacked": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "pendingHandoff": {
      "type": "boolean"
    },
    "recovery": {
      "anyOf": [
        {
          "$ref": "capp.native-auth-handoff.v1.schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "recoveryError": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "not": {
    "anyOf": [
      {
        "required": [
          "token"
        ]
      },
      {
        "required": [
          "bearer"
        ]
      },
      {
        "required": [
          "accessToken"
        ]
      },
      {
        "required": [
          "access_token"
        ]
      }
    ]
  },
  "additionalProperties": true
}
