Comparing version 1.6.1 to 1.6.2
# node-bitcoin changelog | ||
## v1.6.2 (2013/03/21) | ||
* shrink package size via .npmignore | ||
## v1.6.1 (2013/03/13) | ||
@@ -4,0 +7,0 @@ * add node v0.10.x support (rejectUnauthorized defaults to true in 0.10.x) |
29
index.js
@@ -7,28 +7,18 @@ var deprecate = require('deprecate'), | ||
// Client | ||
// Pass in an object with host, port, user, pass | ||
//===----------------------------------------------------------------------===// | ||
function Client() { | ||
var args = [].slice.call(arguments); | ||
var args = [].slice.call(arguments), | ||
opts = {}; | ||
if (args.length > 1) { | ||
deprecate('calling bitcoin.Client with more than one argument is deprecated'); | ||
this.host = args[0]; | ||
this.port = args[1]; | ||
this.user = args[2]; | ||
this.pass = args[3]; | ||
this.ssl = false; | ||
this.sslStrict = false; | ||
this.sslCa = null; | ||
opts.host = args[0]; | ||
opts.port = args[1]; | ||
opts.user = args[2]; | ||
opts.pass = args[3]; | ||
} else { | ||
this.host = args[0].host; | ||
this.port = args[0].port; | ||
this.user = args[0].user; | ||
this.pass = args[0].pass; | ||
this.ssl = args[0].ssl ? true : false; | ||
this.sslStrict = (typeof args[0].sslStrict === 'undefined' || args[0].sslStrict); | ||
this.sslCa = args[0].sslCa; | ||
opts = args[0]; | ||
} | ||
this.rpc = new rpc.Client(this.port, this.host, this.user, this.pass, | ||
this.ssl, this.sslStrict, this.sslCa); | ||
this.rpc = new rpc.Client(opts); | ||
} | ||
@@ -39,3 +29,2 @@ | ||
// cmd | ||
// Call custom jsonrpc commands | ||
//===----------------------------------------------------------------------===// | ||
@@ -42,0 +31,0 @@ Client.prototype.cmd = function() { |
var http = require('http'), | ||
https = require('https'); | ||
var Client = function(port, host, user, password, ssl, sslStrict, sslCa) { | ||
this.port = port; | ||
this.host = host; | ||
this.user = user; | ||
this.password = password; | ||
this.ssl = ssl ? true : false; | ||
this.sslStrict = sslStrict ? true : false; | ||
this.http = this.ssl ? https : http; | ||
this.sslCa = sslCa; | ||
var Client = function(opts) { | ||
this.opts = opts || {}; | ||
this.http = this.opts.ssl ? https : http; | ||
}; | ||
@@ -44,21 +37,21 @@ | ||
var requestOptions = { | ||
host: this.host, | ||
port: this.port, | ||
host: this.opts.host, | ||
port: this.opts.port, | ||
method: 'POST', | ||
path: path || '/', | ||
headers: { | ||
'Host': this.host, | ||
'Host': this.opts.host, | ||
'Content-Length': requestJSON.length | ||
}, | ||
agent: false, | ||
rejectUnauthorized: this.ssl && this.sslStrict | ||
rejectUnauthorized: this.opts.ssl && this.opts.sslStrict !== false | ||
}; | ||
if (this.ssl && this.sslCa) { | ||
requestOptions.ca = this.sslCa; | ||
if (this.opts.ssl && this.opts.sslCa) { | ||
requestOptions.ca = this.opts.sslCa; | ||
} | ||
// use HTTP auth if user and password set | ||
if (this.user && this.password) { | ||
requestOptions.auth = this.user + ':' + this.password; | ||
if (this.opts.user && this.opts.pass) { | ||
requestOptions.auth = this.opts.user + ':' + this.opts.pass; | ||
} | ||
@@ -65,0 +58,0 @@ |
{ | ||
"name": "bitcoin", | ||
"description": "Communicate with bitcoind via JSON-RPC", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 38 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
2
12914
8
234