|
@ -1,6 +1,7 @@ |
|
|
var imports = require('soop').imports(); |
|
|
var imports = require('soop').imports(); |
|
|
|
|
|
|
|
|
var parent = imports.parent || require('./util/VersionedData'); |
|
|
var parent = imports.parent || require('./util/VersionedData'); |
|
|
|
|
|
var networks= imports.networks || require('./networks'); |
|
|
|
|
|
|
|
|
//compressed is true if public key is compressed; false otherwise
|
|
|
//compressed is true if public key is compressed; false otherwise
|
|
|
function PrivateKey(version, buf, compressed) { |
|
|
function PrivateKey(version, buf, compressed) { |
|
@ -61,4 +62,19 @@ PrivateKey.prototype.compressed = function(compressed) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
PrivateKey.prototype.network = function() { |
|
|
|
|
|
var version = this.version(); |
|
|
|
|
|
|
|
|
|
|
|
var livenet = networks.livenet; |
|
|
|
|
|
var testnet = networks.testnet; |
|
|
|
|
|
|
|
|
|
|
|
var answer; |
|
|
|
|
|
if (version === livenet.keySecret) |
|
|
|
|
|
answer = livenet; |
|
|
|
|
|
else if (version === testnet.keySecret) |
|
|
|
|
|
answer = testnet; |
|
|
|
|
|
|
|
|
|
|
|
return answer; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
module.exports = require('soop')(PrivateKey); |
|
|
module.exports = require('soop')(PrivateKey); |
|
|