Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #115 from alecalve/cleaning-semicolons
Browse files Browse the repository at this point in the history
fix(Cosmetic): removed unnecessary semicolons and added missing ones
  • Loading branch information
Sjors committed Feb 11, 2016
2 parents 993414e + 13c096c commit e6fead6
Show file tree
Hide file tree
Showing 19 changed files with 170 additions and 170 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('es6-promise').polyfill();
require('isomorphic-fetch');

var Buffer = require('buffer').Buffer
var Buffer = require('buffer').Buffer;

// This fixes a bug with Safari < 8 and the Browserify Buffer shim used in Crypto-browserify/randombytes
// See: https://github.com/feross/buffer/issues/63
Expand Down
16 changes: 8 additions & 8 deletions src/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Object.defineProperties(Address.prototype, {
MyWallet.syncWallet();
}
else
{ throw 'Error: address.archived must be a boolean';};
{ throw 'Error: address.archived must be a boolean';}
}
},
"active": {
Expand All @@ -137,7 +137,7 @@ Address.factory = function(o,a){
}
else {
o[a.addr] = a;
};
}
return o;
};

Expand All @@ -160,13 +160,13 @@ Address.import = function(key, label){
object.priv = Base58.encode(key.d.toBuffer(32));
break;
case Helpers.isBitcoinPrivateKey(key):
key = Bitcoin.ECKey.fromWIF(key)
key = Bitcoin.ECKey.fromWIF(key);
object.addr = key.pub.getAddress().toString();
object.priv = Base58.encode(key.d.toBuffer(32));
break;
default:
throw 'Error: address import format not supported';
};
}

//initialization
var address = new Address(object);
Expand Down Expand Up @@ -200,9 +200,9 @@ Address.fromString = function(keyOrAddr, label, bipPass){
}
else { reject('unknown key format'); }
}
}
};
return new Promise(asyncParse);
}
};

Address.new = function(label){
var key = Bitcoin.ECKey.makeRandom(true, RNG.run.bind(RNG));
Expand Down Expand Up @@ -230,15 +230,15 @@ Address.prototype.toJSON = function(){
Address.prototype.encrypt = function(cipher){
if (!this._priv) return this;
var priv = cipher ? cipher(this._priv) : this._priv;
if (!priv) { throw 'Error Encoding key'; };
if (!priv) { throw 'Error Encoding key'; }
this._temporal_priv = priv;
return this;
};

Address.prototype.decrypt = function(cipher){
if (!this._priv) return this;
var priv = cipher ? cipher(this._priv) : this._priv;
if (!priv) { throw 'Error Decoding key'; };
if (!priv) { throw 'Error Decoding key'; }
this._temporal_priv = priv;
return this;
};
Expand Down
14 changes: 7 additions & 7 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function API(){
API.prototype.encodeFormData = function (data) {
if (!data) return "";
var encoded = Object.keys(data).map(function(k) {
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k])
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]);
}).join('&');
return encoded;
};
Expand Down Expand Up @@ -55,7 +55,7 @@ API.prototype.request = function(action, method, data, withCred) {
) {
return response.json();
} else if (data.format === 'json') {
return response.json()
return response.json();
} else {
return response.text();

Expand All @@ -74,7 +74,7 @@ API.prototype.request = function(action, method, data, withCred) {
.catch(handleNetworkError)
.then(checkStatus)
.then(handleResponse);
}
};

////////////////////////////////////////////////////////////////////////////////
API.prototype.retry = function(f, n) {
Expand All @@ -87,7 +87,7 @@ API.prototype.retry = function(f, n) {
);
} else {
return f();
};
}
};

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -179,7 +179,7 @@ API.prototype.securePost = function (url, data){
if (!Helpers.isValidGUID(data.guid)) { clone.guid = MyWallet.wallet.guid; }
if (!data.sharedKey) {
var sharedKey = MyWallet.wallet ? MyWallet.wallet.sharedKey : undefined;
if (!Helpers.isValidSharedKey(sharedKey)) throw 'Shared key is invalid'
if (!Helpers.isValidSharedKey(sharedKey)) throw 'Shared key is invalid';
//Rather than sending the shared key plain text
//send a hash using a totp scheme
var now = new Date().getTime();
Expand All @@ -199,7 +199,7 @@ API.prototype.securePost = function (url, data){
clone.sKDebugOriginalClientTime = now;
clone.sKDebugOriginalSharedKey = sharedKey;
}
clone.api_code = this.API_CODE
clone.api_code = this.API_CODE;
clone.format = data.format ? data.format : 'plain';

return this.retry(this.request.bind(this, "POST", url, clone, true));
Expand All @@ -224,7 +224,7 @@ API.prototype.pushTx = function (tx, note){
{ return tx_hash;}
else
{ return responseText;}
}
};

return this.request("POST", "pushtx", data).then(responseTXHASH);
};
Expand Down
52 changes: 26 additions & 26 deletions src/blockchain-settings-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function get_account_info(success, error) {

typeof(error) === "function" && error();
});
};
}

