chore: move server functions to db/utils (#951)

This commit is contained in:
Jeremy 2025-04-22 22:40:01 -07:00 committed by GitHub
parent a159b77fcf
commit 24cb2ce19b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 105 deletions

16
lib/db/utils.ts Normal file
View file

@ -0,0 +1,16 @@
import { generateId } from 'ai';
import { genSaltSync, hashSync } from 'bcrypt-ts';
export function generateHashedPassword(password: string) {
const salt = genSaltSync(10);
const hash = hashSync(password, salt);
return hash;
}
export function generateDummyPassword() {
const password = generateId(12);
const hashedPassword = generateHashedPassword(password);
return hashedPassword;
}