package: use crypto-browserify 3.0.0
This commit is contained in:
parent
ca0c56fa3b
commit
8e0c835919
4 changed files with 11 additions and 11 deletions
|
@ -75,6 +75,7 @@
|
|||
"bigi": "1.1.0",
|
||||
"bs58": "1.1.0",
|
||||
"bs58check": "1.0.0",
|
||||
"crypto-browserify": "3.0.0",
|
||||
"crypto-js": "3.1.2-3",
|
||||
"crypto-browserify": "2.1.8",
|
||||
"ecurve": "0.10.0",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
var assert = require('assert')
|
||||
var base58check = require('bs58check')
|
||||
var crypto = require('crypto')
|
||||
var ecdsa = require('./ecdsa')
|
||||
var networks = require('./networks')
|
||||
var secureRandom = require('secure-random')
|
||||
|
||||
var BigInteger = require('bigi')
|
||||
var ECPubKey = require('./ecpubkey')
|
||||
|
@ -43,7 +43,7 @@ ECKey.fromWIF = function(string) {
|
|||
}
|
||||
|
||||
ECKey.makeRandom = function(compressed, rng) {
|
||||
rng = rng || secureRandom.randomBuffer
|
||||
rng = rng || crypto.randomBytes
|
||||
|
||||
var buffer = rng(32)
|
||||
assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var assert = require('assert')
|
||||
var crypto = require('crypto')
|
||||
var networks = require('./networks')
|
||||
var rng = require('secure-random')
|
||||
|
||||
var Address = require('./address')
|
||||
var HDNode = require('./hdnode')
|
||||
|
@ -25,7 +25,7 @@ function Wallet(seed, network) {
|
|||
|
||||
// Make a new master key
|
||||
this.newMasterKey = function(seed) {
|
||||
seed = seed || new Buffer(rng(32))
|
||||
seed = seed || crypto.randomBytes(32)
|
||||
masterkey = HDNode.fromSeedBuffer(seed, network)
|
||||
|
||||
// HD first-level child derivation method should be hardened
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
var assert = require('assert')
|
||||
var crypto = require('../src/crypto')
|
||||
var crypto = require('crypto')
|
||||
var crypto2 = require('../src/crypto')
|
||||
var networks = require('../src/networks')
|
||||
|
||||
var secureRandom = require('secure-random')
|
||||
var sinon = require('sinon')
|
||||
|
||||
var BigInteger = require('bigi')
|
||||
|
@ -84,13 +83,13 @@ describe('ECKey', function() {
|
|||
var exPrivKey = ECKey.fromWIF(exWIF)
|
||||
var exBuffer = exPrivKey.d.toBuffer(32)
|
||||
|
||||
describe('using default RNG', function() {
|
||||
describe('uses default crypto RNG', function() {
|
||||
beforeEach(function() {
|
||||
sinon.stub(secureRandom, 'randomBuffer').returns(exBuffer)
|
||||
sinon.stub(crypto, 'randomBytes').returns(exBuffer)
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
secureRandom.randomBuffer.restore()
|
||||
crypto.randomBytes.restore()
|
||||
})
|
||||
|
||||
it('generates a ECKey', function() {
|
||||
|
@ -116,7 +115,7 @@ describe('ECKey', function() {
|
|||
})
|
||||
|
||||
describe('signing', function() {
|
||||
var hash = crypto.sha256('Vires in numeris')
|
||||
var hash = crypto2.sha256('Vires in numeris')
|
||||
var priv = ECKey.makeRandom()
|
||||
var signature = priv.sign(hash)
|
||||
|
||||
|
|
Loading…
Reference in a new issue