UNPKG

@srsl/tools

Version:

JavaScript tools for common interfaces

37 lines (29 loc) 1.11 kB
// // const { promisifyAll } = require('bluebird') // const { AWS, sns } = require('../../constructors/aws-sdk') // const { createVerificationCode } = require('^/utils') // // const publish = promisify(sns.publish) // // AWS.config.setPromisesDependency(require('bluebird')) // // promisifyAll(sns) // const sendPhoneVerificationText = async ( // { phone, phoneCountryCode }, // Subject = 'TrustedLife verification code', // messageTemplate = 'TrustedLife: use this code: {{code}}.' // ) => { // const CODE_LENGTH = 6 // const code = createVerificationCode(CODE_LENGTH) // const Message = messageTemplate.replace('{{code}}', code) // const params = { // Message, // PhoneNumber: `+${phoneCountryCode}${phone}`, // Subject, // } // console.log('sending txt message', params) // const pub = sns.publish(params) // console.log(pub) // const result = pub.promise() // console.log('result: ', result) // // const result = {} // return { code, result } // } // // module.exports.publish = publish // module.exports.sendPhoneVerificationText = sendPhoneVerificationText