|
|
@ -38,8 +38,8 @@ function _parseError(body) { |
|
|
|
log.error(code, message); |
|
|
|
}; |
|
|
|
|
|
|
|
function _signRequest(url, args, privKey) { |
|
|
|
var message = url + '|' + JSON.stringify(args); |
|
|
|
function _signRequest(method, url, args, privKey) { |
|
|
|
var message = method.toLowerCase() + '|' + url + '|' + JSON.stringify(args); |
|
|
|
return SignUtils.sign(message, privKey); |
|
|
|
}; |
|
|
|
|
|
|
@ -83,16 +83,16 @@ ClientLib.prototype._loadAndCheck = function() { |
|
|
|
} |
|
|
|
return data; |
|
|
|
}; |
|
|
|
|
|
|
|
ClientLib.prototype._doRequest = function(type, url, args, data, cb) { |
|
|
|
var reqSignature = _signRequest(url, args, data.signingPrivKey); |
|
|
|
|
|
|
|
ClientLib.prototype._doRequest = function(method, url, args, data, cb) { |
|
|
|
var reqSignature = _signRequest(method, url, args, data.signingPrivKey); |
|
|
|
var absUrl = _getUrl(url); |
|
|
|
request({ |
|
|
|
headers: { |
|
|
|
'x-identity': data.copayerId, |
|
|
|
'x-signature': reqSignature, |
|
|
|
}, |
|
|
|
method: type, |
|
|
|
method: method, |
|
|
|
url: absUrl, |
|
|
|
body: args, |
|
|
|
json: true, |
|
|
|