Browse Source

removed bs58 dev dep, added coinstring dev dep

master
JP Richardson 11 years ago
parent
commit
a9404233b9
  1. 7
      package.json
  2. 10
      test/hdkey.test.js

7
package.json

@ -22,18 +22,19 @@
"homepage": "https://github.com/cryptocoinjs/hdkey",
"devDependencies": {
"mocha": "^1.19.0",
"bs58": "^1.0.0",
"coveralls": "^2.10.0",
"mocha-lcov-reporter": "0.0.1",
"istanbul": "^0.2.10",
"secure-random": "^1.0.0",
"mochify": "^0.9.3",
"crypto-browserify": "^2.1.8"
"crypto-browserify": "^2.1.8",
"coinstring": "^2.0.0"
},
"dependencies": {
"sha512": "0.0.1",
"bigi": "^1.1.0",
"ecurve": "^1.0.0"
"ecurve": "^1.0.0",
"coinstring": "^2.0.0"
},
"scripts": {
"unit": "./node_modules/.bin/mocha",

10
test/hdkey.test.js

@ -1,7 +1,7 @@
var assert = require('assert')
var crypto = require('crypto')
var BigInteger = require('bigi')
var bs58 = require('bs58')
var cs = require('coinstring')
var ecurve = require('ecurve')
var secureRandom = require('secure-random')
var ecparams = ecurve.getCurveByName('secp256k1')
@ -10,9 +10,7 @@ var HDKey = require('../')
var fixtures = require('./fixtures/hdkey')
function encode(buf) {
var hash = crypto.createHash('sha256').update(buf).digest()
var chksum = crypto.createHash('sha256').update(hash).digest().slice(0,4)
return bs58.encode(Buffer.concat([buf, chksum]))
return cs.encode(buf)
}
describe('hdkey', function() {
@ -68,7 +66,7 @@ describe('hdkey', function() {
it('should parse it', function() {
//m/0/2147483647'/1/2147483646'/2
var key = "xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j"
var keyBuffer = bs58.decode(key).slice(0, 78)
var keyBuffer = cs.decode(key).slice(0, 78)//bs58.decode(key).slice(0, 78)
var hdkey = HDKey.fromExtendedKey(keyBuffer)
assert.equal(hdkey.versions.private, 0x0488ade4)
assert.equal(hdkey.versions.public, 0x0488b21e)
@ -86,7 +84,7 @@ describe('hdkey', function() {
it('should parse it', function() {
//m/0/2147483647'/1/2147483646'/2
var key = "xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt"
var keyBuffer = bs58.decode(key).slice(0, 78)
var keyBuffer = cs.decode(key).slice(0, 78)//bs58.decode(key).slice(0, 78)
var hdkey = HDKey.fromExtendedKey(keyBuffer)
assert.equal(hdkey.versions.private, 0x0488ade4)
assert.equal(hdkey.versions.public, 0x0488b21e)

Loading…
Cancel
Save