File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import * as path from "path"
9
9
import * as util from "util"
10
10
import xdgBasedir from "xdg-basedir"
11
11
import safeCompare from "safe-compare"
12
+ import { logger } from "@coder/logger"
12
13
13
14
export interface Paths {
14
15
data : string
@@ -121,14 +122,24 @@ export const generatePassword = async (length = 24): Promise<string> => {
121
122
* Used to hash the password.
122
123
*/
123
124
export const hash = async ( password : string ) : Promise < string > => {
124
- return await argon2 . hash ( password )
125
+ try {
126
+ return await argon2 . hash ( password )
127
+ } catch ( error ) {
128
+ logger . error ( error )
129
+ return ""
130
+ }
125
131
}
126
132
127
133
/**
128
134
* Used to verify if the password matches the hash
129
135
*/
130
136
export const isHashMatch = async ( password : string , hash : string ) => {
131
- return await argon2 . verify ( hash , password )
137
+ try {
138
+ return await argon2 . verify ( hash , password )
139
+ } catch ( error ) {
140
+ logger . error ( error )
141
+ return false
142
+ }
132
143
}
133
144
134
145
/**
You can’t perform that action at this time.
0 commit comments