bitagora-booth
Advanced tools
Comparing version 1.0.146 to 1.0.147
@@ -371,2 +371,5 @@ /** | ||
try { | ||
console.log(pollPrivkey); | ||
console.log(address); | ||
console.log(encryptedString); | ||
const voterPubkey = address.substr(14) + encryptedString.substr(2,10); | ||
@@ -391,30 +394,15 @@ const encrypted = Buffer.from(encryptedString.substr(12), 'base64'); | ||
function decryptBallots(pollId, pollPrivkey) { | ||
function decryptBallots(ballots, pollPrivkey) { | ||
console.log("In decrypt ballots"); | ||
console.log("Poll id"); | ||
console.log(pollId); | ||
console.log("Ballots to decrypt"); | ||
console.log(ballots); | ||
return new Promise((resolve, reject) => { | ||
try { | ||
if (!Boolean(pollId)) throw('No poll id'); | ||
requestState('ballots', pollId).then((result) => { | ||
try { | ||
console.log("Inside decrypt ballots. Result from state"); | ||
console.log(result); | ||
if (!Boolean(result) || (result.status != 'FOUND')) throw 'No data'; | ||
let ballots = result.ballots; | ||
console.log("Ballots to decrypt"); | ||
console.log(ballots); | ||
if (!Boolean(ballots) || !Boolean(ballots[0]) || ballots[0].length <= 2) throw 'No data to decrypt'; | ||
let decrypted = []; | ||
for (var i=0; i<ballots.length; i++) { | ||
console.log(ballots[i]); | ||
decrypted.push(decryptBallot(pollPrivkey, ballots[i].ballot, ballots[i].vote)); | ||
} | ||
resolve(decrypted); | ||
} catch(e) { | ||
reject(e); | ||
} | ||
}).catch((e) => { | ||
reject(e); | ||
}); | ||
if (!Boolean(ballots)) throw 'No data to decrypt'; | ||
let decrypted = []; | ||
for (var i=0; i<ballots.length; i++) { | ||
console.log(ballots[i]); | ||
decrypted.push(decryptBallot(pollPrivkey, ballots[i].ballot, ballots[i].vote)); | ||
} | ||
resolve(decrypted); | ||
} catch(e) { | ||
@@ -421,0 +409,0 @@ reject(e); |
{ | ||
"name": "bitagora-booth", | ||
"version": "1.0.146", | ||
"version": "1.0.147", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "author": "Ignasi Ribó, 2018", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75748
2866