serverEntity.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __PRSONA_SERVER_ENTITY_HPP
  2. #define __PRSONA_SERVER_ENTITY_HPP
  3. #include <vector>
  4. #include "client.hpp"
  5. #include "server.hpp"
  6. #include "proof.hpp"
  7. class PrsonaServerEntity {
  8. public:
  9. // CONSTRUCTORS
  10. PrsonaServerEntity(size_t numServers);
  11. // BASIC PUBLIC SYSTEM INFO GETTERS
  12. BGNPublicKey get_bgn_public_key() const;
  13. Curvepoint get_blinding_generator() const;
  14. Curvepoint get_fresh_generator() const;
  15. size_t get_num_clients() const;
  16. // ENCRYPTED DATA GETTERS
  17. std::vector<CurveBipoint> get_current_votes_by(
  18. Proof& pi, const Curvepoint& shortTermPublicKey) const;
  19. EGCiphertext get_current_tally(
  20. Proof& pi, const Curvepoint& shortTermPublicKey) const;
  21. // CLIENT INTERACTIONS
  22. void add_new_client(PrsonaClient& newUser);
  23. void receive_vote(
  24. const Proof& pi,
  25. const std::vector<CurveBipoint>& votes,
  26. const Curvepoint& shortTermPublicKey);
  27. void transmit_updates(PrsonaClient& currUser) const;
  28. // EPOCH
  29. void epoch(Proof& pi);
  30. private:
  31. std::vector<PrsonaServer> servers;
  32. // SCORE TALLYING
  33. std::vector<EGCiphertext> tally_scores(
  34. std::vector<Proof>& tallyProofs, const Curvepoint& nextGenerator);
  35. // BINARY SEARCH
  36. size_t binary_search(const Curvepoint& index) const;
  37. };
  38. #endif