{
  "protocol": "crypto",
  "imports": [
    {
      "path": "common.avdl",
      "type": "idl"
    }
  ],
  "types": [
    {
      "type": "fixed",
      "name": "ED25519PublicKey",
      "size": "32"
    },
    {
      "type": "fixed",
      "name": "ED25519Signature",
      "size": "64"
    },
    {
      "type": "record",
      "name": "ED25519SignatureInfo",
      "fields": [
        {
          "type": "ED25519Signature",
          "name": "sig"
        },
        {
          "type": "ED25519PublicKey",
          "name": "publicKey"
        }
      ]
    },
    {
      "type": "fixed",
      "name": "EncryptedBytes32",
      "size": "48"
    },
    {
      "type": "fixed",
      "name": "BoxNonce",
      "size": "24"
    },
    {
      "type": "fixed",
      "name": "BoxPublicKey",
      "size": "32"
    },
    {
      "type": "record",
      "name": "CiphertextBundle",
      "fields": [
        {
          "type": "KID",
          "name": "kid"
        },
        {
          "type": "EncryptedBytes32",
          "name": "ciphertext"
        },
        {
          "type": "BoxNonce",
          "name": "nonce"
        },
        {
          "type": "BoxPublicKey",
          "name": "publicKey"
        }
      ]
    },
    {
      "type": "record",
      "name": "UnboxAnyRes",
      "fields": [
        {
          "type": "KID",
          "name": "kid"
        },
        {
          "type": "Bytes32",
          "name": "plaintext"
        },
        {
          "type": "int",
          "name": "index"
        }
      ]
    }
  ],
  "messages": {
    "signED25519": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "msg",
          "type": "bytes"
        },
        {
          "name": "reason",
          "type": "string"
        }
      ],
      "response": "ED25519SignatureInfo",
      "doc": "Sign the given message (which should be small) using the device's private\n    signing ED25519 key, and return the signature as well as the corresponding\n    public key that can be used to verify the signature. The 'reason' parameter\n    is used as part of the SecretEntryArg object passed into\n    secretUi.getSecret()."
    },
    "signED25519ForKBFS": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "msg",
          "type": "bytes"
        },
        {
          "name": "reason",
          "type": "string"
        }
      ],
      "response": "ED25519SignatureInfo",
      "doc": "Same as the above except a KBFS-specific prefix is added to the payload to be signed."
    },
    "signToString": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "msg",
          "type": "bytes"
        },
        {
          "name": "reason",
          "type": "string"
        }
      ],
      "response": "string",
      "doc": "Same as the above except the full marsheled and encoded NaclSigInfo."
    },
    "unboxBytes32": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "encryptedBytes32",
          "type": "EncryptedBytes32"
        },
        {
          "name": "nonce",
          "type": "BoxNonce"
        },
        {
          "name": "peersPublicKey",
          "type": "BoxPublicKey"
        },
        {
          "name": "reason",
          "type": "string"
        }
      ],
      "response": "Bytes32",
      "doc": "Decrypt exactly 32 bytes using nacl/box with the given nonce, the given\n    peer's public key, and the device's private encryption key, and return the\n    decrypted data. The 'reason' parameter is used as part of the\n    SecretEntryArg object passed into secretUi.getSecret()."
    },
    "unboxBytes32Any": {
      "request": [
        {
          "name": "sessionID",
          "type": "int"
        },
        {
          "name": "bundles",
          "type": {
            "type": "array",
            "items": "CiphertextBundle"
          }
        },
        {
          "name": "reason",
          "type": "string"
        },
        {
          "name": "promptPaper",
          "type": "boolean"
        }
      ],
      "response": "UnboxAnyRes"
    }
  },
  "namespace": "keybase.1"
}