|
@@ -179,22 +179,26 @@ void reputation_proof_attempt(default_random_engine& generator, const PrsonaClie
|
|
|
i++;
|
|
|
|
|
|
uniform_int_distribution<int> thresholdDistribution(0, i);
|
|
|
- Scalar threshold(thresholdDistribution(generator));
|
|
|
+ Scalar goodThreshold(thresholdDistribution(generator));
|
|
|
+ Scalar badThreshold(aScore + 1);
|
|
|
|
|
|
- cout << "User A's score: " << aScore << endl;
|
|
|
- cout << "User A's chosen threshold: " << threshold << endl;
|
|
|
+ cout << "User A's score: " << aScore << endl;
|
|
|
+ cout << "User A's chosen good threshold: " << goodThreshold << endl;
|
|
|
+ cout << "User A's chosen bad threshold: " << badThreshold << endl;
|
|
|
|
|
|
Proof pi;
|
|
|
Curvepoint shortTermPublicKey = a.get_short_term_public_key(pi);
|
|
|
- vector<Proof> repProof = a.generate_reputation_proof(threshold);
|
|
|
- if (b.verify_reputation_proof(repProof, shortTermPublicKey, threshold))
|
|
|
- {
|
|
|
- cout << "User A proved their reputation to user B!" << endl;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- cout << "User A failed to prove their reputation to user B!" << endl;
|
|
|
- }
|
|
|
+ vector<Proof> goodRepProof = a.generate_reputation_proof(goodThreshold);
|
|
|
+ cout << "TEST VALID PROOF: "
|
|
|
+ << (b.verify_reputation_proof(goodRepProof, shortTermPublicKey, goodThreshold) ?
|
|
|
+ "PASSED (Proof verified)" : "FAILED (Proof not verified)" )
|
|
|
+ << endl;
|
|
|
+
|
|
|
+ vector<Proof> badRepProof = a.generate_reputation_proof(badThreshold);
|
|
|
+ cout << "TEST INVALID PROOF: "
|
|
|
+ << (b.verify_reputation_proof(badRepProof, shortTermPublicKey, badThreshold) ?
|
|
|
+ "FAILED (Proof verified)" : "PASSED (Proof not verified)" )
|
|
|
+ << endl;
|
|
|
}
|
|
|
|
|
|
int main(int argc, char *argv[])
|