Skip to content

Commit

Permalink
Merge pull request #75 from donghquinn/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
donghquinn authored Mar 12, 2024
2 parents 3e7c8d5 + c56cced commit 1a299b0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 27 deletions.
10 changes: 2 additions & 8 deletions src/libraries/client/decrypt.lib.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CryptoError } from '@errors/crypto.error';
import { ClientLogger, Logger } from '@utils/logger.util';
import { Logger } from '@utils/logger.util';
import { createDecipheriv } from 'crypto';
import CryptoJS from 'crypto-js';

/**
* 복호화
*
*
* @param encryptedString 복호화 할 암호화 된 문자열
* @param token 복화에 사용할 비대칭 키(토큰)
* @returns 복호화 된 문자열
Expand All @@ -24,7 +24,6 @@ export const decrypt = (encryptedString: string, token: string): string => {
return decryptedString;
};


/**
* 비밀번호 암호화 된 문자열과 복호화 된 문자열 비교 함수
* @param receivedPassword 수신된 패스워드
Expand All @@ -35,11 +34,6 @@ export const decrypt = (encryptedString: string, token: string): string => {
export const comparePassword = (receivedPassword: string, encodedPassword: string, passwordToken: string): boolean => {
const decryptedPassword = decrypt(encodedPassword, passwordToken);

ClientLogger.debug('[COMPARE] Compare Decrypted Password: %o', {
receivedPassword,
decryptedPassword,
});

return receivedPassword === decryptedPassword;
};

Expand Down
9 changes: 4 additions & 5 deletions src/providers/account-manager.pvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ export class AccountManager {
}
}


/**
* REDIS 에 등록된 회원 정보(로그인 상태 정보) 삭제
* @param encodedEmail 암호화된 유저 이메일(REDIS 키)
*/
/**
* REDIS 에 등록된 회원 정보(로그인 상태 정보) 삭제
* @param encodedEmail 암호화된 유저 이메일(REDIS 키)
*/
public async deleteItem(encodedEmail: string) {
try {
const index = this.keyList.findIndex((item) => item === encodedEmail);
Expand Down
8 changes: 3 additions & 5 deletions src/providers/client/client.pvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ClientProvider {

// if (result) throw new ClientError('[SIGNUP] Check Exist User Info', 'Found Already Exist User. Reject.');

ClientLogger.info('[Signup] Start to create user: %o', {
ClientLogger.debug('[Signup] Start to create user: %o', {
email,
});

Expand Down Expand Up @@ -189,9 +189,7 @@ export class ClientProvider {

const result = await this.prisma.getMyPageInfo(email, uuid);

ClientLogger.info('[MYPAGE] My Starred News: %o', {
result,
});
ClientLogger.info('[MYPAGE] Got My Starred News');

return result;
} catch (error) {
Expand Down Expand Up @@ -238,7 +236,7 @@ export class ClientProvider {

await this.prisma.updateNewPassword(uuid, encodedPassword, passwordToken);

ClientLogger.debug('[CHANGE_PASS] Changing Password Complete');
ClientLogger.info('[CHANGE_PASS] Changing Password Complete');

return 'success';
} catch (error) {
Expand Down
10 changes: 5 additions & 5 deletions src/providers/client/search.pvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ClientSearchProvider {

await this.mailer.sendMail(email, 'Search Password', mailContent);

ClientLogger.debug('[SEARCH_PASS] Sent New Password Complete');
ClientLogger.info('[SEARCH_PASS] Sending New Password Complete');

return 'Sent';
} catch (error) {
Expand Down Expand Up @@ -78,7 +78,7 @@ export class ClientSearchProvider {

const encryptedPassword = encryptOriginalPassword(rawPassword);

ClientLogger.debug('[VALIDATE_KEY] Validate Password Searching Key Complete');
ClientLogger.info('[VALIDATE_KEY] Validate Password Searching Key Complete');

return encryptedPassword;
} catch (error) {
Expand Down Expand Up @@ -130,7 +130,7 @@ export class ClientSearchProvider {

await this.prisma.updateNewPassword(uuid, encodedNewPassword, passwordNewToken);

ClientLogger.debug('[CHANGE_PASS] Changing Password Complete');
ClientLogger.info('[CHANGE_PASS] Changing Password Complete');

return 'success';
} catch (error) {
Expand Down Expand Up @@ -185,7 +185,7 @@ export class ClientSearchProvider {

await this.prisma.updateNewPassword(uuid, encodedPassword, passwordToken);

ClientLogger.debug('[CHANGE_PASS] Changing Password Complete');
ClientLogger.info('[CHANGE_PASS] Changing Password Complete');

return 'success';
} catch (error) {
Expand All @@ -203,7 +203,7 @@ export class ClientSearchProvider {

/**
* 이메일 찾기
* @param name 유저 이름
* @param name 유저 이름
* @returns 유저 이메일
*/
async searchEmail(name: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/news/geek/geek.pvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class GeekProvider {
const startDate = startOfDay(new Date(yesterday));
const endDate = endOfDay(new Date(yesterday));

NewsLogger.info('[GEEK] YesterDay: %o', {
NewsLogger.debug('[GEEK] YesterDay: %o', {
start: startDate,
end: endDate,
page,
Expand Down
2 changes: 1 addition & 1 deletion src/providers/news/hacker/hacker.pvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class HackersNewsProvider {
const startDate = startOfDay(new Date(yesterday));
const endDate = endOfDay(new Date(yesterday));

NewsLogger.info('[Hackers] YesterDay: %o', {
NewsLogger.debug('[Hackers] YesterDay: %o', {
start: startDate,
end: endDate,
page,
Expand Down
4 changes: 2 additions & 2 deletions src/providers/news/ml/machine.pvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class MachineLearningProvider {
});

throw new MachineLearningError(
'Give Star on the ML news',
'[ML] Give Star on the ML news',
'Failed to vie star ML news',
error instanceof Error ? error : new Error(JSON.stringify(error)),
);
Expand Down Expand Up @@ -113,7 +113,7 @@ export class MachineLearningProvider {
});

throw new MachineLearningError(
'Unstar ML News',
'[ML] Unstar ML News',
'Failed to Unstar ML News',
error instanceof Error ? error : new Error(JSON.stringify(error)),
);
Expand Down

0 comments on commit 1a299b0

Please sign in to comment.