This commit is contained in:
Josh Harvey 2016-05-04 18:34:12 +01:00
parent 95fa296190
commit cd1e9bdb66
4 changed files with 57 additions and 10 deletions

View file

@ -213,15 +213,15 @@ function pair (req, res) {
)
}
function raqia (req, res) {
var raqiaCreds
try {
var raqiaRec = require('../raqia.json')
raqiaCreds = raqiaRec[getFingerprint(req)].apiKeys[0]
} catch (ex) {
raqiaCreds = null
}
res.json(raqiaCreds || {})
function phoneCode (req, res) {
var phone = req.body.phone
return plugins.getPhoneCode(phone)
.then(code => res.json({code: code}))
.catch(err => {
if (err.name === 'BadNumberError') return res.send(410)
return res.send(500)
})
}
function init (localConfig) {
@ -246,7 +246,8 @@ function init (localConfig) {
app.post('/verify_user', authMiddleware, verifyUser)
app.post('/verify_transaction', authMiddleware, verifyTx)
app.post('/pair', pair)
app.get('/raqia', raqia)
app.post('/phone_code', authMiddleware, phoneCode)
localApp.get('/pid', function (req, res) {
var machineFingerprint = req.query.fingerprint