From e252480daa8aeee6f11e70d41ed424a065db6be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Fri, 18 Feb 2022 15:52:24 +0000 Subject: [PATCH] fix: revert recent pairing changes 48973f442ed07dcc3628bd9aefa327204dece7f9 6dee47a17188ec34be259a642db07cced91037b5 16513a823848f3b36d44af721eed67d20c807e3b --- lib/new-admin/services/pairing.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/new-admin/services/pairing.js b/lib/new-admin/services/pairing.js index c5fa1feb..0ae14dc0 100644 --- a/lib/new-admin/services/pairing.js +++ b/lib/new-admin/services/pairing.js @@ -1,4 +1,3 @@ -const _ = require('lodash/fp') const fs = require('fs') const pify = require('pify') const readFile = pify(fs.readFile) @@ -15,19 +14,12 @@ const bsAlpha = baseX(ALPHA_BASE) const unpair = pairing.unpair -function totem (name, operatorId = null) { - const operatorBuffer = _.flow( - _.map(it => it.toString(16).padStart(2, '0')), - _.join(''), - op => Buffer.from(op, 'hex') - - )(operatorId ? [...parse(operatorId)] : []) - +function totem (name) { const caPath = options.caPath return readFile(caPath) .then(data => { const caHash = crypto.createHash('sha256').update(data).digest() - const token = Buffer.concat([crypto.randomBytes(32), operatorBuffer]) + const token = crypto.randomBytes(32) const hexToken = token.toString('hex') const caHexToken = crypto.createHash('sha256').update(hexToken).digest('hex') const buf = Buffer.concat([caHash, token, Buffer.from(options.hostname)])