File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 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"
99import * as util from "util"
1010import xdgBasedir from "xdg-basedir"
1111import safeCompare from "safe-compare"
12+ import { logger } from "@coder/logger"
1213
1314export interface Paths {
1415 data : string
@@ -121,14 +122,24 @@ export const generatePassword = async (length = 24): Promise<string> => {
121122 * Used to hash the password.
122123 */
123124export 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+ }
125131}
126132
127133/**
128134 * Used to verify if the password matches the hash
129135 */
130136export 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+ }
132143}
133144
134145/**
You can’t perform that action at this time.
0 commit comments