|
|
@ -97,7 +97,7 @@ PrivateKey.prototype._classifyArguments = function(data, network) { |
|
|
|
}; |
|
|
|
|
|
|
|
// detect type of data
|
|
|
|
if (_.isUndefined(data)){ |
|
|
|
if (_.isUndefined(data) || _.isNull(data)){ |
|
|
|
info.bn = PrivateKey._getRandomBN(); |
|
|
|
} else if (data instanceof BN) { |
|
|
|
info.bn = data; |
|
|
@ -105,6 +105,9 @@ PrivateKey.prototype._classifyArguments = function(data, network) { |
|
|
|
info = PrivateKey._transformBuffer(data, network); |
|
|
|
} else if (PrivateKey._isJSON(data)){ |
|
|
|
info = PrivateKey._transformJSON(data); |
|
|
|
} else if (!network && Networks.get(data)) { |
|
|
|
info.bn = PrivateKey._getRandomBN(); |
|
|
|
info.network = Networks.get(data); |
|
|
|
} else if (typeof(data) === 'string'){ |
|
|
|
if (JSUtil.isHexa(data)) { |
|
|
|
info.bn = BN(new Buffer(data, 'hex')); |
|
|
|