Merge branch 'develop'

This commit is contained in:
varjolintu 2017-06-13 13:29:10 +03:00
commit 2c81b75094
6 changed files with 50 additions and 17 deletions

View file

@ -1,3 +1,7 @@
0.1.8 (2017-05-28)
=========================
- Enable relaunching and reconnecting to KeePassXC
0.1.7 (2017-05-28)
=========================
- Removed debug logging messages

View file

@ -128,6 +128,7 @@ event.onGetStatus = function(callback, tab) {
browserAction.showDefault(null, tab);
console.log(page.tabs[tab.id].errorMessage);
console.log("Configured: " + configured + " Key id: " + keyId + " closed: " + keepass.isDatabaseClosed + " avail: " + keepass.isKeePassXCAvailable + " unreg: " + keepass.isEncryptionKeyUnrecognized + " isass: " + keepass.isAssociated());
callback({
identifier: keyId,
configured: configured,
@ -141,6 +142,37 @@ event.onGetStatus = function(callback, tab) {
}, tab);
}
event.onReconnect = function(callback, tab) {
keepass.connectToNative();
keepass.generateNewKeyPair();
keepass.changePublicKeys(null, function(pkRes) {
keepass.getDatabaseHash(function(gdRes) {
if (gdRes) {
keepass.testAssociation(function(response) {
keepass.isConfigured(function(configured) {
var keyId = null;
if (configured) {
keyId = keepass.keyRing[keepass.databaseHash].id;
}
browserAction.showDefault(null, tab);
console.log(page.tabs[tab.id].errorMessage);
callback({
identifier: keyId,
configured: configured,
databaseClosed: keepass.isDatabaseClosed,
keePassXCAvailable: keepass.isKeePassXCAvailable,
encryptionKeyUnrecognized: keepass.isEncryptionKeyUnrecognized,
associated: keepass.isAssociated(),
error: page.tabs[tab.id].errorMessage
});
});
}, tab);
}
}, null);
});
}
event.onPopStack = function(callback, tab) {
browserAction.stackPop(tab.id);
browserAction.show(null, tab);
@ -250,5 +282,6 @@ event.messageHandlers = {
'stack_add': browserAction.stackAdd,
'update_available_keepassxc': event.onUpdateAvailableKeePassXC,
'generate_password': keepass.generatePassword,
'copy_password': keepass.copyPassword
'copy_password': keepass.copyPassword,
"reconnect": event.onReconnect
};

View file

@ -33,9 +33,9 @@ var _interval = 250;
* @param {object} tab
*/
browser.tabs.onCreated.addListener(function(tab) {
if(tab.id > 0) {
if (tab.id > 0) {
//console.log("browser.tabs.onCreated(" + tab.id+ ")");
if(tab.selected) {
if (tab.selected) {
page.currentTabId = tab.id;
event.invoke(page.switchTab, null, tab.id, []);
}
@ -49,7 +49,7 @@ browser.tabs.onCreated.addListener(function(tab) {
*/
browser.tabs.onRemoved.addListener(function(tabId, removeInfo) {
delete page.tabs[tabId];
if(page.currentTabId == tabId) {
if (page.currentTabId == tabId) {
page.currentTabId = -1;
}
});
@ -66,9 +66,9 @@ browser.tabs.onActivated.addListener(function(activeInfo) {
browser.tabs.get(activeInfo.tabId, function(info) {
//console.log(info.id + ": " + info.url);
if(info && info.id) {
if (info && info.id) {
page.currentTabId = info.id;
if(info.status == "complete") {
if (info.status == "complete") {
//console.log("event.invoke(page.switchTab, null, "+info.id + ", []);");
event.invoke(page.switchTab, null, info.id, []);
}
@ -82,7 +82,7 @@ browser.tabs.onActivated.addListener(function(activeInfo) {
* @param {object} changeInfo
*/
browser.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if(changeInfo.status == "complete") {
if (changeInfo.status == "complete") {
event.invoke(browserAction.removeRememberPopup, null, tabId, []);
}
});

View file

@ -15,7 +15,7 @@ keepass.nativePort = null;
keepass.keySize = 24;
keepass.latestVersionUrl = "https://raw.githubusercontent.com/keepassxreboot/keepassxc/develop/CHANGELOG";
keepass.cacheTimeout = 30 * 1000; // milliseconds
keepass.databaseHash = "no-hash"; //no-hash = keepasshttp is too old and does not return a hash value
keepass.databaseHash = "no-hash"; //no-hash = KeePassXC is too old and does not return a hash value
keepass.keyRing = (typeof(localStorage.keyRing) == 'undefined') ? {} : JSON.parse(localStorage.keyRing);
keepass.keyId = "chromekeepassxc-cryptokey-name";
keepass.keyBody = "chromekeepassxc-key";
@ -237,8 +237,6 @@ keepass.generatePassword = function (callback, tab, forceCallback) {
keepass.setcurrentKeePassXCVersion(parsed.version);
if (keepass.verifyResponse(parsed, response.nonce)) {
var rIv = response.nonce;
// var response = JSON.stringify({ Login: (msg.password.length * 8), Password: msg.password });
if (parsed.entries) {
passwords = parsed.entries;
keepass.updateLastUsed(keepass.databaseHash);
@ -490,7 +488,7 @@ keepass.getDatabaseHash = function (callback, tab, triggerUnlock) {
}
keepass.changePublicKeys = function(tab, callback) {
if (!keepass.isConnected || keepass.serverPublicKey) {
if (!keepass.isConnected) {
return;
}
@ -529,9 +527,6 @@ keepass.changePublicKeys = function(tab, callback) {
}
keepass.generateNewKeyPair = function() {
if (keepass.keyPair.publicKey !== null && keepass.keyPair.secretKey !== null)
return;
keepass.keyPair = nacl.box.keyPair();
//console.log(keepass.b64e(keepass.keyPair.publicKey) + " " + keepass.b64e(keepass.keyPair.secretKey));
}

View file

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "chromeKeePassXC",
"version": "0.1.7",
"version": "0.1.8",
"description": "KeePassXC integration for modern web browsers",
"author": "Sami Vänttinen",
"icons": {

View file

@ -5,6 +5,7 @@ window.browser = (function () {
})();
function status_response(r) {
console.log(r);
$('#initial-state').hide();
$('#error-encountered').hide();
$('#need-reconfigure').hide();
@ -27,7 +28,7 @@ function status_response(r) {
$('#need-reconfigure').show();
$('#need-reconfigure-message').html(r.error);
}
else if(typeof(r.error) != "undefined" || r.error != null) {
else if (r.error != null) {
$('#error-encountered').show();
$('#error-message').html(r.error);
}
@ -54,7 +55,7 @@ $(function() {
$("#reload-status-button").click(function() {
browser.runtime.sendMessage({
action: "get_status"
action: "reconnect"
}, status_response);
});