mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
new accounts use argon2
This commit is contained in:
@ -1,11 +1,19 @@
|
||||
import bcrypt from 'bcryptjs';
|
||||
import bcrypt from "bcryptjs";
|
||||
import * as argon2 from "argon2";
|
||||
|
||||
const rounds = 10;
|
||||
// const bcryptRounds = 10;
|
||||
// export async function createHashBcrypt(password: string) {
|
||||
// return await bcrypt.hash(password, bcryptRounds);
|
||||
// }
|
||||
|
||||
export async function createHash(password: string) {
|
||||
return bcrypt.hashSync(password, rounds);
|
||||
export async function checkHashBcrypt(password: string, hash: string) {
|
||||
return await bcrypt.compare(password, hash);
|
||||
}
|
||||
|
||||
export async function checkHash(password: string, hash: string) {
|
||||
return bcrypt.compareSync(password, hash);
|
||||
}
|
||||
export async function createHashArgon2(password: string) {
|
||||
return await argon2.hash(password);
|
||||
}
|
||||
|
||||
export async function checkHashArgon2(password: string, hash: string) {
|
||||
return await argon2.verify(hash, password);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user