@namespace("keybase.1")

protocol saltpack {
  import idl "common.avdl";
  import idl "identify_common.avdl";

  record SaltpackEncryptOptions {
    array<string> recipients; // user assertions
    boolean hideSelf;
    boolean noSelfEncrypt;
    boolean binary;
    boolean hideRecipients;
  }

  record SaltpackDecryptOptions {
    boolean interactive;
    boolean forceRemoteCheck;
    boolean usePaperKey;
  }

  record SaltpackSignOptions {
    boolean detached;
    boolean binary;
  }

  record SaltpackVerifyOptions {
    string signedBy; // optional
    bytes signature; // detached signature data (binary or armored), can be empty
  }

  void saltpackEncrypt(int sessionID, Stream source, Stream sink, SaltpackEncryptOptions opts);

  record SaltpackEncryptedMessageInfo {
    array<Device> devices;
    int numAnonReceivers;
    boolean receiverIsAnon;
    SaltpackSender sender;
  }

  SaltpackEncryptedMessageInfo saltpackDecrypt(int sessionID, Stream source, Stream sink, SaltpackDecryptOptions opts);
  void saltpackSign(int sessionID, Stream source, Stream sink, SaltpackSignOptions opts);
  void saltpackVerify(int sessionID, Stream source, Stream sink, SaltpackVerifyOptions opts);
}
