verifymessage added to api cmd settings

This commit is contained in:
joeuhren
2020-12-21 18:12:40 -07:00
parent 4a084cdfe1
commit dfbd2d9046
6 changed files with 53 additions and 17 deletions
+29 -1
View File
@@ -760,7 +760,35 @@ module.exports = {
// cmd not in use. return null.
return cb(null);
}
},
},
verify_message: function(address, signature, message, cb) {
var cmd = prepareRpcCommand(settings.api_cmds.verifymessage, [address, signature, message]);
if (!(cmd.method == '' && cmd.parameters.length == 0)) {
if (settings.use_rpc) {
rpcCommand([{method:cmd.method, parameters: cmd.parameters}], function(response) {
// check if an error msg was received from the rpc server
if (response == 'There was an error. Check your console.')
return cb(null);
else
return cb(response);
});
} else {
var uri = base_url + 'verifymessage?address=' + address + '&signature=' + signature + '&message=' + message;
request({uri: uri, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, body) {
// check if an error msg was received from the web api server
if (body == 'There was an error. Check your console.')
return cb(null);
else
return cb(body);
});
}
} else {
// cmd not in use. return null.
return cb(null);
}
},
get_geo_location: function(address, cb) {
request({uri: 'https://freegeoip.app/json/' + address, json: true, headers: {'User-Agent': 'eiquidus'}}, function (error, response, geo) {