This commit is contained in:
Pascal Perrenoud
2024-07-27 13:35:17 +02:00
parent baa748cb3e
commit 29ae2c46c2
+10 -10
View File
@@ -1,16 +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 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> {
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
})
export async function verify(pwd: string, hash: string): Promise<boolean> {
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
})
}