logging
ci/woodpecker/push/test Pipeline failed

Closes #4
This commit is contained in:
2024-05-15 13:17:43 +02:00
parent ea476a0ea0
commit a52d884b14
2 changed files with 11 additions and 1 deletions
+1
View File
@@ -14,6 +14,7 @@
},
"dependencies": {
"log": "git+git@git.pband.ch:typescript/log",
"result": "git+git@git.pband.ch:typescript/result.git"
},
"devDependencies": {
+10 -1
View File
@@ -1,7 +1,16 @@
import logger from 'log'
const log = logger('crypto-server:pwd')
export function hash(pwd: string) : Promise<string> {
log.debug('hash password')
return Bun.password.hash(pwd)
}
export async function verify(pwd: string, hash: string) : Promise<boolean> {
return Bun.password.verify(pwd, hash).catch(() => false)
log.debug("verify password's hash")
return Bun.password.verify(pwd, hash).catch(e => {
log.warn('Password verification failed')
log.debug(`Error : ${e}`)
return false
})
}