chore: move server functions to db/utils (#951)
This commit is contained in:
parent
a159b77fcf
commit
24cb2ce19b
5 changed files with 22 additions and 105 deletions
16
lib/db/utils.ts
Normal file
16
lib/db/utils.ts
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue