selfhostable, read-only reddit client
16
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: Use native Bun API for hashing passwords instead of bcrypt

+3 -3
+3 -3
src/routes/index.js
··· 1 1 const express = require("express"); 2 2 const he = require("he"); 3 - const bcrypt = require("bcrypt"); 3 + const { hash, compare } = require("bun"); 4 4 const router = express.Router(); 5 5 const geddit = require("../geddit.js"); 6 6 const { db } = require("../index"); ··· 87 87 return res.status(400).send("Passwords do not match"); 88 88 } 89 89 try { 90 - const hashedPassword = await bcrypt.hash(password, 10); 90 + const hashedPassword = await hash(password); 91 91 db.query("INSERT INTO users (username, password_hash) VALUES (?, ?)", [ 92 92 username, 93 93 hashedPassword, ··· 105 105 const user = db 106 106 .query("SELECT * FROM users WHERE username = ?", [username]) 107 107 .get(); 108 - if (user && await bcrypt.compare(password, user.password_hash)) { 108 + if (user && await compare(password, user.password_hash)) { 109 109 res.status(200).redirect("/"); 110 110 } else { 111 111 res.status(401).send("Invalid credentials");