feat: decouple l-s entrypoint

This commit is contained in:
Sérgio Salgado 2022-03-29 15:00:52 +01:00
parent 2a2c1fccc8
commit f4d6b5e454
48 changed files with 411 additions and 232 deletions

View file

@ -4,19 +4,18 @@ const readFile = pify(fs.readFile)
const crypto = require('crypto')
const baseX = require('base-x')
const options = require('../options')
const db = require('../db')
const pairing = require('../pairing')
const ALPHA_BASE = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
const bsAlpha = baseX(ALPHA_BASE)
const CA_PATH = process.env.CA_PATH
const unpair = pairing.unpair
function totem (hostname, name) {
const caPath = options.caPath
return readFile(caPath)
return readFile(CA_PATH)
.then(data => {
const caHash = crypto.createHash('sha256').update(data).digest()
const token = crypto.randomBytes(32)