function updateKV(txt, method, value, success, error, extra) {
if(typeof value == "string") {
Expand All @@ -40,7 +40,7 @@ function updateKV(txt, method, value, success, error, extra) {

function update_API_access(enabled, success, error) {
updateKV('Updating Api Access', 'update-api-access-enabled', enabled ? 1 : 0, success, error);
};
}

/**
* @param {string} ips Multiple ip addresses should be comma separated. Use % as a wildcard. For example 127.0.0.% to whitelist 127.0.0.1-127.0.0.254.
Expand All @@ -49,27 +49,27 @@ function update_API_access(enabled, success, error) {
*/
function update_IP_lock(ips, success, error) {
updateKV('Updating Locked Ip Addresses', 'update-ip-lock', ips, success, error);
};
}

function update_IP_lock_on(enabled, success, error) {
updateKV('Updating IP Lock', 'update-ip-lock-on', enabled ? true : false, success, error);
};
}

function change_language(language, success, error) {
updateKV('Updating Language', 'update-language', language, success, error);
};
}

function change_local_currency(code, success, error) {
updateKV('Updating Local Currency', 'update-currency', code, success, error);
};
}

function change_btc_currency(code, success, error) {
updateKV('Updating BTC Currency', 'update-btc-currency', code, success, error);
};
}

function update_tor_ip_block(enabled, success, error) {
updateKV('Updating TOR ip block', 'update-block-tor-ips', enabled, success, error);
};
}

function update_password_hint1(value, success, error) {
switch (true) {
Expand All @@ -84,8 +84,8 @@ function update_password_hint1(value, success, error) {
break;
default:
updateKV('Updating Main Password Hint', 'update-password-hint1', value, success, error);
};
};
}
}

function update_password_hint2(value, success, error) {
switch (true) {
Expand All @@ -100,28 +100,28 @@ function update_password_hint2(value, success, error) {
break;
default:
updateKV('Updating Logging Level', 'update-password-hint2', value, success, error);
};
};
}
}

function change_email(email, success, error) {
updateKV('Updating Email', 'update-email', email, success, error);
};
}

function changeMobileNumber(val, success, error) {
updateKV('Updating Cell Number', 'update-sms', val, success, error);
};
}

// Logging levels:
// 0 - Logging disabled
// 1 - Log actions with hashed IP addresses
// 2 - Log actions with IP addresses and user agents
function updateLoggingLevel(val, success, error) {
updateKV('Updating Logging Level', 'update-logging-level', val, success, error);
};
}

function toggleSave2FA(val, success, error) {
updateKV('Updating Save 2FA', 'update-never-save-auth-type', val ? true : false, success, error);
};
}

function updateAuthType(val, success, error) {
updateKV('Updating Two Factor Authentication', 'update-auth-type', val, function() {
Expand All @@ -132,11 +132,11 @@ function updateAuthType(val, success, error) {

function unsetTwoFactor(success, error) {
updateAuthType(0, success, error);
};
}

function setTwoFactorSMS(success, error) {
updateAuthType(5, success, error);
};
}

function setTwoFactorYubiKey(code, success, error) {
assert(code, "Activation code required");
Expand All @@ -155,11 +155,11 @@ function setTwoFactorYubiKey(code, success, error) {
error("Failed to configure Yubikey");
}
);
};
}

function setTwoFactorEmail(success, error) {
updateAuthType(2, success, error);
};
}

function setTwoFactorGoogleAuthenticator(success, error) {
MyWallet.securePost("wallet", { method : 'generate-google-secret' }, function(google_secret_url) {
Expand All @@ -168,14 +168,14 @@ function setTwoFactorGoogleAuthenticator(success, error) {
WalletStore.sendEvent("msg", {type: "error", message: data.responseText});
typeof(error) === "function" && error(data.responseText);
});
};
}

function confirmTwoFactorGoogleAuthenticator(code, success, error) {
updateKV('Updating Two Factor Authentication', 'update-auth-type', 4, function() {
WalletStore.setRealAuthType(4);
typeof(success) === "function" && success();
}, error, '?code='+code);
};
}

/**
* Resend email with verfication code.
Expand All @@ -185,7 +185,7 @@ function confirmTwoFactorGoogleAuthenticator(code, success, error) {
*/
function resendEmailConfirmation(email, success, error) {
updateKV('Resend Email Confirmation', 'update-email', email, success, error);
};
}

/**
* Verify email with code.
Expand All @@ -200,7 +200,7 @@ function verifyEmail(code, success, error) {
}, function(data) {
typeof(error) === "function" && error();
});
};
}

/**
* Verify mobile with code.
Expand All @@ -216,7 +216,7 @@ function verifyMobile(code, success, error) {
WalletStore.sendEvent("msg", {type: "error", message: data});
typeof(error) === "function" && error();
});
};
}

function getActivityLogs(success, error) {
MyWallet.securePost("wallet", {method : 'list-logs', format : 'json'}, function(data) {
Expand All @@ -226,7 +226,7 @@ function getActivityLogs(success, error) {
WalletStore.sendEvent("msg", {type: "error", message: response});
typeof(error) === "function" && error();
});
};
}

function enableEmailNotifications(success, error) {
API.securePost("wallet", {
Expand Down
Loading

0 comments on commit e6fead6

Please sign in to comment.