{
  "protocol": "device",
  "imports": [
    {
      "path": "common.avdl",
      "type": "idl"
    }
  ],
  "types": [
    {
      "type": "record",
      "name": "DeviceDetail",
      "fields": [
        {
          "type": "Device",
          "name": "device"
        },
        {
          "type": "boolean",
          "name": "eldest"
        },
        {
          "type": [
            null,
            "Device"
          ],
          "name": "provisioner"
        },
        {
          "type": [
            null,
            "Time"
          ],
          "name": "provisionedAt"
        },
        {
          "type": [
            null,
            "Time"
          ],
          "name": "revokedAt"
        },
        {
          "type": "KID",
          "name": "revokedBy"
        },
        {
          "type": [
            null,
            "Device"
          ],
          "name": "revokedByDevice"
        },
        {
          "type": "boolean",
          "name": "currentDevice"
        }
      ]
    }
  ],
  "messages": {
    "deviceList": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        }
      ],
      "response": {
        "type": "array",
        "items": "Device"
      },
      "doc": "List devices for the user."
    },
    "deviceHistoryList": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        }
      ],
      "response": {
        "type": "array",
        "items": "DeviceDetail"
      },
      "doc": "List all devices with detailed history and status information."
    },
    "deviceAdd": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        }
      ],
      "response": null,
      "doc": "Starts the process of adding a new device using an existing\n    device.  It is called on the existing device.\n    This is for kex2."
    },
    "checkDeviceNameFormat": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "name",
          "type": "string"
        }
      ],
      "response": "boolean",
      "doc": "Checks the device name format."
    },
    "checkDeviceNameForUser": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "username",
          "type": "string"
        },
        {
          "name": "devicename",
          "type": "string"
        }
      ],
      "response": null,
      "doc": "Checks a given device against all of user's past devices,\n    including those that predate a reset. It will also check a device name\n    for proper formatting. Return null error on success, and a non-null\n    error otherwise."
    }
  },
  "namespace": "keybase.1"
}