From 8745cb25b1833be4e0fff60367bcbef2d09e6edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9A=B4=EB=A6=B0?= <105215297+likegitman@users.noreply.github.com> Date: Wed, 29 May 2024 10:44:59 +0900 Subject: [PATCH] Delete AES encrypt password --- .../src/components/Auth/Login/LoginForm/index.tsx | 5 ++--- .../SignUpPages/SignUpButtonContainer/index.tsx | 3 +-- shared/common/src/utils/encryptAES.ts | 14 -------------- shared/common/src/utils/index.ts | 1 - 4 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 shared/common/src/utils/encryptAES.ts diff --git a/shared/common/src/components/Auth/Login/LoginForm/index.tsx b/shared/common/src/components/Auth/Login/LoginForm/index.tsx index 39bb11c2..3f40fee7 100644 --- a/shared/common/src/components/Auth/Login/LoginForm/index.tsx +++ b/shared/common/src/components/Auth/Login/LoginForm/index.tsx @@ -2,7 +2,6 @@ import { TokenManager, usePostLogin } from '@bitgouel/api' import { - encryptAES, EmailErrorText, EmailValue, LoadingStateContext, @@ -10,7 +9,6 @@ import { PasswordValue, } from '@bitgouel/common' import { LoginPayloadTypes } from '@bitgouel/types' -import CryptoJS from 'crypto-js' import { useRouter } from 'next/navigation' import { useRecoilValue, useSetRecoilState } from 'recoil' import LoginButtons from './LoginButtons' @@ -62,8 +60,9 @@ const LoginForm = () => { const onLogin = () => { const loginValues: LoginPayloadTypes = { email: emailValue, - password: encryptAES(passwordValue), + password: passwordValue, } + mutate(loginValues) } diff --git a/shared/common/src/pages/auth/signUp/SignUpPages/SignUpButtonContainer/index.tsx b/shared/common/src/pages/auth/signUp/SignUpPages/SignUpButtonContainer/index.tsx index 5adf368d..a6a1edb5 100644 --- a/shared/common/src/pages/auth/signUp/SignUpPages/SignUpButtonContainer/index.tsx +++ b/shared/common/src/pages/auth/signUp/SignUpPages/SignUpButtonContainer/index.tsx @@ -13,7 +13,6 @@ import { SignUpPage2Obj, SignUpPage3Obj, SignUpPageNumber, - encryptAES, schoolToConstants, } from '@bitgouel/common' import { SignUpCommonPayloadTypes } from '@bitgouel/types' @@ -35,7 +34,7 @@ const SignUpButtonContainer = ({ isNext }: { isNext: boolean }) => { email: signUpPage3Obj[1].value, name: signUpPage2Obj[2].value, phoneNumber: signUpPage3Obj[0].value, - password: encryptAES(signUpPage3Obj[2].value), + password: signUpPage3Obj[2].value, highSchool: schoolToConstants[signUpPage2Obj[0].value], clubName: signUpPage2Obj[1].value, } diff --git a/shared/common/src/utils/encryptAES.ts b/shared/common/src/utils/encryptAES.ts deleted file mode 100644 index 927d31ee..00000000 --- a/shared/common/src/utils/encryptAES.ts +++ /dev/null @@ -1,14 +0,0 @@ -import CryptoJS from 'crypto-js' - -const encryptAES = (encryptValue: string) => { - const iv = CryptoJS.lib.WordArray.random(128 / 8) - const hashKey = CryptoJS.enc.Hex.parse( - CryptoJS.SHA1(process.env.REACT_APP_SECRET_CRYPTO_KEY) - .toString() - .substring(0, 32) - ) - const cipherStr = CryptoJS.AES.encrypt(encryptValue, hashKey, { iv }) - return iv.concat(cipherStr.ciphertext).toString() -} - -export default encryptAES diff --git a/shared/common/src/utils/index.ts b/shared/common/src/utils/index.ts index 1ec40a76..81f02ba5 100644 --- a/shared/common/src/utils/index.ts +++ b/shared/common/src/utils/index.ts @@ -1,4 +1,3 @@ export { default as handleSelect } from './handleSelect' export { default as excelDownload } from './excelDownload' export { default as insertHyphen } from './insertHyphen' -export { default as encryptAES } from './encryptAES'