Skip to content

Commit

Permalink
Updated dependancies, improved error handling and hide secret
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali60351 committed Apr 26, 2018
1 parent 05dc493 commit 54db7aa
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<v-btn @click="selectDir" block primary>Select</v-btn>
</v-flex>
<v-flex v-if="modeOfOperation === 'symmetric'" xs12>
<v-text-field v-model="symmetricPassword" label="Enter password"></v-text-field>
<v-text-field :append-icon="visibility ? 'visibility' : 'visibility_off'" v-model="symmetricPassword" :append-icon-cb="() => (visibility = !visibility)" :type="visibility ? 'password' : 'text'" label="Enter password"></v-text-field>
</v-flex>
</v-layout>
<v-layout row wrap text-xs-center>
Expand Down
53 changes: 50 additions & 3 deletions app/javascripts/main/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var app = new Vue({
infoFlag: false,
modeOfOperation: 'Unsecure',
symmetricPassword: '',
visibility: true,
items: [{
icon: 'home',
title: 'Home',
Expand Down Expand Up @@ -81,7 +82,7 @@ var app = new Vue({
var files = getFiles(this.selectedDir);

if (files.length == 0) {
alert('This directory does not contains any files');
error('This directory does not contains any files');
return;
}

Expand Down Expand Up @@ -129,6 +130,16 @@ var app = new Vue({
properties: ["openFile"]
});

if (privatePath == null) {
error('No private key selected');
return;
}

if (publicPath == null) {
error('No public key selected');
return;
}

hashArr = getHashes(app.queue);
encryptHashPublicDual(hashArr, privatePath[0], publicPath[0]);
} else if (app.modeOfOperation === 'onePublic') {
Expand All @@ -139,11 +150,20 @@ var app = new Vue({
properties: ["openFile"]
});

if (privatePath == null) {
error('No private key selected');
return;
}

hashArr = getHashes(app.queue);
encryptHashPublicSingle(hashArr, privatePath[0]);
} else if (app.modeOfOperation === 'symmetric') {
if (app.symmetricPassword === '') {
error('No password selected. Please type password before selecting directory');
return;
}

hashArr = getHashes(app.queue);
// console.log(hashArr);
encryptHashSymmetric(hashArr);
}

Expand All @@ -167,6 +187,16 @@ var app = new Vue({
properties: ["openFile"]
});

if (privatePathD == null) {
error('No private key selected');
return;
}

if (publicPathD == null) {
error('No public key selected');
return;
}

var verifyArrDecrypted = decryptHashPublicDual(path.resolve(app.selectedDir, 'QuickFIV.json'), privatePathD[0], publicPathD[0]);
getAlgorithms(verifyArrDecrypted);
hashArr = getHashes(app.queue);
Expand All @@ -177,19 +207,28 @@ var app = new Vue({
properties: ["openFile"]
});

if (publicPathD == null) {
error('No public key selected');
return;
}

var verifyArrDecrypted = decryptHashPublicSingle(path.resolve(app.selectedDir, 'QuickFIV.json'), publicPathD[0]);
getAlgorithms(verifyArrDecrypted);
hashArr = getHashes(app.queue);
verifyHashes(verifyArrDecrypted);
} else if (app.modeOfOperation === 'symmetric') {
if (app.symmetricPassword === '') {
error('No password selected. Please type password before selecting directory');
return;
}

var verifyArrDecrypted = decryptHashSymmetric(path.resolve(app.selectedDir, 'QuickFIV.json'));
getAlgorithms(verifyArrDecrypted);
hashArr = getHashes(app.queue);
verifyHashes(verifyArrDecrypted);
}
}
} catch (err) {
// console.log(err);
error(err.toString());
}
}, 1000)
Expand All @@ -209,6 +248,14 @@ var app = new Vue({
defaultPath: path.resolve('..', 'Public.qfv')
});

if (privatePath == null || publicPath == null)
{
alert('Invalid Location');
return;
}

console.log(privatePath);

var public = key.exportKey("public");
var private = key.exportKey("private");

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"devDependencies": {
"electron": "^1.8.4",
"electron-builder": "^19.48.2",
"electron-builder": "^20.10.0",
"gulp": "^3.9.1",
"mocha": "^4.0.1",
"spectron": "^3.7.2",
Expand Down

0 comments on commit 54db7aa

Please sign in to comment.