You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

javalon

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javalon - npm Package Compare versions

Comparing version

to
1.0.34

example_bip39.js

42

index.js

@@ -8,2 +8,4 @@ const CryptoJS = require('crypto-js')

const fetch = require('node-fetch')
const bip39 = require('bip39')
const bip32 = require('bip32')

@@ -167,2 +169,13 @@ let avalon = {

},
generateMnemonic: () => {
return bip39.generateMnemonic()
},
mnemonicToKeyPair: (mnemonic) => {
const seed = bip39.mnemonicToSeedSync(mnemonic)
const bip32key = bip32.fromSeed(seed)
return {
pub: bs58.encode(bip32key.publicKey),
priv: bs58.encode(bip32key.privateKey)
}
},
privToPub: (priv) => {

@@ -193,2 +206,26 @@ return bs58.encode(

},
signMultisig: (privKeys = [], sender, tx) => {
if (typeof tx !== 'object')
try {
tx = JSON.parse(tx)
} catch(e) {
console.log('invalid transaction')
return
}
if (!tx.sender)
tx.sender = sender
if (!tx.ts)
tx.ts = new Date().getTime()
if (!tx.hash)
tx.hash = CryptoJS.SHA256(JSON.stringify(tx)).toString()
if (!tx.signature || !Array.isArray(tx.signature))
tx.signature = []
for (let k in privKeys) {
let sign = secp256k1.ecdsaSign(Buffer.from(tx.hash, 'hex'), bs58.decode(privKeys[k]))
tx.signature.push([bs58.encode(sign.signature),sign.recid])
}
return tx
},
sendTransaction: (tx, cb) => {

@@ -390,3 +427,6 @@ // sends a transaction to a node

ENABLE_NODE: 18,
TIPPED_VOTE: 19
TIPPED_VOTE: 19,
NEW_WEIGHTED_KEY: 20,
SET_SIG_THRESHOLD: 21,
SET_PASSWORD_WEIGHT: 22
}

@@ -393,0 +433,0 @@ }

4

package.json
{
"name": "javalon",
"version": "1.0.33",
"version": "1.0.34",
"description": "javascript api for the avalon blockchain",

@@ -25,2 +25,4 @@ "main": "index.js",

"dependencies": {
"bip32": "^2.0.6",
"bip39": "^3.0.4",
"bs58": "^4.0.1",

@@ -27,0 +29,0 @@ "crypto-js": "^3.1.9-1",

Sorry, the diff of this file is too big to display