token generation
Nodejs Random Token Generation
import crypto from 'crypto'; // Built into nodejs
crypto.randomBytes(24, function(err, buffer) {
var token = buffer.toString('hex');
console.log(token)
});
async function doAsync() {
async function GenerateToken() {
let token = await crypto.randomBytes(24).toString('hex')
return token
}
console.log(await GenerateToken())
}
doAsync()
Research
- uuid-token-generator - npm
- Need to test
- rand-token - npm
- Doesn't work as module