serverEntity.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. PrsonaServerEntity(size_t numServers);
  10. BGNPublicKey get_bgn_public_key() const;
  11. Curvepoint get_blinding_generator() const;
  12. Curvepoint get_fresh_generator(Proof& pi) const;
  13. void add_new_client(PrsonaClient& newUser);
  14. void receive_vote(const Proof& pi, const std::vector<CurveBipoint>& votes, const Curvepoint& shortTermPublicKey);
  15. void epoch();
  16. void transmit_score(PrsonaClient& currUser) const;
  17. private:
  18. std::vector<PrsonaServer> servers;
  19. std::vector<EGCiphertext> encryptedTallies;
  20. std::vector<Proof> tallyProofs;
  21. EGCiphertext get_default_tally(Proof& pi, const Curvepoint& shortTermPublicKey) const;
  22. Proof generate_valid_default_tally_proof(const EGCiphertext& encryptedDefaultTally, const Scalar& lambda) const;
  23. Proof generate_epoch_round_one_proof(const Proof& pi1, const Proof& pi2) const;
  24. Proof generate_epoch_proof(const Proof& pi, const EGCiphertext& encryptedTally) const;
  25. EGCiphertext get_current_tally(Proof& pi, const Curvepoint& shortTermPublicKey) const;
  26. std::vector<Scalar> tally_scores(Proof& pi);
  27. size_t binary_search(const Curvepoint& index) const;
  28. };
  29. #endif