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

@ -4,6 +4,7 @@ var _ = require('lodash')
var async = require('async')
var BigNumber = require('bignumber.js')
BigNumber.config({CRYPTO: true})
var logger = require('./logger')
var notifier = require('./notifier')
@ -715,3 +716,16 @@ exports.startCheckingNotification = function startCheckingNotification () {
checkNotification()
setInterval(checkNotification, CHECK_NOTIFICATION_INTERVAL)
}
exports.getPhoneCode = function getPhoneCode (phone) {
const code = BigNumber.random().toFixed(6).slice(2)
const rec = {
sms: {
toNumber: phone,
body: 'Your cryptomat code: ' + code
}
}
return smsPlugin.sendMessage(rec)
.then(() => code)
}