import jwt from 'jsonwebtoken' ; const secretBuffer = Buffer . from ( process . env . JWT_SECRET ! , 'hex' ) ; const algorithm = 'HS256' ; export function generateJWT ( payload ) { return jwt . sign ( payload , secretBuffer , { algorithm } ) ; } export function verifyJWT ( token ) { try { return jwt . verify ( token , secretBuffer , { algorithms : [ algorithm ] } ) ; } catch ( err ) { return undefined ; } }