running now
This commit is contained in:
parent
85cd083750
commit
c17bb05f0a
25 changed files with 156 additions and 114 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import * as jwt from "jsonwebtoken";
|
||||
import * as bcrypt from "bcrypt";
|
||||
import * as dotenv from "dotenv";
|
||||
import { payload } from "../dtos/userDto";
|
||||
|
||||
dotenv.config();
|
||||
const { JWT_SECRET = "" } = process.env;
|
||||
|
|
@ -9,11 +8,11 @@ export class encrypt {
|
|||
static async encryptpass(password: string) {
|
||||
return bcrypt.hashSync(password, 12);
|
||||
}
|
||||
static comparepassword(hashPassword: string, password: string) {
|
||||
return bcrypt.compareSync(password, hashPassword);
|
||||
}
|
||||
static comparepassword(password: string, hashPassword: string) {
|
||||
return bcrypt.compareSync(password, hashPassword);
|
||||
}
|
||||
|
||||
static generateToken(payload: payload) {
|
||||
static generateToken(payload: object) {
|
||||
return jwt.sign(payload, JWT_SECRET, { expiresIn: "1d" });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue