mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 19:02:20 -05:00
Merge branch 'dev/ssl-pinning'
This commit is contained in:
commit
73d9914ad6
@ -116,7 +116,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
files: ['src/*.js', 'src/**/*.html', 'src/**/*.json', 'src/img/**/*', 'src/font/**/*'],
|
files: ['src/*.js', 'src/**/*.html', 'src/**/*.json', 'src/img/**/*', 'src/font/**/*'],
|
||||||
tasks: ['copy:app', 'copy:tpl', 'copy:img', 'copy:font', 'manifest-dev']
|
tasks: ['copy:app', 'copy:ca', 'copy:tpl', 'copy:img', 'copy:font', 'manifest-dev']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copy: {
|
copy: {
|
||||||
@ -190,6 +190,12 @@ module.exports = function(grunt) {
|
|||||||
src: ['*'],
|
src: ['*'],
|
||||||
dest: 'dist/tpl/'
|
dest: 'dist/tpl/'
|
||||||
},
|
},
|
||||||
|
ca: {
|
||||||
|
expand: true,
|
||||||
|
cwd: 'src/ca/',
|
||||||
|
src: ['*'],
|
||||||
|
dest: 'dist/ca/'
|
||||||
|
},
|
||||||
app: {
|
app: {
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: 'src/',
|
cwd: 'src/',
|
||||||
|
24
src/ca/Google_Internet_Authority_G2.pem
Normal file
24
src/ca/Google_Internet_Authority_G2.pem
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
|
||||||
|
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
|
||||||
|
YWwgQ0EwHhcNMTMwNDA1MTUxNTU1WhcNMTUwNDA0MTUxNTU1WjBJMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UEChMKR29vZ2xlIEluYz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aFETzf3I93k9mTXwVqO94FntT0QJo544evZG0R0SnU++0ED8Vf4GXjza
|
||||||
|
HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto
|
||||||
|
WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6
|
||||||
|
yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx
|
||||||
|
-----END CERTIFICATE-----
|
@ -152,10 +152,31 @@ define(function(require) {
|
|||||||
* Instanciate the mail email data access object and its dependencies. Login to imap on init.
|
* Instanciate the mail email data access object and its dependencies. Login to imap on init.
|
||||||
*/
|
*/
|
||||||
self.init = function(userId, token, callback) {
|
self.init = function(userId, token, callback) {
|
||||||
var auth, imapOptions, smtpOptions,
|
var auth, imapOptions, smtpOptions, certificate,
|
||||||
lawnchairDao, restDao, pubkeyDao,
|
lawnchairDao, restDao, pubkeyDao,
|
||||||
keychain, imapClient, smtpClient, pgp, userStorage;
|
keychain, imapClient, smtpClient, pgp, userStorage, xhr;
|
||||||
|
|
||||||
|
// fetch pinned local ssl certificate
|
||||||
|
xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', '/ca/Google_Internet_Authority_G2.pem');
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.readyState === 4 && xhr.status === 200 && xhr.responseText) {
|
||||||
|
certificate = xhr.responseText;
|
||||||
|
setupDaos();
|
||||||
|
} else {
|
||||||
|
callback({
|
||||||
|
errMsg: 'Could not fetch pinned certificate!'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.onerror = function() {
|
||||||
|
callback({
|
||||||
|
errMsg: 'Could not fetch pinned certificate!'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
|
||||||
|
function setupDaos() {
|
||||||
// create mail credentials objects for imap/smtp
|
// create mail credentials objects for imap/smtp
|
||||||
auth = {
|
auth = {
|
||||||
XOAuth2: {
|
XOAuth2: {
|
||||||
@ -168,7 +189,8 @@ define(function(require) {
|
|||||||
secure: config.gmail.imap.secure,
|
secure: config.gmail.imap.secure,
|
||||||
port: config.gmail.imap.port,
|
port: config.gmail.imap.port,
|
||||||
host: config.gmail.imap.host,
|
host: config.gmail.imap.host,
|
||||||
auth: auth
|
auth: auth,
|
||||||
|
ca: [certificate]
|
||||||
};
|
};
|
||||||
smtpOptions = {
|
smtpOptions = {
|
||||||
secure: config.gmail.smtp.secure,
|
secure: config.gmail.smtp.secure,
|
||||||
@ -193,7 +215,9 @@ define(function(require) {
|
|||||||
emailAddress: userId,
|
emailAddress: userId,
|
||||||
asymKeySize: config.asymKeySize
|
asymKeySize: config.asymKeySize
|
||||||
};
|
};
|
||||||
|
|
||||||
self._emailDao.init(account, callback);
|
self._emailDao.init(account, callback);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
Loading…
Reference in New Issue
Block a user