From 90473eeb0511c466714a1e288d569931d588b3f0 Mon Sep 17 00:00:00 2001 From: Albert Date: Wed, 30 Jan 2019 16:33:41 +0000 Subject: [PATCH 1/2] impove randomness --- plugin/multiplex/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/multiplex/index.js b/plugin/multiplex/index.js index 8195f046..4a4f3de6 100644 --- a/plugin/multiplex/index.js +++ b/plugin/multiplex/index.js @@ -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)}); }); @@ -61,4 +62,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 ); \ No newline at end of file +console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset ); From 9e3a52f14a8e80441520933a7b654c86ed730da3 Mon Sep 17 00:00:00 2001 From: Albert Date: Mon, 11 Feb 2019 09:05:46 +0000 Subject: [PATCH 2/2] correct typo --- plugin/multiplex/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/multiplex/index.js b/plugin/multiplex/index.js index 4a4f3de6..f11639b6 100644 --- a/plugin/multiplex/index.js +++ b/plugin/multiplex/index.js @@ -45,7 +45,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(array) + window.crypto.getRandomValues(rand) var secret = ts.toString() + rand.toString(); res.send({secret: secret, socketId: createHash(secret)}); });