1
0
mirror of https://github.com/moparisthebest/mail synced 2025-02-16 15:10:10 -05:00

cleanup strict mode function placement

This commit is contained in:
Tankred Hase 2013-04-02 15:02:57 +02:00
parent 5c0e04cc31
commit ef54dc3aae
12 changed files with 1250 additions and 1295 deletions

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* A Wrapper for Crypto.js's AES-CBC encryption * A Wrapper for Crypto.js's AES-CBC encryption
*/ */
app.crypto.AesCBC = function() { app.crypto.AesCBC = function() {
'use strict';
var mode = CryptoJS.mode.CBC; // use CBC mode for Crypto.js var mode = CryptoJS.mode.CBC; // use CBC mode for Crypto.js
var padding = CryptoJS.pad.Pkcs7; // use Pkcs7/Pkcs5 padding for Crypto.js var padding = CryptoJS.pad.Pkcs7; // use Pkcs7/Pkcs5 padding for Crypto.js
@ -54,6 +52,4 @@
return pt; return pt;
}; };
}; };
}());

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* A Wrapper for SJCL's authenticated AES-CCM encryption * A Wrapper for SJCL's authenticated AES-CCM encryption
*/ */
app.crypto.AesCCM = function() { app.crypto.AesCCM = function() {
'use strict';
var adata = []; // authenticated data (empty by default) var adata = []; // authenticated data (empty by default)
var tlen = 64; // The tag length in bits var tlen = 64; // The tag length in bits
@ -49,6 +47,4 @@
return pt; return pt;
}; };
}; };
}());

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* A Wrapper for SJCL's authenticated AES-GCM encryption * A Wrapper for SJCL's authenticated AES-GCM encryption
*/ */
app.crypto.AesGCM = function() { app.crypto.AesGCM = function() {
'use strict';
var adata = []; // authenticated data (empty by default) var adata = []; // authenticated data (empty by default)
var tlen = 128; // The tag length in bits var tlen = 128; // The tag length in bits
@ -49,6 +47,4 @@
return pt; return pt;
}; };
}; };
}());

View File

@ -1,11 +1,9 @@
(function() { /**
'use strict';
/**
* High level crypto api that invokes native crypto (if available) and * High level crypto api that invokes native crypto (if available) and
* gracefully degrades to JS crypto (if unavailable) * gracefully degrades to JS crypto (if unavailable)
*/ */
app.crypto.Crypto = function(window, util) { app.crypto.Crypto = function(window, util) {
'use strict';
var symmetricUserKey, // the user's secret key used to encrypt item-keys var symmetricUserKey, // the user's secret key used to encrypt item-keys
aes = new app.crypto.AesCCM(); // use authenticated AES-CCM mode by default aes = new app.crypto.AesCCM(); // use authenticated AES-CCM mode by default
@ -244,6 +242,4 @@
}); });
}; };
}; };
}());

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* A Wrapper for Crypto.js's PBKDF2 function * A Wrapper for Crypto.js's PBKDF2 function
*/ */
app.crypto.PBKDF2 = function() { app.crypto.PBKDF2 = function() {
'use strict';
/** /**
* PBKDF2-HMAC-SHA1 key derivation with a constant salt and 1000 iterations * PBKDF2-HMAC-SHA1 key derivation with a constant salt and 1000 iterations
@ -23,6 +21,4 @@
return keyBase64; return keyBase64;
}; };
}; };
}());

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* A wrapper for asymmetric OpenPGP encryption logic * A wrapper for asymmetric OpenPGP encryption logic
*/ */
app.crypto.PGP = function(window, openpgp, util, server) { app.crypto.PGP = function(window, openpgp, util, server) {
'use strict';
var self = this, var self = this,
privateKey, // user's private key privateKey, // user's private key
@ -334,9 +332,7 @@
} }
}; };
}; };
}());
/** /**
* This function needs to be implemented, since it is used by the openpgp utils * This function needs to be implemented, since it is used by the openpgp utils

View File

@ -1,8 +1,9 @@
(function() { /**
* Various utitity methods for crypto, encoding & decoding
*/
app.crypto.Util = function(window, uuid) {
'use strict'; 'use strict';
app.crypto.Util = function(window, uuid) {
/** /**
* Generates a new RFC 4122 version 4 compliant random UUID * Generates a new RFC 4122 version 4 compliant random UUID
*/ */
@ -163,6 +164,4 @@
return str; return str;
}; };
}; };
}());

View File

@ -1,11 +1,9 @@
(function() { /**
'use strict';
/**
* High level storage api for handling syncing of data to * High level storage api for handling syncing of data to
* and from the cloud. * and from the cloud.
*/ */
app.dao.CloudStorage = function(window, $) { app.dao.CloudStorage = function(window, $) {
'use strict';
/** /**
* Lists the encrypted items * Lists the encrypted items
@ -126,6 +124,4 @@
}); });
}; };
}; };
}());

View File

@ -1,13 +1,11 @@
(function() { /**
'use strict';
/**
* High level storage api that handles all persistence on the device. If * High level storage api that handles all persistence on the device. If
* SQLcipher/SQLite is available, all data is securely persisted there, * SQLcipher/SQLite is available, all data is securely persisted there,
* through transparent encryption. If not, the crypto API is * through transparent encryption. If not, the crypto API is
* used to encrypt data on the fly before persisting via a JSON store. * used to encrypt data on the fly before persisting via a JSON store.
*/ */
app.dao.DeviceStorage = function(util, crypto, jsonDao, sqlcipherDao) { app.dao.DeviceStorage = function(util, crypto, jsonDao, sqlcipherDao) {
'use strict';
/** /**
* Stores a list of encrypted items in the object store * Stores a list of encrypted items in the object store
@ -64,6 +62,4 @@
jsonDao.clear(callback); jsonDao.clear(callback);
}; };
}; };
}());

View File

@ -1,11 +1,9 @@
(function() { /**
'use strict';
/**
* A high-level Data-Access Api for handling Email synchronization * A high-level Data-Access Api for handling Email synchronization
* between the cloud service and the device's local storage * between the cloud service and the device's local storage
*/ */
app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage) { app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage) {
'use strict';
/** /**
* Inits all dependencies * Inits all dependencies
@ -116,6 +114,4 @@
}); });
}; };
}; };
}());

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* Handles generic caching of JSON objects in a lawnchair adapter * Handles generic caching of JSON objects in a lawnchair adapter
*/ */
app.dao.LawnchairDAO = function(window) { app.dao.LawnchairDAO = function(window) {
'use strict';
var db = new Lawnchair({ var db = new Lawnchair({
name: 'data-store' name: 'data-store'
@ -114,6 +112,4 @@
db.nuke(callback); db.nuke(callback);
}; };
}; };
}());

View File

@ -1,10 +1,8 @@
(function() { /**
'use strict';
/**
* Handles generic caching of JSON objects in LocalStorage * Handles generic caching of JSON objects in LocalStorage
*/ */
app.dao.LocalStorageDAO = function(window) { app.dao.LocalStorageDAO = function(window) {
'use strict';
/** /**
* Stringifies an object literal to JSON and perists it * Stringifies an object literal to JSON and perists it
@ -54,6 +52,4 @@
window.localStorage.clear(); window.localStorage.clear();
}; };
}; };
}());