Skip to content

Commit

Permalink
Merge pull request mitro-co#98 from Ghoublai-Khan/master
Browse files Browse the repository at this point in the history
Cleaning up js lint errors.
  • Loading branch information
vijayp committed May 15, 2015
2 parents 9de73eb + 88361db commit ae43f83
Show file tree
Hide file tree
Showing 42 changed files with 548 additions and 523 deletions.
15 changes: 5 additions & 10 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
browser-ext/third_party/*
mitro-core
emailer
browser-ext/login/common/jquery.min.js
broswer-ext/login/frontend/static/js/bootstrap.min.js
broswer-ext/login/frontend/static/js/jquery-csv.js
browser-ext/login/frontend/static/js/jquery-ui.min.js
broswer-ext/login/frontend/static/js/jquery.ba-resize.min.js
broswer-ext/login/frontend/static/js/jquery.jscrollpane.min.js
browser-ext/login/frontend/static/js/jquery.min.js
browser-ext/login/frontend/static/js/jquery.mousewheel.js
broswer-ext/login/frontend/static/js/jquery.validate.min.js
browser-ext/login/frontend/static/js/underscore-min.js
**/*min.js
**/*externs*
**/*jquery-csv.js
**/*URI.js
**/*hogan-template.js
browser-ext/login/new-ui-mockups/*
32 changes: 19 additions & 13 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"asi": true,
"eqnull": true,
"loopfunc": true,
"expr": true,
"funcscope": true,
"supernew": true,
"laxbreak": true,
"boss": true,
"laxcomma": true,
"asi": false,
"eqnull": false,
"loopfunc": false,
"expr": false,
"funcscope": false,
"supernew": false,
"laxbreak": false,
"boss": false,
"laxcomma": false,
"multistr": true,
"validthis": true,
"sub": true,
"shadow": true,
"evil": true
"validthis": false,
"sub": false,
"shadow": false,
"evil": true,
"globals": {
"self": false,
"importScripts": false
//"forge": false,
//"mitro": false
}
}
9 changes: 5 additions & 4 deletions browser-ext/api/js/cli/crappycrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ CryptoError.prototype = new Error();

// Decent hash function
var hash = function(s){
return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0);
return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a;},0);
};

var MAX_VALUE = 100;

function CrappyPublicKey(name){
this.publicKeyValue = 0;
};
}
CrappyPublicKey.prototype.setKeyFromString= function(key) {
this.publicKeyValue = parseInt(key);
};
Expand All @@ -89,7 +89,7 @@ CrappyPublicKey.prototype.verifySignedByMe = function(signedMessage) {
CrappyPrivateKey.prototype = new CrappyPublicKey();
CrappyPrivateKey.prototype.constructor=CrappyPrivateKey;
function CrappyPrivateKey() {
};
}

CrappyPrivateKey.prototype.getPKValue=function(){
return MAX_VALUE - this.publicKeyValue;
Expand Down Expand Up @@ -181,13 +181,14 @@ function makePublicKey(encryptionPublic) {

function loadFromJson(value, password) {
value = JSON.parse(value);
var key;

if (value.type == 'PRV' || value.type == 'PAS') {
if (value.type == 'PAS' && value.password != password) {
throw new CryptoError('Password does not match?');
}

var key = new CrappyPrivateKey();
key = new CrappyPrivateKey();
key.setKeyFromString(value.key);
return makePrivateKey(key);
} else if (value.type == 'PUB') {
Expand Down
4 changes: 2 additions & 2 deletions browser-ext/api/js/cli/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function loadFromJson(jsonString, password) {
function decryptWith(json, otherKey) {
var str = otherKey.decrypt(json);
return loadFromJson(str);
};
}

// converts a pair of keyczar keys into a single Mitro key object.
function _makeKeyNoMemo(encryptionKey, signingKey) {
Expand Down Expand Up @@ -204,7 +204,7 @@ function _makeKeyNoMemo(encryptionKey, signingKey) {
var memoKey = mitro.cache.makeKey('decrypt', message);
var memoResult = cache.getItem(memoKey);
if (memoResult) {
;

} else {
memoResult = key.decryptNoMemo(message);
cache.setItem(memoKey, memoResult);
Expand Down
Loading

0 comments on commit ae43f83

Please sign in to comment.