重新封装代码

This commit is contained in:
2026-09-09 22:33:09 +08:00
parent 51c41e8fb7
commit 52ceba6e6d
100 changed files with 9828 additions and 89 deletions
+26
View File
@@ -0,0 +1,26 @@
const jwt = require("jsonwebtoken");
const secret = process.env.JWT_SECRET;
// 创建token
function createToken(payload){
return jwt.sign(
payload,
secret,
{
expiresIn:"2min"
}
);
}
// 验证token
function verifyToken(token){
return jwt.verify(
token,
secret
);
}
module.exports = {
createToken,
verifyToken
};