This commit is contained in:
@@ -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
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user