Attempt to clarify installation instructions a little
[vchess.git] / server / utils / tokenGenerator.js
1 function randString() {
2 return Math.random().toString(36).substr(2); // remove `0.`
3 }
4
5 module.exports = function(tokenLength) {
6 let res = "";
7 // 10 = min length of a rand() string
8 const nbRands = Math.ceil(tokenLength/10);
9 for (let i = 0; i < nbRands; i++) res += randString();
10 return res.substr(0, tokenLength);
11 };