Resolve "Remotely register twilio numbers as signal numbers"
Closes #19 (closed) (and fulfills its Acceptance Criteria)
Usage
With this MR, a developer can use the following 1-line bash command to purchase 10 numbers from twilio in area code 510 and authenticate them with Signal, making them ready for use by signal-boost
/signal-cli
:
$ ./bin/provision-numbers -n 10 -a 510
Implementation
- add a
phoneNumber
service (andphoneNumber
model) - track a phone number's progress through the provisioning process with
status
field (which may bePURCHASED
,REGISTERED
,VERIFIED
, orACTIVE
-- the latter will be used in subsequent cards when a verified number is assigned to a channel) - add
phoneNumber#purchase
, which uses the twilio API to search for available phone numbers and "create" (ie: buy), the first available one - add
phoneNumber#register
, which shells out tosignal-cli register
to request a verfication code for a given number, which will trigger the signal server to send an SMS to the number - add
phoneNumber#verify
, which (1) is called when twilio forwards an sms to the/twilioSms
endpoint provided by thecreate
step in#purchase
and (2) reads the verification code from the webhook payload and shells out tosignal-cli verify
to submit the verification code to the signal server - use a common event emitter passed to both
#register
and#verify
to allow the latter to communicate to the former when it has completed (:. allowing the caller to only call one async function and return/resolve when it completes) - compose both
#purchase
and#verify
into#provision
, and extend the latter into#provisionN
, which we expose at the endpoint/phoneNumbers/provision
Edited by aguestuser