Sfoglia il codice sorgente

Revert "impove randomness"

Hakim El Hattab 5 anni fa
parent
commit
d927cdf579
1 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 2 3
      plugin/multiplex/index.js

+ 2 - 3
plugin/multiplex/index.js

@@ -44,8 +44,7 @@ app.get("/", function(req, res) {
 
 app.get("/token", function(req,res) {
 	var ts = new Date().getTime();
-	var rand = new Uint32Array(1);
-	window.crypto.getRandomValues(rand)
+	var rand = Math.floor(Math.random()*9999999);
 	var secret = ts.toString() + rand.toString();
 	res.send({secret: secret, socketId: createHash(secret)});
 });
@@ -62,4 +61,4 @@ var brown = '\033[33m',
 	green = '\033[32m',
 	reset = '\033[0m';
 
-console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset );
+console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset );