From e1ccf5b2199a840e0d108ef73a7e067a7bdd2466 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 19 Jan 2022 08:48:48 +0800 Subject: [PATCH] chore: remove crypto-js dependency (#412) --- package.json | 1 - pnpm-lock.yaml | 6 ------ src/utils/encrypt.js | 20 -------------------- 3 files changed, 27 deletions(-) delete mode 100644 src/utils/encrypt.js diff --git a/package.json b/package.json index 81aed5ac..9ae984c5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "@codemirror/lang-java": "^0.19.1", "@halo-dev/admin-api": "^1.0.0-alpha.46", "ant-design-vue": "^1.7.8", - "crypto-js": "^4.1.1", "dayjs": "^1.10.7", "enquire.js": "^2.1.6", "filepond": "^4.30.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4734db17..8c5b8da4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,6 @@ specifiers: babel-eslint: ^10.1.0 babel-jest: ^26.6.3 babel-plugin-import: ^1.13.3 - crypto-js: ^4.1.1 dayjs: ^1.10.7 enquire.js: ^2.1.6 eslint: ^6.8.0 @@ -56,7 +55,6 @@ dependencies: '@codemirror/lang-java': 0.19.1 '@halo-dev/admin-api': 1.0.0-alpha.46 ant-design-vue: 1.7.8_9065e7474e033a8e4b95615fc8e6c36c - crypto-js: 4.1.1 dayjs: 1.10.7 enquire.js: 2.1.6 filepond: 4.30.3 @@ -4158,10 +4156,6 @@ packages: randomfill: 1.0.4 dev: true - /crypto-js/4.1.1: - resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==} - dev: false - /css-color-names/0.0.4: resolution: {integrity: sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=} dev: true diff --git a/src/utils/encrypt.js b/src/utils/encrypt.js deleted file mode 100644 index f9d0fcc2..00000000 --- a/src/utils/encrypt.js +++ /dev/null @@ -1,20 +0,0 @@ -import CryptoJS from 'crypto-js' - -const CRYPTO_KEY = 'halo-crypt' - -export default { - encrypt(plaintObject) { - if (!plaintObject) { - return undefined - } - return CryptoJS.AES.encrypt(JSON.stringify(plaintObject), CRYPTO_KEY).toString() - }, - - decrypt(ciphertext) { - if (!ciphertext) { - return undefined - } - const bytes = CryptoJS.AES.decrypt(ciphertext, CRYPTO_KEY) - return JSON.parse(bytes.toString(CryptoJS.enc.Utf8)) - } -}