Never store plaintext passwords. Always hash them with a slow, salted algorithm. bcrypt is the standard choice for Node.js.
Why bcrypt?
saltRounds) — higher = slower = more secureconst bcrypt = require('bcrypt')
// Hashing (async)
async function hashPassword(password) {
const saltRounds = 12
const hash = await bcrypt.hash(password, saltRounds)
// ...Never store plaintext passwords. Always hash them with a slow, salted algorithm. bcrypt is the standard choice for Node.js.
Why bcrypt?
saltRounds) — higher = slower = more secureconst bcrypt = require('bcrypt')
// Hashing (async)
async function hashPassword(password) {
const saltRounds = 12
const hash = await bcrypt.hash(password, saltRounds)
// ...