impove randomness

This commit is contained in:
Albert 2019-01-30 16:33:41 +00:00
parent 0b3e7839eb
commit 90473eeb05
1 changed files with 3 additions and 2 deletions

View File

@ -44,7 +44,8 @@ app.get("/", function(req, res) {
app.get("/token", function(req,res) {
var ts = new Date().getTime();
var rand = Math.floor(Math.random()*9999999);
var rand = new Uint32Array(1);
window.crypto.getRandomValues(array)
var secret = ts.toString() + rand.toString();
res.send({secret: secret, socketId: createHash(secret)});
});