v12.0.0 - initial commit
This commit is contained in:
commit
e2c49ea43c
1145 changed files with 97211 additions and 0 deletions
16
packages/server/lib/middlewares/ca.js
Normal file
16
packages/server/lib/middlewares/ca.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
const pairing = require('../pairing')
|
||||
const logger = require('../logger')
|
||||
|
||||
function ca(req, res) {
|
||||
const token = req.query.token
|
||||
|
||||
return pairing
|
||||
.authorizeCaDownload(token)
|
||||
.then(ca => res.json({ ca }))
|
||||
.catch(error => {
|
||||
logger.error(error.message)
|
||||
return res.status(403).json({ error: 'forbidden' })
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = ca
|
||||
Loading…
Add table
Add a link
Reference in a new issue