From 00e43ddc0bf3d6dd719fc9295d156567fa2fecfb Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 26 Aug 2024 16:28:30 -0700 Subject: switch to bun --- lib/register.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/register.js') diff --git a/lib/register.js b/lib/register.js index 27651abd..49111d96 100644 --- a/lib/register.js +++ b/lib/register.js @@ -1,4 +1,3 @@ -import bcrypt from "bcrypt"; import { got } from "got"; import { authenticator } from "otplib"; import { v4 } from "uuid"; @@ -16,7 +15,8 @@ export default async (user, ip, requireChallenge) => { if (!username) fail("Username required"); username = username.toLowerCase(); - if (!valid.test(username)) fail("Usernames can only have letters and numbers"); + if (!valid.test(username)) + fail("Usernames can only have letters and numbers"); let id = v4(); user.id = id; @@ -25,7 +25,10 @@ export default async (user, ip, requireChallenge) => { if (exists) fail(`Username ${username} taken`); if (password) { - user.password = await bcrypt.hash(password, 1); + user.password = await Bun.password.hash(password, { + algorithm: "bcrypt", + cost: 1, + }); } user.currency = "USD"; -- cgit v1.2.3