This commit is contained in:
Daniel Cousens 2014-03-22 16:27:10 +11:00
parent 74ee2f90d0
commit a1be488d1b

View file

@ -14,7 +14,7 @@ var ecparams = sec("secp256k1");
// input can be nothing, array of bytes, hex string, or base58 string // input can be nothing, array of bytes, hex string, or base58 string
var ECKey = function (input,compressed,version) { var ECKey = function (input,compressed,version) {
if (!(this instanceof ECKey)) { return new ECKey(input,compressed); } if (!(this instanceof ECKey)) { return new ECKey(input,compressed,version); }
if (!input) { if (!input) {
// Generate new key // Generate new key
var n = ecparams.getN(); var n = ecparams.getN();
@ -56,7 +56,7 @@ ECKey.prototype.import = function (input,compressed,version) {
: input.length == 65 ? true : input.length == 65 ? true
: null : null
this.version = this.version =
version !== undefined ? version version !== undefined ? version
: input instanceof ECKey ? input.version : input instanceof ECKey ? input.version
: input instanceof BigInteger ? mainnet : input instanceof BigInteger ? mainnet