make it browserify friendly

This commit is contained in:
Wei Lu 2014-03-31 15:11:03 +08:00
parent 398c61a9c2
commit 893ee6532a
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ var Crypto = require('crypto-js')
var path = require('path')
var includeFolder = require('include-folder')
var Wordlists = includeFolder(path.join(__dirname, 'wordlists'))
var randomBytes = require('crypto').randomBytes
module.exports = BIP39
@ -31,8 +32,8 @@ BIP39.prototype.entropyToMnemonic = function(entropy){
}
BIP39.prototype.generateMnemonic = function(strength){
var strength = strength || 128
var entropy = crypto.randomBytes(strength/8).toString('hex')
strength = strength || 128
var entropy = randomBytes(strength/8).toString('hex')
return this.entropyToMnemonic(entropy)
}