File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
import * as cp from "child_process"
2
2
import * as crypto from "crypto"
3
- import * as bcrypt from "bcrypt "
3
+ import * as argon2 from "argon2 "
4
4
import envPaths from "env-paths"
5
5
import { promises as fs } from "fs"
6
6
import * as net from "net"
@@ -120,15 +120,15 @@ export const generatePassword = async (length = 24): Promise<string> => {
120
120
/**
121
121
* Used to hash the password.
122
122
*/
123
- export const hash = ( password : string ) : string => {
124
- return bcrypt . hashSync ( password , 10 )
123
+ export const hash = async ( password : string ) : Promise < string > => {
124
+ return await argon2 . hash ( password )
125
125
}
126
126
127
127
/**
128
128
* Used to verify if the password matches the hash
129
129
*/
130
- export const isHashMatch = ( password : string , hash : string ) => {
131
- return bcrypt . compareSync ( password , hash )
130
+ export const isHashMatch = async ( password : string , hash : string ) => {
131
+ return await argon2 . verify ( hash , password )
132
132
}
133
133
134
134
/**
You can’t perform that action at this time.
0 commit comments