Skip to content

Commit

Permalink
Merge pull request #13 from theolazian/update-to-v5
Browse files Browse the repository at this point in the history
Update openpgp to v5.3.0 🚀
  • Loading branch information
aliceandbob-io authored Oct 9, 2022
2 parents afbf4a2 + 112fbcf commit 02667d1
Show file tree
Hide file tree
Showing 14 changed files with 5,461 additions and 52,842 deletions.
5 changes: 3 additions & 2 deletions forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
[
"@electron-forge/plugin-webpack",
{
mainConfig: "./webpack.main.config.js",
devContentSecurityPolicy: `default-src 'self' 'unsafe-inline' data:; script-src 'self' 'unsafe-eval' 'unsafe-inline' data:`,
renderer: {
config: "./webpack.renderer.config.js",
entryPoints: [
Expand All @@ -42,7 +42,8 @@ module.exports = {
name: "main_window"
}
]
}
},
mainConfig: "./webpack.main.config.js"
}
]
]
Expand Down
8,205 changes: 2,867 additions & 5,338 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "aliceandbob.io",
"productName": "aliceandbob.io",
"version": "1.1.0-Beta.2",
"version": "1.0.0",
"description": "A free, light and easy to use PGP tool based on OpenPGP.js.",
"main": "./.webpack/main",
"scripts": {
Expand All @@ -24,37 +24,39 @@
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@electron-forge/cli": "^6.0.0-beta.54",
"@electron-forge/maker-deb": "^6.0.0-beta.54",
"@electron-forge/maker-rpm": "^6.0.0-beta.54",
"@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"@electron-forge/plugin-webpack": "^6.0.0-beta.59",
"@marshallofsound/webpack-asset-relocator-loader": "^0.5.0",
"@electron-forge/cli": "^6.0.0-beta.64",
"@electron-forge/maker-deb": "^6.0.0-beta.64",
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
"@electron-forge/maker-squirrel": "^6.0.0-beta.64",
"@electron-forge/maker-zip": "^6.0.0-beta.63",
"@electron-forge/plugin-webpack": "^6.0.0-beta.58",
"@popperjs/core": "^2.6.0",
"@vercel/webpack-asset-relocator-loader": "^1.7.0",
"autoprefixer": "^10.2.1",
"babel-loader": "^8.2.2",
"css-loader": "^4.2.1",
"electron": "^11.2.1",
"electron": "^19.0.0",
"file-loader": "^6.2.0",
"jquery": "^3.5.1",
"material-design-icons": "^3.0.1",
"jquery": "^3.6.0",
"node-loader": "^1.0.1",
"node-sass": "^5.0.0",
"openpgp": "^5.3.0",
"popper.js": "^1.16.1",
"postcss": "^8.3.6",
"postcss": "^8.2.4",
"postcss-loader": "^4.1.0",
"sass": "^1.32.4",
"sass-loader": "^10.1.1",
"stimulus": "^2.0.0",
"style-loader": "^1.2.1",
"url-loader": "^4.1.1",
"webpack": "^4.0.0"
"webpack": "^5.73.0"
},
"dependencies": {
"@electron/get": "^1.14.1",
"@fortawesome/fontawesome-free": "^5.15.2",
"bootstrap": "^4.6.0",
"electron-squirrel-startup": "^1.0.0",
"expose-loader": "^3.1.0"
"expose-loader": "^3.1.0",
"material-icons": "^1.11.2"
}
}
24 changes: 16 additions & 8 deletions src/controllers/keys_controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Controller } from "stimulus";
import { generateKey } from '../js/crypto.js';
import { generateMyKeys } from '../js/crypto.js';
import { download, copy, showPass } from "../js/index.js";

