mirror of
https://github.com/moparisthebest/mail
synced 2024-11-29 12:22:22 -05:00
integrated changed into app
This commit is contained in:
parent
a58753d82b
commit
fcac34ae74
@ -19,25 +19,8 @@
|
|||||||
<script src="lib/lawnchair/lawnchair-adapter-indexed-db-git.js"></script>
|
<script src="lib/lawnchair/lawnchair-adapter-indexed-db-git.js"></script>
|
||||||
<script src="lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js"></script>
|
<script src="lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js"></script>
|
||||||
|
|
||||||
|
<script src="lib/forge/forge.rsa.bundle.js"></script>
|
||||||
<script src="lib/uuid.js"></script>
|
<script src="lib/uuid.js"></script>
|
||||||
<script src="lib/nacl.js"></script>
|
|
||||||
|
|
||||||
<script src="lib/sjcl/sjcl.js"></script>
|
|
||||||
<script src="lib/sjcl/sha256.js"></script>
|
|
||||||
<script src="lib/sjcl/random.js"></script>
|
|
||||||
<script src="lib/sjcl/bitArray.js"></script>
|
|
||||||
<script src="lib/sjcl/codecBase64.js"></script>
|
|
||||||
<script src="lib/sjcl/codecString.js"></script>
|
|
||||||
<script src="lib/sjcl/aes.js"></script>
|
|
||||||
<script src="lib/sjcl/ccm.js"></script>
|
|
||||||
|
|
||||||
<script src="lib/crypto-js/core.js"></script>
|
|
||||||
<script src="lib/crypto-js/enc-base64.js"></script>
|
|
||||||
<script src="lib/crypto-js/cipher-core.js"></script>
|
|
||||||
<script src="lib/crypto-js/aes.js"></script>
|
|
||||||
<script src="lib/crypto-js/sha1.js"></script>
|
|
||||||
<script src="lib/crypto-js/hmac.js"></script>
|
|
||||||
<script src="lib/crypto-js/pbkdf2.js"></script>
|
|
||||||
|
|
||||||
<script src="js/app-config.js"></script>
|
<script src="js/app-config.js"></script>
|
||||||
|
|
||||||
@ -48,14 +31,15 @@
|
|||||||
|
|
||||||
<script src="js/crypto/util.js"></script>
|
<script src="js/crypto/util.js"></script>
|
||||||
<script src="js/crypto/pbkdf2.js"></script>
|
<script src="js/crypto/pbkdf2.js"></script>
|
||||||
<script src="js/crypto/aes-ccm.js"></script>
|
<script src="js/crypto/aes-cbc.js"></script>
|
||||||
|
<script src="js/crypto/rsa.js"></script>
|
||||||
|
<script src="js/crypto/crypto-batch.js"></script>
|
||||||
<script src="js/crypto/crypto.js"></script>
|
<script src="js/crypto/crypto.js"></script>
|
||||||
<script src="js/crypto/nacl-crypto.js"></script>
|
|
||||||
|
|
||||||
<script src="js/dao/localstorage-dao.js"></script>
|
|
||||||
<script src="js/dao/lawnchair-dao.js"></script>
|
<script src="js/dao/lawnchair-dao.js"></script>
|
||||||
<script src="js/dao/devicestorage.js"></script>
|
<script src="js/dao/devicestorage.js"></script>
|
||||||
<script src="js/dao/cloudstorage-dao.js"></script>
|
<script src="js/dao/cloudstorage-dao.js"></script>
|
||||||
|
<script src="js/dao/keychain-dao.js"></script>
|
||||||
<script src="js/dao/email-dao.js"></script>
|
<script src="js/dao/email-dao.js"></script>
|
||||||
|
|
||||||
<script src="js/view/login-view.js"></script>
|
<script src="js/view/login-view.js"></script>
|
||||||
|
@ -20,8 +20,8 @@ var app; // container for the application namespace
|
|||||||
app.config = {
|
app.config = {
|
||||||
cloudUrl: 'http://storage.whiteout.io',
|
cloudUrl: 'http://storage.whiteout.io',
|
||||||
symKeySize: 128,
|
symKeySize: 128,
|
||||||
symIvSize: 104,
|
symIvSize: 128,
|
||||||
asymKeySize: 2048,
|
asymKeySize: 1024,
|
||||||
workerPath: 'js'
|
workerPath: 'js'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
login: function() {
|
login: function() {
|
||||||
// init email dao and dependencies
|
// init email dao and dependencies
|
||||||
var util = new app.crypto.Util(window, uuid);
|
var util = new cryptoLib.Util(window, uuid);
|
||||||
var jsonDao = new app.dao.LawnchairDAO(window);
|
var jsonDao = new app.dao.LawnchairDAO(Lawnchair);
|
||||||
var crypto = new app.crypto.Crypto(window, util);
|
var crypto = new app.crypto.Crypto(window, util);
|
||||||
var naclCrypto = new app.crypto.NaclCrypto(nacl, util);
|
|
||||||
var cloudstorage = new app.dao.CloudStorage(window, $);
|
var cloudstorage = new app.dao.CloudStorage(window, $);
|
||||||
var devicestorage = new app.dao.DeviceStorage(util, crypto, jsonDao, null);
|
var devicestorage = new app.dao.DeviceStorage(util, crypto, jsonDao, null);
|
||||||
this.emailDao = new app.dao.EmailDAO(_, crypto, devicestorage, cloudstorage, naclCrypto, util);
|
var keychain = new app.dao.KeychainDAO(jsonDao, cloudstorage);
|
||||||
|
this.emailDao = new app.dao.EmailDAO(_, crypto, devicestorage, cloudstorage, util, keychain);
|
||||||
|
|
||||||
var loginView = new app.view.LoginView({
|
var loginView = new app.view.LoginView({
|
||||||
dao: this.emailDao
|
dao: this.emailDao
|
||||||
|
@ -15,6 +15,12 @@ app.dao.DeviceStorage = function(util, crypto, jsonDao, sqlcipherDao) {
|
|||||||
this.storeEcryptedList = function(list, type, callback) {
|
this.storeEcryptedList = function(list, type, callback) {
|
||||||
var i, date, key, items = [];
|
var i, date, key, items = [];
|
||||||
|
|
||||||
|
// nothing to store
|
||||||
|
if (list.length === 0) {
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// format items for batch storing in dao
|
// format items for batch storing in dao
|
||||||
list.forEach(function(i) {
|
list.forEach(function(i) {
|
||||||
|
|
||||||
|
@ -78,6 +78,10 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, util, keycha
|
|||||||
callback(err);
|
callback(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (encryptedList.length === 0) {
|
||||||
|
callback(null, new app.model.EmailCollection());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// gather public key ids required to verify signatures
|
// gather public key ids required to verify signatures
|
||||||
encryptedList.forEach(function(i) {
|
encryptedList.forEach(function(i) {
|
||||||
@ -139,10 +143,11 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, util, keycha
|
|||||||
var folder, self = this;
|
var folder, self = this;
|
||||||
|
|
||||||
cloudstorage.listEncryptedItems('email', this.account.get('emailAddress'), folderName, function(err, data) {
|
cloudstorage.listEncryptedItems('email', this.account.get('emailAddress'), folderName, function(err, data) {
|
||||||
// return if an error occured or if fetched list from cloud storage is empty
|
// return if an error occured
|
||||||
if (err || !data || data.status || data.length === 0) {
|
if (err) {
|
||||||
callback({
|
callback({
|
||||||
error: err
|
errMsg: 'Syncing encrypted items from cloud failed!',
|
||||||
|
err: err
|
||||||
}); // error
|
}); // error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
var account = new app.model.Account({
|
var account = new app.model.Account({
|
||||||
emailAddress: userId,
|
emailAddress: userId,
|
||||||
symKeySize: app.config.symKeySize,
|
symKeySize: app.config.symKeySize,
|
||||||
symIvSize: app.config.symIvSize
|
symIvSize: app.config.symIvSize,
|
||||||
|
asymKeySize: app.config.asymKeySize
|
||||||
});
|
});
|
||||||
|
|
||||||
// show loading msg during init
|
// show loading msg during init
|
||||||
|
@ -33,14 +33,6 @@
|
|||||||
textVisible: true
|
textVisible: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// sync vinbox from cloud
|
|
||||||
self.dao.checkVInbox(function(err) {
|
|
||||||
if (err) {
|
|
||||||
$.mobile.loading('hide');
|
|
||||||
window.alert('Fetching new from inbox failed!');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// sync current folder from cloud
|
// sync current folder from cloud
|
||||||
self.dao.syncFromCloud(self.folder, function(err) {
|
self.dao.syncFromCloud(self.folder, function(err) {
|
||||||
$.mobile.loading('hide');
|
$.mobile.loading('hide');
|
||||||
@ -54,7 +46,6 @@
|
|||||||
// read local storage and add to list view
|
// read local storage and add to list view
|
||||||
self.loadItems();
|
self.loadItems();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +61,14 @@
|
|||||||
text: 'decrypting...',
|
text: 'decrypting...',
|
||||||
textVisible: true
|
textVisible: true
|
||||||
});
|
});
|
||||||
this.dao.listItems(this.folder, 0, 10, function(collection) {
|
this.dao.listItems(this.folder, 0, 10, function(err, collection) {
|
||||||
|
// check for error
|
||||||
|
if (err) {
|
||||||
|
$.mobile.loading('hide');
|
||||||
|
window.alert('Loading items from storage failed!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// clear list
|
// clear list
|
||||||
list.html('');
|
list.html('');
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
params.folder = this.options.folder;
|
params.folder = this.options.folder;
|
||||||
params.id = encodeURIComponent(params.id);
|
params.id = encodeURIComponent(params.id);
|
||||||
|
|
||||||
var util = new app.crypto.Util(window, null);
|
var util = new cryptoLib.Util(window, null);
|
||||||
var date = util.parseDate(params.sentDate);
|
var date = util.parseDate(params.sentDate);
|
||||||
params.displayDate = date.getDate() + '.' + (date.getMonth() + 1) + '. ' + date.getHours() + ':' + date.getMinutes();
|
params.displayDate = date.getDate() + '.' + (date.getMonth() + 1) + '. ' + date.getHours() + ':' + date.getMinutes();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user