Migrate dependencies: bcrypt→@node-rs/argon2, sanitize-html→isomorphic-dompurify, remove nodemailer/next-view-transitions
This commit is contained in:
1 parent
3827f3e686
commit
a513d9b7bd
8 files changed
+564
-1132
No files matched your search
@@ -1,7 +1,10 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { compare as bcryptCompare, hash as bcryptHash } from "bcrypt";
|
||||
import { hash, verify } from "@node-rs/argon2";
|
||||
import { argon2id, argon2Verify, md5 } from "hash-wasm";
|
||||
|
||||
export const bcryptHash = (password: string) => hash(password);
|
||||
export const bcryptCompare = (password: string, hash: string) => verify(hash, password);
|
||||
|
||||
import { env } from "@/env";
|
||||
|
||||
// AtomCMS hashing (config/hashing.php): argon2id with memory=65536 KiB, time=4,
|
||||
@@ -56,7 +59,7 @@ export async function hashPassword(password: string): Promise<string> {
|
||||
}
|
||||
// native bcrypt emits $2a$/$2b$; normalise to the PHP-canonical $2y$ the
|
||||
// emulator and existing AtomCMS rows use.
|
||||
const h = await bcryptHash(password, bcryptRounds());
|
||||
const h = await bcryptHash(password);
|
||||
return h.replace(/^\$2[ab]\$/, "$2y$");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user