|
@ -29,9 +29,7 @@ function _parseError(body) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function _signRequest(url, args, privKey) { |
|
|
function _signRequest(url, args, privKey) { |
|
|
var message = url + (args ? '|' + JSON.stringify(args) : ''); |
|
|
var message = url + '|' + JSON.stringify(args); |
|
|
console.log('[clilib.js.32:message:]',message); //TODO
|
|
|
|
|
|
console.log('[clilib.js.34:privKey:]',privKey); //TODO
|
|
|
|
|
|
return SignUtils.sign(message, privKey); |
|
|
return SignUtils.sign(message, privKey); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -47,7 +45,7 @@ function CliLib(opts) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CliLib.prototype._save = function (data) { |
|
|
CliLib.prototype._save = function(data) { |
|
|
fs.writeFileSync(this.filename, JSON.stringify(data)); |
|
|
fs.writeFileSync(this.filename, JSON.stringify(data)); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -96,7 +94,7 @@ CliLib.prototype.createWallet = function(walletName, copayerName, m, n, network, |
|
|
|
|
|
|
|
|
request({ |
|
|
request({ |
|
|
method: 'post', |
|
|
method: 'post', |
|
|
url: _getUrl('v1/wallets'), |
|
|
url: _getUrl('/v1/wallets/'), |
|
|
body: args, |
|
|
body: args, |
|
|
json: true, |
|
|
json: true, |
|
|
}, function(err, res, body) { |
|
|
}, function(err, res, body) { |
|
@ -142,7 +140,7 @@ CliLib.prototype._joinWallet = function(data, secret, copayerName, cb) { |
|
|
|
|
|
|
|
|
request({ |
|
|
request({ |
|
|
method: 'post', |
|
|
method: 'post', |
|
|
url: _getUrl('v1/wallets/' + walletId + '/copayers'), |
|
|
url: _getUrl('/v1/wallets/' + walletId + '/copayers'), |
|
|
body: args, |
|
|
body: args, |
|
|
json: true, |
|
|
json: true, |
|
|
}, function(err, res, body) { |
|
|
}, function(err, res, body) { |
|
@ -181,10 +179,10 @@ CliLib.prototype.status = function(cb) { |
|
|
var self = this; |
|
|
var self = this; |
|
|
|
|
|
|
|
|
var data = this._loadAndCheck(); |
|
|
var data = this._loadAndCheck(); |
|
|
console.log('[clilib.js.180:data:]',data); //TODO
|
|
|
console.log('[clilib.js.180:data:]', data); //TODO
|
|
|
|
|
|
|
|
|
var url = 'v1/wallets/'; |
|
|
var url = '/v1/wallets/'; |
|
|
var signature = _signRequest(url, null, data.signingPrivKey); |
|
|
var signature = _signRequest(url, {}, data.signingPrivKey); |
|
|
|
|
|
|
|
|
request({ |
|
|
request({ |
|
|
headers: { |
|
|
headers: { |
|
|