Merge pull request #2312 from albert-ziegler/improve_random_number_generation
impove randomness
This commit is contained in:
commit
27b70ed0ba
|
@ -44,7 +44,8 @@ app.get("/", function(req, res) {
|
||||||
|
|
||||||
app.get("/token", function(req,res) {
|
app.get("/token", function(req,res) {
|
||||||
var ts = new Date().getTime();
|
var ts = new Date().getTime();
|
||||||
var rand = Math.floor(Math.random()*9999999);
|
var rand = new Uint32Array(1);
|
||||||
|
window.crypto.getRandomValues(rand)
|
||||||
var secret = ts.toString() + rand.toString();
|
var secret = ts.toString() + rand.toString();
|
||||||
res.send({secret: secret, socketId: createHash(secret)});
|
res.send({secret: secret, socketId: createHash(secret)});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue