Programming/node.js2020. 1. 19. 16:42

DB에서 하는거나 was에서 하는거랑 좀 차이가 있다면 있을수 있지만

postgresql의 경우 crypto 모듈을 설치해야 하는 문장 하나를 관리해줘야 하니

보안상 문제나 구조적 문제가 없다면 WAS에서 처리하는 것도 나쁘진 않다는 생각이 든다.

 

crypto 모듈은 기본 모듈이라 npm install을 해주지 않아도 된다.

const crypto = require('crypto');

const secret = 'abcdefg';
const hash = crypto.createHmac('sha256', secret)
                   .update('I love cupcakes')
                   .digest('hex');
console.log(hash);
// Prints:
//   c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e

 

[링크 : https://nodejs.org/api/crypto.html]

 

+

[링크 : https://victorydntmd.tistory.com/33]

'Programming > node.js' 카테고리의 다른 글

node.js promise  (0) 2020.01.20
node.js cookie 관련 함수들  (0) 2020.01.19
node.js xpath 그리고 boolean  (0) 2019.12.17
node.js JWT with refresh token  (0) 2019.12.10
node.js synchornous file write  (0) 2019.11.06
Posted by 구차니