diff --git a/index.js b/index.js index 19a8211..f0f2743 100644 --- a/index.js +++ b/index.js @@ -35,9 +35,9 @@ BIP39.prototype.entropyToMnemonic = function(entropy) { BIP39.prototype.generateMnemonic = function(strength, rng) { strength = strength || 128 - rng = rng || secureRandom + rng = rng || secureRandom.randomBuffer - var hex = rng.randomBuffer(strength / 8).toString('hex') + var hex = rng(strength / 8).toString('hex') return this.entropyToMnemonic(hex) } diff --git a/test/index.js b/test/index.js index 3dec071..151447e 100644 --- a/test/index.js +++ b/test/index.js @@ -36,12 +36,10 @@ describe('generateMnemonic', function() { }) it('allows a custom RNG to be used', function() { - var rng = { - randomBuffer: function(size) { - var buffer = new Buffer(size) - buffer.fill(4) // guaranteed random - return buffer - } + var rng = function(size) { + var buffer = new Buffer(size) + buffer.fill(4) // guaranteed random + return buffer } var mnemonic = bip39.generateMnemonic(64, rng)