Merge pull request #1121 from siiky/fix/lam-308/pairing-totems
fix: revert recent pairing changes
This commit is contained in:
commit
d893d0f6b8
1 changed files with 2 additions and 10 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
const _ = require('lodash/fp')
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const pify = require('pify')
|
const pify = require('pify')
|
||||||
const readFile = pify(fs.readFile)
|
const readFile = pify(fs.readFile)
|
||||||
|
|
@ -15,19 +14,12 @@ const bsAlpha = baseX(ALPHA_BASE)
|
||||||
|
|
||||||
const unpair = pairing.unpair
|
const unpair = pairing.unpair
|
||||||
|
|
||||||
function totem (name, operatorId = null) {
|
function totem (name) {
|
||||||
const operatorBuffer = _.flow(
|
|
||||||
_.map(it => it.toString(16).padStart(2, '0')),
|
|
||||||
_.join(''),
|
|
||||||
op => Buffer.from(op, 'hex')
|
|
||||||
|
|
||||||
)(operatorId ? [...parse(operatorId)] : [])
|
|
||||||
|
|
||||||
const caPath = options.caPath
|
const caPath = options.caPath
|
||||||
return readFile(caPath)
|
return readFile(caPath)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const caHash = crypto.createHash('sha256').update(data).digest()
|
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 hexToken = token.toString('hex')
|
||||||
const caHexToken = crypto.createHash('sha256').update(hexToken).digest('hex')
|
const caHexToken = crypto.createHash('sha256').update(hexToken).digest('hex')
|
||||||
const buf = Buffer.concat([caHash, token, Buffer.from(options.hostname)])
|
const buf = Buffer.concat([caHash, token, Buffer.from(options.hostname)])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue