From 9bcad1a612f026eddfb55a871ea43d22209b05ec Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Wed, 13 Jul 2022 14:15:52 -0700 Subject: [PATCH] Fixed bug with hash of signed binaries when doing JS update --- test/update-test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/update-test.js b/test/update-test.js index 449307c..3791c41 100644 --- a/test/update-test.js +++ b/test/update-test.js @@ -374,8 +374,8 @@ server.on('upgrade', function (msg, sck, head) b.writeUInt16BE(MeshCommand_CoreOk); b.writeUInt16BE(1, 2); this.write(b); - - this.command({ url: 'https://127.0.0.1:9250/update', action: 'agentupdate', hash: getSHA384FileHash(getCurrentUpdatePath()).toString('hex'), sessionid: 'none' }); + + this.command({ url: 'https://127.0.0.1:9250/update', action: 'agentupdate', hash: require('SHA384Stream').create().syncHash(require('fs').readFileSync(getCurrentUpdatePath())).toString('hex').toLocaleLowerCase(), sessionid: 'none' }); break; default: console.log('Agent Update State: ' + updateState); @@ -443,7 +443,7 @@ server.on('upgrade', function (msg, sck, head) b.writeUInt16BE(MeshCommand_CoreOk); b.writeUInt16BE(1, 2); this.write(b); - this.command({ url: 'https://127.0.0.1:9250/update', action: 'agentupdate', hash: getSHA384FileHash(getCurrentUpdatePath()).toString('hex'), sessionid: 'none' }); + this.command({ url: 'https://127.0.0.1:9250/update', action: 'agentupdate', hash: require('SHA384Stream').create().syncHash(require('fs').readFileSync(getCurrentUpdatePath())).toString('hex').toLocaleLowerCase(), sessionid: 'none' }); break; case 99: // No-Op because we are done