diff options
| author | Adam Soltys <[email protected]> | 2024-08-26 16:28:30 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-08-26 16:28:30 -0700 |
| commit | 00e43ddc0bf3d6dd719fc9295d156567fa2fecfb (patch) | |
| tree | 9719782a64056ff904c0053223d70547bb7f398c /lib/register.js | |
| parent | 3c611a4e6fbb31fa7d8e32ed256037c45aca1d6d (diff) | |
| download | coinos-server-00e43ddc0bf3d6dd719fc9295d156567fa2fecfb.tar.gz coinos-server-00e43ddc0bf3d6dd719fc9295d156567fa2fecfb.zip | |
switch to bun
Diffstat (limited to 'lib/register.js')
| -rw-r--r-- | lib/register.js | 9 |
1 files changed, 6 insertions, 3 deletions
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"; |
