Browse Source

stubbed out beginning of code

tristangurtler 3 years ago
parent
commit
0e261e00e8
4 changed files with 121 additions and 0 deletions
  1. 21 0
      prsona/inc/client.hpp
  2. 23 0
      prsona/inc/server.hpp
  3. 36 0
      prsona/src/client.cpp
  4. 41 0
      prsona/src/server.cpp

+ 21 - 0
prsona/inc/client.hpp

@@ -0,0 +1,21 @@
+#ifndef __PRSONA_CLIENT_HPP
+#define __PRSONA_CLIENT_HPP
+
+class PrsonaClient {
+    public:
+        PrsonaClient();
+        void receive_score(Ciphertext score, Proof pi, Scalar newSeed);
+        void make_vote(vector<Scalar> vote);
+        void use_reputation();
+        bool verify_reputation_proof(Proof pi, PrsonaPublicKey shortTermPublicKey);
+
+    private:
+        PrsonaPrivateKey longTermPrivateKey;
+        BGNPublicKey serverPublicKey;
+        Scalar currentFreshPseudonymSeed;
+
+        Proof generate_vote_proof(Scalar vote);
+        Proof generate_usage_proof();
+}; 
+
+#endif

+ 23 - 0
prsona/inc/server.hpp

@@ -0,0 +1,23 @@
+#ifndef __PRSONA_SERVER_HPP
+#define __PRSONA_SERVER_HPP
+
+class PrsonaServer {
+    public:
+        PrsonaServer();
+        void add_new_client(PrsonaPublicKey longTermPublicKey);
+        void epoch();
+        void receive_vote(vector<CurveBipoint> vote, Proof pi, PrsonaPublicKey shortTermPublicKey);
+
+    private:
+        PrsonaPrivateKey longTermPrivateKey;
+        BGNPrivateKey bgnPrivateKey;
+        vector<TwistBipoint> previousVoteTally;
+        vector<vector<CurveBipoint>> voteMatrix;
+
+        void calculate_vote_tally();
+        void rerandomize_vote_matrix();
+        void distribute_new_scores();
+        bool verify_vote_proof(CurveBipoint vote, Proof pi, PrsonaPublicKey shortTermPublicKey);
+}; 
+
+#endif

+ 36 - 0
prsona/src/client.cpp

@@ -0,0 +1,36 @@
+#include "client.hpp"
+
+PrsonaClient::PrsonaClient()
+{
+
+}
+
+void PrsonaClient::receive_score(Ciphertext score, Proof pi, Scalar newSeed)
+{
+
+}
+
+void PrsonaClient::make_vote(vector<Scalar> vote)
+{
+
+}
+
+void PrsonaClient::use_reputation()
+{
+
+}
+
+bool PrsonaClient::verify_reputation_proof(Proof pi, PrsonaPublicKey shortTermPublicKey)
+{
+
+}
+
+Proof PrsonaClient::generate_vote_proof(Scalar vote)
+{
+
+}
+
+Proof PrsonaClient::generate_usage_proof()
+{
+    
+}

+ 41 - 0
prsona/src/server.cpp

@@ -0,0 +1,41 @@
+#include "server.hpp"
+
+PrsonaServer::PrsonaServer()
+{
+
+}
+
+void PrsonaServer::add_new_client(PrsonaPublicKey longTermPublicKey)
+{
+
+}
+
+void PrsonaServer::epoch()
+{
+
+}
+
+void PrsonaServer::receive_vote(vector<CurveBipoint> vote, Proof pi, PrsonaPublicKey shortTermPublicKey)
+{
+
+}
+
+void PrsonaServer::calculate_vote_tally()
+{
+
+}
+
+void PrsonaServer::rerandomize_vote_matrix()
+{
+
+}
+
+void PrsonaServer::distribute_new_scores()
+{
+
+}
+
+bool PrsonaServer::verify_vote_proof(CurveBipoint vote, Proof pi, PrsonaPublicKey shortTermPublicKey)
+{
+
+}