8 lines
266 B
JavaScript
8 lines
266 B
JavaScript
// server/utils/crypto.js
|
|
const jwt = require('jsonwebtoken');
|
|
const config = require('../config');
|
|
|
|
const encrypt = (data) => jwt.sign(data, config.JWT_SECRET);
|
|
const decrypt = (token) => jwt.verify(token, config.JWT_SECRET);
|
|
|
|
module.exports = { encrypt, decrypt }; |