Socket
Socket
Sign inDemoInstall

bitagora-booth

Package Overview
Dependencies
11
Maintainers
1
Versions
178
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

38

booth.js

@@ -99,5 +99,5 @@ const CryptoJS = require('crypto-js');

function signVoteScript(voteScript, privateKey) {
function signScript(script, privateKey) {
var key = EC.keyFromPrivate(privateKey, 'hex');
var signature = key.sign(voteScript).toDER();
var signature = key.sign(script).toDER();
if (signature) {

@@ -157,2 +157,24 @@ return toHexString(signature);

};
function encryptMessage(payload){
var salt = CryptoJS.lib.WordArray.random(128/8);
var iv = CryptoJS.lib.WordArray.random(128/8);
console.log('salt '+ salt );
console.log('iv '+ iv );
var key128Bits100Iterations = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 128/32, iterations: 100 });
console.log( 'key128Bits100Iterations '+ key128Bits100Iterations);
var encrypted = CryptoJS.AES.encrypt(payload, key128Bits100Iterations, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
}
function decryptMessage(encrypted){
var salt = CryptoJS.enc.Hex.parse("4acfedc7dc72a9003a0dd721d7642bde");
var iv = CryptoJS.enc.Hex.parse("69135769514102d0eded589ff874cacd");
var encrypted = "PU7jfTmkyvD71ZtISKFcUQ==";
var key = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 128/32, iterations: 100 });
console.log( 'key '+ key);
var decrypt = CryptoJS.AES.decrypt(encrypted, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
var ddd = decrypt.toString(CryptoJS.enc.Utf8);
console.log('ddd '+ddd);
}

@@ -167,5 +189,13 @@ /////// UTILS ////////////////////

module.exports = {
register: function(id, context) {
return id;
var encrypted = signScript(id, context.encKey);
if (encrypted) {
console.log("Encrypted message");
console.log(encrypted);
return encrypted;
} else {
return null;
}
},

@@ -178,3 +208,3 @@ vote: function(data, context) {

var privkey_hex = req.body.privkey;
var signature = signVoteScript(newVoteScript, privkey_hex);
var signature = signScript(newVoteScript, privkey_hex);
var pubkey = EC.keyFromPrivate(privkey_hex, 'hex').getPublic(true, 'hex');

@@ -181,0 +211,0 @@ if (signature) {

2

package.json
{
"name": "bitagora-booth",
"version": "1.0.0",
"version": "1.0.1",
"description": "Bitagora booth js functions",

@@ -5,0 +5,0 @@ "main": "booth.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc