Updated tweetnacl-js to 1.0.0

This commit is contained in:
varjolintu 2017-05-27 15:08:51 +03:00
parent 1ee1a1ce54
commit 10406eb5c2
6 changed files with 69 additions and 64 deletions

44
CHANGELOG Normal file
View file

@ -0,0 +1,44 @@
0.1.6 (2017-05-27)
=========================
- Upgraded tweetnacl-js to 1.0.0
- Upgraded tweetnacl-utils-js to 0.15.0
- Some code fixes concerning encryption and decryption
- Redesigned password generator dialog
0.1.5 (2017-05-22)
=========================
- Fixed a few deprecated functions
- Added some more Firefox compatible code (Firefox now works 90%!)
- Removed an unncecessary .map file
0.1.4 (2017-05-21)
=========================
- Upgraded manifest options to V2
- Added some more Firefox compatible code
0.1.3 (2017-05-19)
=========================
- Fixed a bug showing correct status in the popup
- Added a license for a quick method to determine which browser is used in API calls
0.1.2 (2017-05-18)
=========================
- Upgraded jquery from 3.2.0 to 3.2.1
- Removed unnecessary images
- Upgraded deprecated API calls (extension -> runtime, so from synchronous to asynchronous)
- Partial Firefox support (the extension can be loaded but functionality is still limited)
0.1.1 (2017-04-28)
=========================
- This version works with the KeePassXC fork
- Upgraded JavaScripts to work asynchronously
0.1.0 (2017-04-12)
=========================
- Replaced crypto libraries with tweetnacl-js
- New application and popup icons
- Upgraded bootstrap to version 3.3.7
- Upgraded jquery from 1.11 to 3.2.0
- Upgraded jquery-ui from 1.10.2 to 1.12.1

View file

