refactor: rename builders to server

This commit is contained in:
Mauricio Siu
2024-10-05 22:15:47 -06:00
parent 43555cdabe
commit f3ce69b656
361 changed files with 551 additions and 562 deletions

View File

@@ -0,0 +1,20 @@
import bcrypt from "bcrypt";
export const generateRandomPassword = async () => {
const passwordLength = 16;
const characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let randomPassword = "";
for (let i = 0; i < passwordLength; i++) {
randomPassword += characters.charAt(
Math.floor(Math.random() * characters.length),
);
}
const saltRounds = 10;
const hashedPassword = await bcrypt.hash(randomPassword, saltRounds);
return { randomPassword, hashedPassword };
};