diff --git a/package-lock.json b/package-lock.json index 07d9b47..eef494a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4408,11 +4408,6 @@ "randomfill": "^1.0.3" } }, - "crypto-js": { - "version": "3.1.9-1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", - "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" - }, "css": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", diff --git a/package.json b/package.json index 0f6298f..331ef74 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "bulma-checkradio": "^2.1.1", "bulma-pricingtable": "^0.2.0", "bulma-switch": "^2.0.0", - "crypto-js": "^3.1.9-1", "font-color-contrast": "^1.0.3", "lightness": "^1.0.0", "lodash-es": "^4.17.15", diff --git a/src/models/IEncryptable.ts b/src/models/IEncryptable.ts deleted file mode 100644 index d797f8f..0000000 --- a/src/models/IEncryptable.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface IEncryptable { - [key: string]: any -} diff --git a/src/models/IEncrypted.ts b/src/models/IEncrypted.ts deleted file mode 100644 index 0a7f38a..0000000 --- a/src/models/IEncrypted.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface IEncrypted { - [key: string]: string -} diff --git a/src/services/AccountService.ts b/src/services/AccountService.ts index 2bea357..416e976 100644 --- a/src/services/AccountService.ts +++ b/src/services/AccountService.ts @@ -3,8 +3,6 @@ import IAccount from '@/models/IAccount' import ITransaction from '@/models/ITransaction' import transactionService from '@/services/TransactionService' import { slug } from '@/utils' -import IEncryptable from '@/models/IEncryptable' -import IEncrypted from '@/models/IEncrypted' class AccountService { public async get(id: string): Promise { @@ -125,17 +123,6 @@ class AccountService { } return false } - - private toEncrypt(account: IAccount): IEncryptable | IEncrypted { - if (!account) { - return {} - } - return { - name: account.name, - slug: account.slug, - premium: account.premium - } - } } export default new AccountService() diff --git a/src/services/CouchService.ts b/src/services/CouchService.ts index a96bc96..8558b5e 100644 --- a/src/services/CouchService.ts +++ b/src/services/CouchService.ts @@ -1,4 +1,3 @@ -import axios from 'axios' import uuid from 'uuid/v4' import PouchDb from 'pouchdb-browser' import PouchDbAuthentication from 'pouchdb-authentication' @@ -7,11 +6,6 @@ import IUser from '@/models/IUser' import notif from '@/utils/notif' import { debounce } from 'lodash-es' import { confirmation, toHex } from '@/utils' -import cryptoService from '@/services/CryptoService' -import IEncryptable from '@/models/IEncryptable' -import IEncrypted from '@/models/IEncrypted' -import IEncryptPassword from '@/models/IEncryptPassword' -import { SET_KEY_URL, GET_KEY_URL } from '@/utils/serverless-url' import store from '@/store' PouchDb.plugin(PouchDbAuthentication) diff --git a/src/services/CryptoService.ts b/src/services/CryptoService.ts deleted file mode 100644 index 8fed1fc..0000000 --- a/src/services/CryptoService.ts +++ /dev/null @@ -1,55 +0,0 @@ -import IEncryptable from '@/models/IEncryptable' -import IEncryptPassword from '@/models/IEncryptPassword' -import AES from 'crypto-js/aes' -import utf8 from 'crypto-js/enc-utf8' - -const encrypting: boolean = false - -class CryptoService { - public createPassword(): IEncryptPassword { - return { - password: this.guid() - } - } - - public encrypt(toEncrypt: IEncryptable, password: string): IEncryptable { - if (!encrypting) { - return toEncrypt - } - const encrypted: IEncryptable = {} - for (const t in toEncrypt) { - if (t) { - encrypted[t] = AES.encrypt( - toEncrypt[t] && toEncrypt[t].toString(), - password - ).toString() - } - } - return encrypted - } - - public decrypt(encrypted: IEncryptable, password: string): IEncryptable { - if (!encrypting) { - return encrypted - } - const decrypted: IEncryptable = {} - for (const t in encrypted) { - if (t && encrypted[t]) { - const bytes = AES.decrypt(encrypted[t], password) - decrypted[t] = bytes.toString(utf8) - } - } - return decrypted - } - - private guid(): string { - const s4 = () => { - return Math.floor((1 + Math.random()) * 0x10000) - .toString(16) - .substring(1) - } - return `${s4()}${s4()}-${s4()}-${s4()}-${s4()}` - } -} - -export default new CryptoService() diff --git a/src/services/TransactionService.ts b/src/services/TransactionService.ts index 5028b61..c45c63e 100644 --- a/src/services/TransactionService.ts +++ b/src/services/TransactionService.ts @@ -6,8 +6,6 @@ import TransactionType from '@/enums/TransactionType' import ISplit from '@/models/ISplit' import IUser from '@/models/IUser' import IAccount from '@/models/IAccount' -import IEncryptable from '@/models/IEncryptable' -import IEncrypted from '@/models/IEncrypted' class TransactionService { public async getNew( @@ -142,19 +140,6 @@ class TransactionService { private round(n: number): number { return Math.round(n * 100) / 100 } - - private toEncrypt(transaction: ITransaction): IEncryptable | IEncrypted { - if (!transaction) { - return {} - } - return { - name: transaction.name, - date: transaction.date, - amount: transaction.amount, - payBy: transaction.payBy, - tag: transaction.tag - } - } } export default new TransactionService()