@ -76,7 +76,7 @@ keepass.updateCredentials = function(callback, tab, entryId, username, password,
keepass.callbackOnId(keepass.nativePort.onMessage, "set-login", function(response) {
if (response.message && response.nonce) {
var res = keepass.decrypt(response.message, response.nonce);
if (res == false)
if (!res)
{
console.log("Failed to decrypt message");
}
@ -146,7 +146,7 @@ keepass.retrieveCredentials = function (callback, tab, url, submiturl, forceCall
keepass.callbackOnId(keepass.nativePort.onMessage, "get-logins", function(response) {
if (response.message && response.nonce) {
var res = keepass.decrypt(response.message, response.nonce);
if (res == false)
if (!res)
{
console.log("Failed to decrypt message");
}
@ -227,7 +227,7 @@ keepass.generatePassword = function (callback, tab, forceCallback) {
keepass.callbackOnId(keepass.nativePort.onMessage, "generate-password", function(response) {
if (response.message && response.nonce) {
var res = keepass.decrypt(response.message, response.nonce);
if (res == false)
if (!res)
{
console.log("Failed to decrypt message");
}
@ -309,7 +309,7 @@ keepass.associate = function(callback, tab) {
keepass.callbackOnId(keepass.nativePort.onMessage, "associate", function(response) {
if (response.message && response.nonce) {
var res = keepass.decrypt(response.message, response.nonce);
if (res == false)
if (!res)
{
console.log("Failed to decrypt message");
}
@ -390,7 +390,7 @@ keepass.testAssociation = function (callback, tab, triggerUnlock) {
id: id,
key: idkey
};
console.log(messageData);
var request = {
action: "test-associate",
message: keepass.encrypt(messageData, nonce),
@ -400,7 +400,7 @@ keepass.testAssociation = function (callback, tab, triggerUnlock) {
keepass.callbackOnId(keepass.nativePort.onMessage, "test-associate", function(response) {
if (response.message && response.nonce) {
var res = keepass.decrypt(response.message, response.nonce);
if (res == false) {
if (!res) {
console.log("Failed to decrypt message");
}
else
@ -766,6 +766,9 @@ keepass.setCryptoKey = function(id, key) {
keepass.encrypt = function(input, nonce) {
var messageData = nacl.util.decodeUTF8(JSON.stringify(input));
var message = nacl.box(messageData, nonce, keepass.serverPublicKey, keepass.keyPair.secretKey);
if (!message) {
return "";
}
return keepass.b64e(message);
}

View file

@ -1,51 +0,0 @@
// Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
// Public domain.
(function(root, f) {
'use strict';
if (typeof module !== 'undefined' && module.exports) module.exports = f();
else if (root.nacl) root.nacl.util = f();
else {
root.nacl = {};
root.nacl.util = f();
}
}(this, function() {
'use strict';
var util = {};
util.decodeUTF8 = function(s) {
if (typeof s !== 'string') throw new TypeError('expected string');
var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
return b;
};
util.encodeUTF8 = function(arr) {
var i, s = [];
for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
return decodeURIComponent(escape(s.join('')));
};
util.encodeBase64 = function(arr) {
if (typeof btoa === 'undefined') {
return (new Buffer(arr)).toString('base64');
} else {
var i, s = [], len = arr.length;
for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
return btoa(s.join(''));
}
};
util.decodeBase64 = function(s) {
if (typeof atob === 'undefined') {
return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
} else {
var i, d = atob(s), b = new Uint8Array(d.length);
for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
return b;
}
};
return util;
}));

1
chromeKeePassXC/background/nacl-util.min.js vendored Executable file
View file

@ -0,0 +1 @@
!function(e,n){"use strict";"undefined"!=typeof module&&module.exports?module.exports=n():e.nacl?e.nacl.util=n():(e.nacl={},e.nacl.util=n())}(this,function(){"use strict";function e(e){if(!/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid encoding")}var n={};return n.decodeUTF8=function(e){if("string"!=typeof e)throw new TypeError("expected string");var n,r=unescape(encodeURIComponent(e)),t=new Uint8Array(r.length);for(n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t},n.encodeUTF8=function(e){var n,r=[];for(n=0;n<e.length;n++)r.push(String.fromCharCode(e[n]));return decodeURIComponent(escape(r.join("")))},"undefined"==typeof atob?"undefined"!=typeof Buffer.from?(n.encodeBase64=function(e){return Buffer.from(e).toString("base64")},n.decodeBase64=function(n){return e(n),new Uint8Array(Array.prototype.slice.call(Buffer.from(n,"base64"),0))}):(n.encodeBase64=function(e){return new Buffer(e).toString("base64")},n.decodeBase64=function(n){return e(n),new Uint8Array(Array.prototype.slice.call(new Buffer(n,"base64"),0))}):(n.encodeBase64=function(e){var n,r=[],t=e.length;for(n=0;n<t;n++)r.push(String.fromCharCode(e[n]));return btoa(r.join(""))},n.decodeBase64=function(n){e(n);var r,t=atob(n),o=new Uint8Array(t.length);for(r=0;r<t.length;r++)o[r]=t.charCodeAt(r);return o}),n});

View file

@ -9,6 +9,9 @@ window.browser = (function () {
window.chrome;
})();
// Initialize autocomplete feature
$(this.target).find('input').autocomplete();
// contains already called method names
var _called = {};
@ -87,7 +90,7 @@ var cipAutocomplete = {};
cipAutocomplete.elements = [];
cipAutocomplete.init = function(field) {
if(field.hasClass("ui-autocomplete-input")) {
if (field.hasClass("ui-autocomplete-input")) {
//_f(credentialInputs[i].username).autocomplete("source", autocompleteSource);
field.autocomplete("destroy");
}
@ -256,11 +259,16 @@ cipPassword.createDialog = function() {
title: "Password Generator",
classes: {"ui-dialog": "ui-corner-all"},
buttons: {
"Generate": function(e) {
e.preventDefault();
browser.runtime.sendMessage({
action: "generate_password"
}, cipPassword.callbackGeneratedPassword);
"Generate":
{
text: "Generate",
id: "cip-genpw-btn-generate",
click: function(e) {
e.preventDefault();
browser.runtime.sendMessage({
action: "generate_password"
}, cipPassword.callbackGeneratedPassword);
}
},
"Copy": function(e) {
e.preventDefault();

View file

@ -25,7 +25,7 @@
"background": {
"scripts": [
"background/nacl.min.js",
"background/nacl-util.js",
"background/nacl-util.min.js",
"background/keepass.js",
"background/httpauth.js",
"background/browserAction.js",