bcrypt
-
Bcrypt를 이용한 비밀번호 암호화Study/Node, React 기초 강의_John Ahn 2023. 2. 19. 01:24
데이터베이스 관리자도 회원의 비밀번호를 모르게 하기 위해 Bcrypt를 사용한다. Bcrypt 설치 npm install bcrypt --save Bcrypt을 이용한 암호화 Bcrypt를 이용하여 암호화하기 위해 User.js에 userSchema.pref를 구현한다. userSchema.pre는 index.js의 app.post에서 user.save가 실행되기 전에 실행된다. // mongoose를 요청함 const mongoose = require('mongoose'); // bcrypt를 요청 const bcrypt = require('bcrypt'); // Salt를 이용해서 비밀번호를 암호화 해야하기 때문에 saltRounds를 설정 const saltRounds = 10..