feat: passwordHasher 可注入 — bcrypt 不再是 Shrimp 核心硬依赖
新增 IPasswordHasher 抽象 + bcryptHasher(默认,lazy import)+ plainHasher
(测试用)。Password 字段 reqFilter 和 UserModule.verifyPassword 都走
`Shrimp.passwordHasher`,消费方在启动期换实现就能彻底跳过 bcrypt。
import { Shrimp, plainHasher } from "shrimp-server"
Shrimp.passwordHasher = plainHasher
测试覆盖默认值、plain 端到端登录、自定义 hasher 被调用。
This commit is contained in:
@@ -71,6 +71,10 @@ export type {
|
||||
ShrimpCrud,
|
||||
} from "./Shrimp"
|
||||
|
||||
// ===== 密码哈希(可注入,默认 bcrypt lazy import) =====
|
||||
export { bcryptHasher, plainHasher } from "./PasswordHasher"
|
||||
export type { IPasswordHasher } from "./PasswordHasher"
|
||||
|
||||
// ===== 数据源(纯内存,无外部依赖) =====
|
||||
export { MemoryShrimpCrud } from "./MemoryShrimpCrud"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user