Currently I'm working with jwt in node.js app. I use jwt.sign() method which looks like this:
jwt.sign({
accountID: user.accountID,
email: user.email,
}, process.env.SECRET_KEY, (err, token) => {
if (err) throw err
res.json({token})
})
I don't want to use callback. I want to transform this to async/await. As I know I have to return new Promise with resole({}) and reject(err). But I can't figure out how to use promise from sign() method. Any help appreciated. Thanks!