init:init to origin

This commit is contained in:
2025-11-01 10:57:15 +08:00
parent f15daefed9
commit 6facd5f6cc
9 changed files with 141 additions and 0 deletions

15
src/utils/jwt.ts Normal file
View File

@@ -0,0 +1,15 @@
import jsonwebtoken from 'jsonwebtoken';
import config from '../config.js';
export class Jwt {
static sign(payload: object){
return jsonwebtoken.sign(payload,config.express.jwtSecret,{
expiresIn: 60 * 60 * 24, // 24 hours
algorithm: "HS256"
})
}
static verify(token: string) {
return jsonwebtoken.verify(token,config.express.jwtSecret)
}
}