bitagora-booth
Advanced tools
Comparing version 1.0.1 to 1.0.2
34
booth.js
@@ -0,4 +1,4 @@ | ||
const bitagoraVersion = '1.0.2'; | ||
const CryptoJS = require('crypto-js'); | ||
const Ecdsa = require('elliptic'); | ||
const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; | ||
@@ -12,7 +12,15 @@ const Bs58 = require('base-x')(BASE58); | ||
constructor(data) { | ||
this.startDate = new Date(startDate), | ||
this.endDate = new Date(endDate), | ||
this.options = data.options, | ||
this.idState = data.idState, | ||
this.apiHttp = data.apiHttp | ||
this.id = data.id, | ||
this.servPubkey = data.servPubkey, | ||
this.title = data.title, | ||
this.sponsor = data.sponsor, | ||
this.startDate = new Date(parseInt(startDate)), | ||
this.endDate = new Date(parseInt(endDate)), | ||
this.question = data.question, | ||
this.options = data.options.string, | ||
this.optionsValues = data.options.values, | ||
this.idState = data.idState, | ||
this.locales = data.locales, | ||
this.requirements = data.requirements, | ||
this.apiHttp = data.apiHttp | ||
} | ||
@@ -190,11 +198,5 @@ }; | ||
module.exports = { | ||
register: function(id, context) { | ||
var encrypted = signScript(id, context.encKey); | ||
if (encrypted) { | ||
console.log("Encrypted message"); | ||
console.log(encrypted); | ||
return encrypted; | ||
} else { | ||
return null; | ||
} | ||
register: function(id) { | ||
var buf = new Buffer(id, "hex"); | ||
return Bs58.encode(buf); | ||
}, | ||
@@ -206,3 +208,3 @@ vote: function(data, context) { | ||
var newVoteScript = getVoteScript(newVote); | ||
var privkey_hex = req.body.privkey; | ||
var privkey_hex = Bs58.decode(data.privKeyB58).toString("hex"); | ||
var signature = signScript(newVoteScript, privkey_hex); | ||
@@ -209,0 +211,0 @@ var pubkey = EC.keyFromPrivate(privkey_hex, 'hex').getPublic(true, 'hex'); |
{ | ||
"name": "bitagora-booth", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Bitagora booth js functions", | ||
@@ -5,0 +5,0 @@ "main": "booth.js", |
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
9883
210