From b67c572b06f32df6ddb3e59763fb6ce28a32e95e Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 15 Mar 2018 10:55:54 +0700 Subject: [PATCH] Use cryptographically secure session token --- main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 1379e64..552ad20 100644 --- a/main.js +++ b/main.js @@ -7,6 +7,7 @@ const BrowserWindow = electron.BrowserWindow; const path = require('path'); const url = require('url'); const os = require('os'); +const { randomBytes } = require('crypto'); const md5 = require('./routes/md5'); const exec = require('child_process').exec; const { Menu } = require('electron'); @@ -54,7 +55,7 @@ app.setVersion(appBasicInfo.version); shepherd.createAgamaDirs(); -const appSessionHash = md5(Date.now().toString()); +const appSessionHash = randomBytes(32).toString('hex'); const _spvFees = shepherd.getSpvFees(); shepherd.writeLog(`app info: ${appBasicInfo.name} ${appBasicInfo.version}`); @@ -485,4 +486,4 @@ function formatBytes(bytes, decimals) { const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; -} \ No newline at end of file +}