add ca download route

This commit is contained in:
Josh Harvey 2016-10-21 23:56:58 +03:00
parent 20e10779a7
commit ff162775a1
3 changed files with 44 additions and 5 deletions

View file

@ -222,6 +222,17 @@ function verifyTx (req, res) {
})
}
function ca (req, res) {
const token = req.body.token
return pair.authorizeCaDownload(token)
.then(valid => {
if (valid) return res.json({ca: pair.ca()})
return res.status(408).end()
})
}
function pair (req, res) {
const token = req.body.token
const deviceId = getDeviceId(req)
@ -337,6 +348,9 @@ function init (opts) {
const app = opts.app
const localApp = opts.localApp
app.post('/pair', pair)
app.post('/ca', ca)
app.get('/poll', authMiddleware, poll)
app.post('/trade', authMiddleware, trade)
@ -348,7 +362,6 @@ function init (opts) {
app.post('/event', authMiddleware, deviceEvent)
app.post('/verify_user', authMiddleware, verifyUser)
app.post('/verify_transaction', authMiddleware, verifyTx)
app.post('/pair', pair)
app.post('/phone_code', authMiddleware, phoneCode)
app.post('/update_phone', authMiddleware, updatePhone)