WIPP unpairing

This commit is contained in:
Josh Harvey 2017-03-18 18:49:50 +02:00
parent 134a016bbd
commit e537033319
4 changed files with 226 additions and 4049 deletions

View file

@ -53,7 +53,7 @@ function poll (req, res, next) {
}
const response = {
err: null,
error: null,
locale,
txLimit: config.cashInTransactionLimit,
idVerificationEnabled: config.idVerificationEnabled,
@ -141,7 +141,7 @@ function ca (req, res) {
return pairing.authorizeCaDownload(token)
.then(ca => res.json({ca}))
.catch(() => res.sendStatus(403))
.catch(() => res.status(403).json({error: 'forbidden'}))
}
function pair (req, res, next) {
@ -204,7 +204,7 @@ function filterOldRequests (req, res, next) {
logger.error('Clock skew with lamassu-machine too high [%ss], adjust lamassu-machine clock', (delta / 1000).toFixed(2))
}
if (delta > REQUEST_TTL) return res.status(408).end()
if (delta > REQUEST_TTL) return res.status(408).json({error: 'stale'})
next()
}
@ -218,7 +218,7 @@ function authorize (req, res, next) {
return next()
}
return res.sendStatus(403)
return res.status(403).json({error: 'Forbidden'})
})
.catch(next)
}
@ -265,7 +265,7 @@ app.get('/tx/:id', getTx)
app.get('/tx', getPhoneTx)
app.use(errorHandler)
app.use((req, res) => res.status(404).json({err: 'No such route'}))
app.use((req, res) => res.status(404).json({error: 'No such route'}))
localApp.get('/pid', (req, res) => {
const deviceId = req.query.device_id