Skip to content

Commit

Permalink
Merge pull request #9 from ArqTras/master
Browse files Browse the repository at this point in the history
Chinese translation + template tweaks
  • Loading branch information
ArqTras authored Aug 5, 2019
2 parents 69c7020 + 028e9fc commit 7838ff0
Show file tree
Hide file tree
Showing 26 changed files with 660 additions and 300 deletions.
44 changes: 39 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arqma-electron-wallet",
"version": "1.0.4",
"version": "1.0.5",
"daemonVersion": "4.0.0",
"description": "Modern GUI interface for Arqma Currency",
"productName": "Arqma Electron Wallet",
Expand All @@ -22,8 +22,10 @@
"test": "echo \"No test specified\" && exit 0"
},
"dependencies": {
"acorn": "^6.2.1",
"axios": "^0.19.0",
"buffer": "^5.2.1",
"bufferutil": "*",
"chart.js": "^2.8.0",
"electron-is-dev": "^1.0.1",
"electron-progressbar": "^1.2.0",
Expand All @@ -37,6 +39,7 @@
"qrcode.vue": "^1.6.1",
"request": "^2.88.0",
"request-promise": "^4.2.4",
"utf-8-validate": "^5.0.2",
"validation": "0.0.1",
"vue-chartjs": "^3.4.2",
"vue-i18n": "^8.9.0",
Expand Down
1 change: 1 addition & 0 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module.exports = function (ctx) {
"QStepper",
"QStepperNavigation",
"QSpinner",
"QChip",
"QList",
"QListHeader",
"QItem",
Expand Down
62 changes: 31 additions & 31 deletions src-electron/main-process/modules/SCEE-Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,70 +22,70 @@
SOFTWARE.
*/

const crypto = require("crypto")
const crypto = require("crypto");

const ALGORITHM_NAME = "aes-128-gcm"
const ALGORITHM_NONCE_SIZE = 12
const ALGORITHM_TAG_SIZE = 16
const ALGORITHM_KEY_SIZE = 16
const PBKDF2_NAME = "sha256"
const PBKDF2_SALT_SIZE = 16
const PBKDF2_ITERATIONS = 32767
const ALGORITHM_NAME = "aes-128-gcm";
const ALGORITHM_NONCE_SIZE = 12;
const ALGORITHM_TAG_SIZE = 16;
const ALGORITHM_KEY_SIZE = 16;
const PBKDF2_NAME = "sha256";
const PBKDF2_SALT_SIZE = 16;
const PBKDF2_ITERATIONS = 32767;

export class SCEE {
encryptString (plaintext, password) {
encryptString(plaintext, password) {
// Generate a 128-bit salt using a CSPRNG.
let salt = crypto.randomBytes(PBKDF2_SALT_SIZE)
let salt = crypto.randomBytes(PBKDF2_SALT_SIZE);

// Derive a key using PBKDF2.
let key = crypto.pbkdf2Sync(new Buffer(password, "utf8"), salt, PBKDF2_ITERATIONS, ALGORITHM_KEY_SIZE, PBKDF2_NAME)
let key = crypto.pbkdf2Sync(Buffer.from(password, "utf8"), salt, PBKDF2_ITERATIONS, ALGORITHM_KEY_SIZE, PBKDF2_NAME);

// Encrypt and prepend salt.
let ciphertextAndNonceAndSalt = Buffer.concat([ salt, this.encrypt(new Buffer(plaintext, "utf8"), key) ])
let ciphertextAndNonceAndSalt = Buffer.concat([ salt, this.encrypt(Buffer.from(plaintext, "utf8"), key) ]);

// Return as base64 string.
return ciphertextAndNonceAndSalt.toString("base64")
return ciphertextAndNonceAndSalt.toString("base64");
}

decryptString (base64CiphertextAndNonceAndSalt, password) {
decryptString(base64CiphertextAndNonceAndSalt, password) {
// Decode the base64.
let ciphertextAndNonceAndSalt = new Buffer(base64CiphertextAndNonceAndSalt, "base64")
let ciphertextAndNonceAndSalt = Buffer.from(base64CiphertextAndNonceAndSalt, "base64");

// Create buffers of salt and ciphertextAndNonce.
let salt = ciphertextAndNonceAndSalt.slice(0, PBKDF2_SALT_SIZE)
let ciphertextAndNonce = ciphertextAndNonceAndSalt.slice(PBKDF2_SALT_SIZE)
let salt = ciphertextAndNonceAndSalt.slice(0, PBKDF2_SALT_SIZE);
let ciphertextAndNonce = ciphertextAndNonceAndSalt.slice(PBKDF2_SALT_SIZE);

// Derive the key using PBKDF2.
let key = crypto.pbkdf2Sync(new Buffer(password, "utf8"), salt, PBKDF2_ITERATIONS, ALGORITHM_KEY_SIZE, PBKDF2_NAME)
let key = crypto.pbkdf2Sync(Buffer.from(password, "utf8"), salt, PBKDF2_ITERATIONS, ALGORITHM_KEY_SIZE, PBKDF2_NAME);

// Decrypt and return result.
return this.decrypt(ciphertextAndNonce, key).toString("utf8")
return this.decrypt(ciphertextAndNonce, key).toString("utf8");
}

encrypt (plaintext, key) {
encrypt(plaintext, key) {
// Generate a 96-bit nonce using a CSPRNG.
let nonce = crypto.randomBytes(ALGORITHM_NONCE_SIZE)
let nonce = crypto.randomBytes(ALGORITHM_NONCE_SIZE);

// Create the cipher instance.
let cipher = crypto.createCipheriv(ALGORITHM_NAME, key, nonce)
let cipher = crypto.createCipheriv(ALGORITHM_NAME, key, nonce);

// Encrypt and prepend nonce.
let ciphertext = Buffer.concat([ cipher.update(plaintext), cipher.final() ])
let ciphertext = Buffer.concat([ cipher.update(plaintext), cipher.final() ]);

return Buffer.concat([ nonce, ciphertext, cipher.getAuthTag() ])
return Buffer.concat([ nonce, ciphertext, cipher.getAuthTag() ]);
}

decrypt (ciphertextAndNonce, key) {
decrypt(ciphertextAndNonce, key) {
// Create buffers of nonce, ciphertext and tag.
let nonce = ciphertextAndNonce.slice(0, ALGORITHM_NONCE_SIZE)
let ciphertext = ciphertextAndNonce.slice(ALGORITHM_NONCE_SIZE, ciphertextAndNonce.length - ALGORITHM_TAG_SIZE)
let tag = ciphertextAndNonce.slice(ciphertext.length + ALGORITHM_NONCE_SIZE)
let nonce = ciphertextAndNonce.slice(0, ALGORITHM_NONCE_SIZE);
let ciphertext = ciphertextAndNonce.slice(ALGORITHM_NONCE_SIZE, ciphertextAndNonce.length - ALGORITHM_TAG_SIZE);
let tag = ciphertextAndNonce.slice(ciphertext.length + ALGORITHM_NONCE_SIZE);

// Create the cipher instance.
let cipher = crypto.createDecipheriv(ALGORITHM_NAME, key, nonce)
let cipher = crypto.createDecipheriv(ALGORITHM_NAME, key, nonce);

// Decrypt and return result.
cipher.setAuthTag(tag)
return Buffer.concat([ cipher.update(ciphertext), cipher.final() ])
cipher.setAuthTag(tag);
return Buffer.concat([ cipher.update(ciphertext), cipher.final() ]);
}
}
2 changes: 1 addition & 1 deletion src/components/service_node_registration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</div>

<q-inner-loading :visible="registration_status.sending" :dark="theme=='dark'">
<q-spinner color="primary" :size="30" />
<q-spinner color="blue" :size="30" />
</q-inner-loading>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/service_node_staking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<ServiceNodeUnlock />

<q-inner-loading :visible="stake_status.sending || tx_status.sending" :dark="theme=='dark'">
<q-spinner color="primary" :size="30" />
<q-spinner color="blue" :size="30" />
</q-inner-loading>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/service_node_unlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>

<q-inner-loading :visible="unlock_status.sending" :dark="theme=='dark'">
<q-spinner color="primary" :size="30" />
<q-spinner color="blue" :size="30" />
</q-inner-loading>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet_loading.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="visible" class="q-loading animate-fade fullscreen column flex-center">
<q-spinner color="white" size="80px" />
<q-spinner color="blue" size="80px" />
<div v-if="textVisible" class="text-white">
{{ message }}
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/i18n/de.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export default {
buttons: {
// All button text is uppercased in the gui
advanced: "ADVANCED",
advanced: "ERWEITERT",
addressBook: "ADRESSBUCH",
all: "ALLES",
back: "ZURÜCK",
browse: "DURCHSUCHEN",
Expand Down Expand Up @@ -38,8 +39,10 @@ export default {
showTxDetails: "TX DETAILS ANZEIGEN",
stake: "STAKE",
sweepAll: "ALLES BEREINIGEN",
unlock: "UNLOCK",
viewOnExplorer: "IN EXPLORER ANZEIGEN"
unlock: "FREISCHALTEN",
txHistory: "TRANSAKTIONEN",
viewOnExplorer: "IN EXPLORER ANZEIGEN",
wallet: "BRIEFTASCHE"
},
dialog: {
// Generic buttons
Expand Down Expand Up @@ -334,7 +337,8 @@ export default {
selectAFile: "Bitte Datei auswählen",
transactionNotes: "Zusätzliche Notizen die an die Transaktions gehängt werden sollen",
walletName: "Ein Name für deine Wallet",
walletPassword: "Ein optionales Passwort für die Wallet"
walletPassword: "Ein optionales Passwort für die Wallet",
operations: "Brieftaschenaktionen"
},
strings: {
addAddressBookEntry: "Adressbuch Eintrag hinzufügen",
Expand Down
8 changes: 6 additions & 2 deletions src/i18n/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
buttons: {
// All button text is uppercased in the gui
advanced: "ADVANCED",
addressBook: "ADDRESS BOOK",
all: "ALL",
back: "BACK",
browse: "BROWSE",
Expand Down Expand Up @@ -38,8 +39,10 @@ export default {
showTxDetails: "SHOW TX DETAILS",
stake: "STAKE",
sweepAll: "SWEEP ALL",
txHistory: "TX HISTORY",
unlock: "UNLOCK",
viewOnExplorer: "VIEW ON EXPLORER"
viewOnExplorer: "VIEW ON EXPLORER",
wallet: "WALLET"
},
dialog: {
// Generic buttons
Expand Down Expand Up @@ -335,7 +338,8 @@ export default {
selectAFile: "Please select a file",
transactionNotes: "Additional notes to attach to the transaction",
walletName: "A name for your wallet",
walletPassword: "An optional password for the wallet"
walletPassword: "An optional password for the wallet",
operations: "Wallet actions"
},
strings: {
addAddressBookEntry: "Add address book entry",
Expand Down
10 changes: 7 additions & 3 deletions src/i18n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
buttons: {
// All button text is uppercased in the gui
advanced: "ADVANCED",
addressBook: "DIRECTORIO",
all: "TODO",
back: "ATRÁS",
browse: "EXAMINAR",
Expand Down Expand Up @@ -38,8 +39,10 @@ export default {
showTxDetails: "MOSTRAR DETALLES DE LA TRANSACCIÓN",
stake: "RETENER PARTICIPACIÓN",
sweepAll: "TRANSFERIR/BARRER TODO",
unlock: "UNLOCK",
viewOnExplorer: "VER EN EL EXPLORADOR"
unlock: "DESBLOQUEAR",
txHistory: "HISTORIA DE TX",
viewOnExplorer: "VER EN EL EXPLORADOR",
wallet: "BILLETERA"
},
dialog: {
// Generic buttons
Expand Down Expand Up @@ -335,7 +338,8 @@ export default {
selectAFile: "Seleccione un archivo por favor",
transactionNotes: "Notas adicionales para agregar a la transacción",
walletName: "Nombre para identificar su monedero",
walletPassword: "Contraseña opcional para proteger su monedero"
walletPassword: "Contraseña opcional para proteger su monedero",
operations: "Acciones de billetera"
},
strings: {
addAddressBookEntry: "Agregar registro a la libreta de direcciones",
Expand Down
10 changes: 7 additions & 3 deletions src/i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
buttons: {
// All button text is uppercased in the gui
advanced: "ADVANCED",
addressBook: "CARNET D'ADRESSES",
all: "TOUT",
back: "RETOUR",
browse: "NAVIGUER",
Expand Down Expand Up @@ -38,8 +39,10 @@ export default {
showTxDetails: "AFFICHER LES DETAILS DE TRANSACTION",
stake: "STAKE",
sweepAll: "TOUT BALAYER",
unlock: "UNLOCK",
viewOnExplorer: "VUE SUR L’EXPLORATEUR"
unlock: "OUVRIR",
txHistory: "HISTOIRE DE TX",
viewOnExplorer: "VUE SUR L’EXPLORATEUR",
wallet: "PORTEFEUILLE"
},
dialog: {
// Generic buttons
Expand Down Expand Up @@ -336,7 +339,8 @@ export default {
selectAFile: "Veuillez sélectionner un fichier",
transactionNotes: "Notes additionnelles attachées à la transaction",
walletName: "Un nom pour votre portefeuille",
walletPassword: "Un mot de passe optionnel pour votre portefeuille"
walletPassword: "Un mot de passe optionnel pour votre portefeuille",
operations: "Actions de portefeuille"
},
strings: {
addAddressBookEntry: "Ajoutez une entrée de carnet d'adresses",
Expand Down
Loading

0 comments on commit 7838ff0

Please sign in to comment.