bitagora-booth
Advanced tools
Comparing version 1.0.25 to 1.0.26
const { | ||
BITAGORA_URL, BITAGORA_PREFIX, BITAGORA_FAMILY, BITAGORA_VERSION | ||
} = require('./constants'); | ||
//const crypto = require('crypto'); | ||
const crypto = require('crypto'); | ||
const atob = require('atob'); | ||
const btoa = require('btoa'); | ||
//const cbor = require('cbor'); | ||
const cbor = require('cbor'); | ||
const _hash = (sha, x) => x; | ||
//const _hash = (sha, x) => crypto.createHash(sha).update(x).digest('hex').toLowerCase(); | ||
const _hash = (sha, x) => crypto.createHash(sha).update(x).digest('hex').toLowerCase(); | ||
const _hexToB64 = (str) => btoa(String.fromCharCode.apply(null,str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))); | ||
@@ -162,4 +161,3 @@ const _B64ToHex = (str) => { | ||
if (!Boolean(json.data)) throw 'No data'; | ||
let data = null; | ||
// let data = cbor.decode(Buffer.from(json.data, 'base64')); | ||
let data = cbor.decode(Buffer.from(json.data, 'base64')); | ||
if (!Boolean(data) || !Boolean(data['poll'])) throw 'No data'; | ||
@@ -166,0 +164,0 @@ let poll = JSON.parse(data['poll']); |
'use strict' | ||
const { getPollAddress, _hash } = require('./functions'); | ||
//const cbor = require('cbor'); | ||
const cbor = require('cbor'); | ||
@@ -32,4 +32,3 @@ class PollState { | ||
try { | ||
let data = null; | ||
//let data = cbor.encode(ballots); | ||
let data = cbor.encode(ballots); | ||
let entries = { | ||
@@ -123,3 +122,3 @@ [address]: data | ||
if (!Boolean(data) || !Boolean(data[address]) || data[address].length == 0) return undefined; | ||
//return cbor.decode(data[address]); | ||
return cbor.decode(data[address]); | ||
} catch(e) { | ||
@@ -126,0 +125,0 @@ return undefined; |
{ | ||
"name": "bitagora-booth", | ||
"version": "1.0.25", | ||
"version": "1.0.26", | ||
"description": "Bitagora booth", | ||
@@ -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
21936
663