feat: add nil UUID to match new machine pairing logic

This commit is contained in:
Sérgio Salgado 2021-10-05 14:46:21 +01:00
parent eb18440320
commit 16513a8238
3 changed files with 4 additions and 3 deletions

View file

@ -3,6 +3,7 @@ const pify = require('pify')
const readFile = pify(fs.readFile)
const crypto = require('crypto')
const baseX = require('base-x')
const { NIL } = require('uuid')
const options = require('../../options')
const db = require('../../db')
@ -19,7 +20,7 @@ function totem (name) {
return readFile(caPath)
.then(data => {
const caHash = crypto.createHash('sha256').update(data).digest()
const token = crypto.randomBytes(32)
const token = Buffer.concat([crypto.randomBytes(32), NIL])
const hexToken = token.toString('hex')
const caHexToken = crypto.createHash('sha256').update(hexToken).digest('hex')
const buf = Buffer.concat([caHash, token, Buffer.from(options.hostname)])