Rewrite pwd hash without lib argon2
ci/woodpecker/manual/test Pipeline failed

This commit is contained in:
2024-05-14 13:51:29 +02:00
parent e004dd4082
commit 8164429015
2 changed files with 4 additions and 12 deletions
-2
View File
@@ -8,7 +8,6 @@
"test": "bun test"
},
"dependencies": {
"argon2": "^0.40.1",
"jose": "^5.3.0",
"log": "^6.3.1",
"result": "git+git@git.pband.ch:typescript/result.git",
@@ -16,7 +15,6 @@
},
"devDependencies": {
"@happy-dom/global-registrator": "^14.10.2",
"@types/argon2": "^0.15.0",
"@types/bun": "^1.1.2",
"@types/zxcvbn": "^4.4.4"
},
+4 -10
View File
@@ -1,13 +1,7 @@
import argon from 'argon2'
export function hash(pwd: string): Promise<string> {
return argon.hash(pwd)
export function hash(pwd: string) : Promise<string> {
return Bun.password.hash(pwd)
}
export async function verify(pwd: string, hash: string): Promise<boolean> {
try {
return await argon.verify(hash, pwd)
} catch (_) {}
return false
export async function verify(pwd: string, hash: string) : Promise<boolean> {
return Bun.password.verify(pwd, hash).catch(() => false)
}