diff --git a/lib/utils/token-util.js b/lib/utils/token-util.js index a1d6937..5248756 100644 --- a/lib/utils/token-util.js +++ b/lib/utils/token-util.js @@ -5,7 +5,6 @@ */ const randomBytes = require('crypto').randomBytes; -const { createHash } = require('../utils/crypto-util'); /** * Export `TokenUtil`. @@ -17,8 +16,15 @@ module.exports = { * Generate random token. */ - generateRandomToken: async function() { - const buffer = randomBytes(256); - return createHash({ data: buffer, encoding: 'hex' }); + generateRandomToken: function() { + return new Promise((resolve, reject) => { + randomBytes(32, (err, data) => { + if (err) { + reject(err); + } else { + resolve(data.toString('hex')); + } + }); + }); } };