未验证 提交 cac66731 编写于 作者: J Joe Previte

refactor: use bcrypt in hash function

上级 dd2cb164
......@@ -36,6 +36,7 @@
"main": "out/node/entry.js",
"devDependencies": {
"@schemastore/package": "^0.0.6",
"@types/bcrypt": "^5.0.0",
"@types/body-parser": "^1.19.0",
"@types/compression": "^1.7.0",
"@types/cookie-parser": "^1.4.2",
......@@ -88,6 +89,7 @@
},
"dependencies": {
"@coder/logger": "1.1.16",
"bcrypt": "^5.0.1",
"body-parser": "^1.19.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5",
......
import * as cp from "child_process"
import * as crypto from "crypto"
import * as bcrypt from "bcrypt"
import envPaths from "env-paths"
import { promises as fs } from "fs"
import * as net from "net"
......@@ -116,7 +117,7 @@ export const generatePassword = async (length = 24): Promise<string> => {
}
export const hash = (str: string): string => {
return crypto.createHash("sha256").update(str).digest("hex")
return bcrypt.hashSync(str, 10)
}
const mimeTypes: { [key: string]: string } = {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册