serverEntity.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // ENCRYPTED DATA GETTERS
  16. std::vector<CurveBipoint> get_current_votes_by(
  17. Proof& pi, const Curvepoint& shortTermPublicKey) const;
  18. EGCiphertext get_current_tally(
  19. Proof& pi, const Curvepoint& shortTermPublicKey) const;
  20. // CLIENT INTERACTIONS
  21. void add_new_client(PrsonaClient& newUser);
  22. void receive_vote(
  23. const Proof& pi,
  24. const std::vector<CurveBipoint>& votes,
  25. const Curvepoint& shortTermPublicKey);
  26. void transmit_updates(PrsonaClient& currUser) const;
  27. // EPOCH
  28. void epoch(Proof& pi);
  29. private:
  30. std::vector<PrsonaServer> servers;
  31. // SCORE TALLYING
  32. std::vector<EGCiphertext> tally_scores(
  33. std::vector<Proof>& tallyProofs, const Curvepoint& nextGenerator);
  34. // BINARY SEARCH
  35. size_t binary_search(const Curvepoint& index) const;
  36. };
  37. #endif