NestJs 비밀번호 암호화, 2024-01-30

sunj - Jan 29 - - Dev Community
npm install bcryptjs --save
Enter fullscreen mode Exit fullscreen mode

비밀번호를 암호화하는 과정에서 salt를 사용하여 비밀번호가 같더라도 입력되는 값은 다르게 설정

user.repository

import * as bcrypt from 'bcryptjs';

        const salt =await bcrypt.genSalt();
        const hashhedPassword = await bcrypt.hash(password, salt);

        const user = this.create({ email, password : hashhedPassword });
Enter fullscreen mode Exit fullscreen mode

참조 : https://youtu.be/3JminDpCJNE?si=h9GCHitorx0_tSM0

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player