Commit 53484110 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Remove unused trustee code from booth

parent f176638e
......@@ -477,87 +477,3 @@ HELIOS.EncryptedVote.fromEncryptedAnswers = function(election, enc_answers) {
});
return enc_vote;
};
//
// Tally abstraction
//
HELIOS.Tally = Class.extend({
init: function(raw_tally, num_tallied) {
this.tally = raw_tally;
this.num_tallied = num_tallied;
},
toJSONObject: function() {
var tally_json_obj = _(this.tally).map(function(one_q) {
return _(one_q).map(function(one_a) {
return one_a.toJSONObject();
});
});
return {
num_tallied : this.num_tallied,
tally: tally_json_obj
};
}
});
HELIOS.Tally.fromJSONObject = function(d, public_key) {
var num_tallied = d['num_tallied'];
var raw_tally = _(d['tally']).map(function(one_q) {
return _(one_q).map(function(one_a) {
var new_val= ElGamal.Ciphertext.fromJSONObject(one_a, public_key);
return new_val;
});
});
return new HELIOS.Tally(raw_tally, num_tallied);
};
//
// distributed decryption : Trustees
//
// a utility function for jsonifying a list of lists of items
HELIOS.jsonify_list_of_lists = function(lol) {
if (!lol)
return null;
return _(lol).map(function(sublist) {return _(sublist).map(function(item) {return item.toJSONObject();})});
};
// a utility function for doing the opposite with an item-level de-jsonifier
HELIOS.dejsonify_list_of_lists = function(lol, item_dejsonifier) {
if (!lol)
return null;
return _(lol).map(function(sublist) {return _(sublist).map(function(item) {return item_dejsonifier(item);})});
}
HELIOS.Trustee = Class.extend({
init: function(uuid, public_key, public_key_hash, pok, decryption_factors, decryption_proofs) {
this.uuid = uuid;
this.public_key = public_key;
this.public_key_hash = public_key_hash;
this.pok = pok;
this.decryption_factors = decryption_factors;
this.decryption_proofs = decryption_proofs;
},
toJSONObject: function() {
return {
'decryption_factors' : HELIOS.jsonify_list_of_lists(this.decryption_factors),
'decryption_proofs' : HELIOS.jsonify_list_of_list(this.decryption_proofs),
'email' : this.email, 'name' : this.name, 'pok' : this.pok.toJSONObject(), 'public_key' : this.public_key.toJSONObject()
};
}
});
HELIOS.Trustee.fromJSONObject = function(d) {
return new HELIOS.Trustee(d.uuid,
ElGamal.PublicKey.fromJSONObject(d.public_key), d.public_key_hash, ElGamal.DLogProof.fromJSONObject(d.pok),
HELIOS.dejsonify_list_of_lists(d.decryption_factors, BigInt.fromJSONObject),
HELIOS.dejsonify_list_of_lists(d.decryption_proofs, ElGamal.Proof.fromJSONObject));
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment