Untitled

mail@pastecode.io avatar
unknown
javascript
3 years ago
304 B
2
Indexable
//jwtUtils.js

const jwt = require('jsonwebtoken')

const generateSign = (id, email) => {
    return jwt.sign({ id, email }, process.env.JWT_SECRET, { expiresIn: '1d' })
}

const verifyJwt = (token) => {
    return jwt.verify(token, process.env.JWT_SECRET)
}

module.exports = { generateSign, verifyJwt }