export default class extends Controller {
Expand Down Expand Up @@ -38,11 +38,11 @@ export default class extends Controller {
const passphraseParams = this.passphraseParamsTarget.value;
const curveParams = this.curveParamsTarget.value;

const key = await generateKey(emailParams, passphraseParams, curveParams).catch((err) => { console.error(err); });
const key = await generateMyKeys(emailParams, passphraseParams, curveParams).catch((err) => { console.error(err); });

if (key) {
this.privateKeyTarget.innerText = key.privateKeyArmored;
this.publicKeyTarget.innerText = key.publicKeyArmored;
this.privateKeyTarget.innerText = key.privateKey;
this.publicKeyTarget.innerText = key.publicKey;
this.initialStateTarget.classList.remove("d-none");
this.errorTarget.classList.add("d-none");
$([document.documentElement, document.body]).animate({
Expand Down Expand Up @@ -88,19 +88,27 @@ export default class extends Controller {
downloadKey(e) {
e.preventDefault();
let type = e.currentTarget.dataset.type;
let format = e.currentTarget.dataset.format;
if (type == "public") {
const text = this.publicKeyTarget.innerText;
download(text, "txt", "A&B - Public Key");
if (format == "asc") {
download(text, "text/asc", "aliceandbob.io - Public Key.asc");
} else {
download(text, "text/txt", "aliceandbob.io - Public Key.txt");
}
} else if (type == "private") {
const text = this.privateKeyTarget.innerText;
download(text, "txt", "A&B - Private Key");
if (format == "asc") {
download(text, "text/asc", "aliceandbob.io - Private Key.asc");
} else {
download(text, "text/txt", "aliceandbob.io - Private Key.txt");
}
} else {
download("Let's hope you didn't have any bad intention by doing so ;)", "txt", "Well try");
download("Let's hope you didn't have any bad intention by doing so ;)", "txt", "Well tried");
this.errorTarget.classList.remove("d-none");
$([document.documentElement, document.body]).animate({
scrollTop: 0
}, 1000);
}

}
}
80 changes: 47 additions & 33 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@
<div class="tab-pane fade show active" id="v-pills-generate" role="tabpanel" aria-labelledby="v-pills-home-tab">
<fieldset data-controller="keys" class="mb-5">
<legend>Generate a PGP key pair</legend>
<div class="row d-none error bg-danger rounded p-3 mb-4" data-target="keys.error">
<div class="row d-none error bg-danger rounded p-3 mb-4" data-keys-target="error">
<span>An error has occured. Please verify the submitted data or try again later.</span>
</div>
<div class="row mb-3">
<div class="col">
<div class="form-group mb-3">
<label>Email</label>
<input type="email" class="form-control" data-target="keys.emailParams" placeholder="[email protected]" value="">
<input type="email" class="form-control" data-keys-target="emailParams" placeholder="[email protected]" value="">
</div>
<div class="form-group mb-3">
<label>Passphrase</label>
<div class="mb-2"><small class="text-muted">There is no way to recover your passphrase so be sure not to forget it.</small></div>
<div class="input-group">
<input type="password" class="form-control" data-target="keys.passphraseParams" placeholder="a-str0ng_p@ssphras€!">
<input type="password" class="form-control" data-keys-target="passphraseParams" placeholder="a-str0ng_p@ssphras€!">
<div class="input-group-append" data-action="click->keys#showPassphrase">
<a class="input-group-text">
<span class="material-icons">
Expand All @@ -73,45 +73,56 @@
</div>
<div class="form-group mb-3">
<label>Curve encryption</label>
<div class="mb-2"><small class="text-muted">Choose the type of encryption for your key pair.</small></div>
<select class="form-control" data-target="keys.curveParams">
<div><small class="text-muted">Choose the type of encryption for your key pair.</small></div>
<div class="mb-2"><small class="text-muted">Brainpool and secp256k1 curves are no longer supported. <a href="https://github.com/openpgpjs/openpgpjs/pull/1395" target="_blank">See more</a></small></div>
<select class="form-control" data-keys-target="curveParams">
<option value="curve25519">curve25519</option>
<option value="ed25519">ed25519</option>
<option value="p256">p256</option>
<option value="p384">p384</option>
<option value="p521">p521</option>
<option value="brainpoolP256r1">brainpoolP256r1</option>
<option value="brainpoolP384r1">brainpoolP384r1</option>
<option value="brainpoolP512r1">brainpoolP512r1</option>
<option value="secp256k1">secp256k1</option>
<!-- Curves deprecated with openpgp.js v.5.0.0 -->
<!-- See https://github.com/openpgpjs/openpgpjs/pull/1395 -->
<!--
<option value="brainpoolP256r1">brainpoolP256r1</option>
<option value="brainpoolP384r1">brainpoolP384r1</option>
<option value="brainpoolP512r1">brainpoolP512r1</option>
<option value="secp256k1">secp256k1</option>
-->
</select>
</div>
</div>
</div>
<button data-action="click->keys#generate" data-target="keys.generateButton" type="submit" class="btn btn-primary btn-lg">
<button data-action="click->keys#generate" data-keys-target="generateButton" type="submit" class="btn btn-primary btn-lg">
<span class="mr-3">Generate</span>
<span class="material-icons icon-fix">vpn_key</span>
<span class="spinner-border icon-fix spinner-border-sm d-none" role="status" aria-hidden="true"></span>
</button>
<br>
<br>
<div class="row d-none" data-target="keys.initialState">
<div class="row d-none" data-keys-target="initialState">
<div class="col-lg-6">
<label>Public key</label>
<span class="material-icons md-light copy public-key" data-action="click->keys#copyToClipboard">content_copy</span>
<span class="copy-badge badge badge-light d-none">Copied!</span>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-target="keys.publicKey"></div>
<a href="#" class="download" data-action="click->keys#downloadKey" data-type="public">
<span class="material-icons mr-3">save</span>Download public key
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-keys-target="publicKey"></div>
<a href="#" class="btn btn-outline-primary btn-sm download mr-3" data-action="click->keys#downloadKey" data-type="public" data-format="txt">
<span class="material-icons align-top">save_alt</span>.txt
</a>
<a href="#" class="btn btn-outline-primary btn-sm download" data-action="click->keys#downloadKey" data-type="public" data-format="asc">
<span class="material-icons align-top">save_alt</span>.asc
</a>
</div>
<div class="col-lg-6">
<label>Private key</label>
<span class="material-icons md-light copy private-key" data-action="click->keys#copyToClipboard">content_copy</span>
<span class="copy-badge badge badge-light d-none">Copied!</span>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-target="keys.privateKey"></div>
<a href="#" class="download" data-action="click->keys#downloadKey" data-type="private">
<span class="material-icons mr-3">save</span>Download private key
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-keys-target="privateKey"></div>
<a href="#" class="btn btn-outline-primary btn-sm download mr-3" data-action="click->keys#downloadKey" data-type="private" data-format="txt">
<span class="material-icons align-top">save_alt</span>.txt
</a>
<a href="#" class="btn btn-outline-primary btn-sm download" data-action="click->keys#downloadKey" data-type="private" data-format="asc">
<span class="material-icons align-top">save_alt</span>.asc
</a>
</div>
</div>
Expand All @@ -120,57 +131,57 @@
<div class="tab-pane fade" id="v-pills-encrypt" role="tabpanel" aria-labelledby="v-pills-profile-tab">
<fieldset data-controller="encrypt" class="mb-5">
<legend>Encrypt a message</legend>
<div class="row d-none error bg-danger rounded p-3 mb-4" data-target="encrypt.error">
<div class="row d-none error bg-danger rounded p-3 mb-4" data-encrypt-target="error">
<span>An error has occured. Please verify the submitted data or try again later.</span>
</div>
<div class="row mb-3">
<div class="col-lg-6">
<label>Text to encrypt</label>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-target="encrypt.input"></div>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-encrypt-target="input"></div>
</div>
<div class="col-lg-6">
<label>Public PGP key of the receiver</label>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-target="encrypt.key"></div>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-encrypt-target="key"></div>
</div>
</div>
<button data-action="click->encrypt#encrypt" data-target="encrypt.encryptButton" type="button" class="btn btn-primary btn-lg">
<button data-action="click->encrypt#encrypt" data-encrypt-target="encryptButton" type="button" class="btn btn-primary btn-lg">
<span class="mr-3">Encrypt</span>
<span class="material-icons icon-fix">lock</span>
<span class="spinner-border icon-fix spinner-border-sm d-none" role="status" aria-hidden="true"></span>
</button>
<br>
<br>
<br>
<div class="row d-none" data-target="encrypt.initialState">
<div class="row d-none" data-encrypt-target="initialState">
<div class="col-lg-6">
<label>Your encrypted message</label>
<span class="material-icons md-light copy" data-action="click->encrypt#copyToClipboard">content_copy</span>
<span class="copy-badge badge badge-light d-none">Copied!</span>
<div class="custom-textarea output" spellcheck="false" contentEditable="true" data-target="encrypt.output"></div>
<div class="custom-textarea output" spellcheck="false" contentEditable="true" data-encrypt-target="output"></div>
</div>
</div>
</fieldset>
</div>
<div class="tab-pane fade" id="v-pills-decrypt" role="tabpanel" aria-labelledby="v-pills-messages-tab">
<fieldset data-controller="decrypt" class="mb-5">
<legend>Decrypt a message</legend>
<div class="row d-none error bg-danger rounded p-3 mb-4" data-target="decrypt.error">
<div class="row d-none error bg-danger rounded p-3 mb-4" data-decrypt-target="error">
<span>An error has occured. Please verify the submitted data or try again later.</span>
</div>
<div class="row mb-3">
<div class="col-lg-6">
<label>Text to decrypt</label>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-target="decrypt.input"></div>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-decrypt-target="input"></div>
</div>
<div class="col-lg-6">
<label>Your PGP private key</label>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-target="decrypt.key"></div>
<div class="custom-textarea" spellcheck="false" contentEditable="true" data-decrypt-target="key"></div>
</div>
<div class="col">
<div class="form-group mt-3">
<label>Passphrase</label>
<div class="input-group">
<input type="password" class="form-control" data-target="decrypt.passphrase">
<input type="password" class="form-control" data-decrypt-target="passphrase">
<div class="input-group-append" data-action="click->decrypt#showPassphrase">
<a class="input-group-text">
<span class="material-icons">
Expand All @@ -182,20 +193,20 @@
</div>
</div>
</div>
<button data-action="click->decrypt#decrypt" data-target="decrypt.decryptButton" type="button" class="btn btn-primary btn-lg">
<button data-action="click->decrypt#decrypt" data-decrypt-target="decryptButton" type="button" class="btn btn-primary btn-lg">
<span class="mr-3">Decrypt</span>
<span class="material-icons icon-fix">lock_open</span>
<span class="spinner-border icon-fix spinner-border-sm d-none" role="status" aria-hidden="true"></span>
</button>
<br>
<br>
<br>
<div class="row d-none" data-target="decrypt.initialState">
<div class="row d-none" data-decrypt-target="initialState">
<div class="col">
<label>Your decrypted message</label>
<span class="material-icons md-light copy" data-action="click->decrypt#copyToClipboard">content_copy</span>
<span class="copy-badge badge badge-light d-none">Copied!</span>
<div class="custom-textarea output" spellcheck="false" contentEditable="true" data-target="decrypt.output"></div>
<div class="custom-textarea output" spellcheck="false" contentEditable="true" data-decrypt-target="output"></div>
</div>
</div>
</fieldset>
Expand All @@ -218,10 +229,13 @@
</a>
</div>
<div class="row">
<div class="col-md-6">
Proudly based on <a href="https://openpgpjs.org/"target="_blank">Openpgp.js</a> 🚀
<div class="col-md-4 mb-3">
Proudly based on <a href="https://openpgpjs.org/" target="_blank">Openpgp.js</a> 🚀
</div>
<div class="col-md-4 mb-3">
⚖️ Under <a href="https://github.com/aliceandbob-io/aliceandbob-desktop/blob/master/LICENSE.md" target="_blank">MIT License</a>
</div>
<div class="col-md-6">
<div class="col-md-4 mb-3">
Coded with ❤️ and ☕
</div>
</div>
Expand Down
Loading

0 comments on commit 02667d1

Please sign in to comment.