admin can destroy channel with DESTROY command

Behavior

discovery

GIVEN an admin on a channel

  • WHEN the admin sends HELP
  • THEN the command DESTROY will be listed and described as "permanently delete this channel" (or something like that)

GIVEN a maintainer of a signalboost instance

  • WHEN the maintainer issues boost help
  • THEN they will see destroy listed as one of the command options

issuing command

GIVEN an existing channel #foo with phone number +15555555555 and an admin who wants to wipe all their data

  • WHEN an admin sends the DESTROY command to the channel
  • OR WHEN a maintainer issues boost destroy +15555555555
  • THEN all admins and subscribers to the channel will receive a message notifying them that the channel and all traces of it are being permanently destroyed
  • AND THEN the system deletes all records of the channel
    • (The channel record, all its administrator lists, subscriber lists, and its entry in the signal keystore will be deleted and the phone number will be released back to twilio.)
  • NOW WHEN
    • anyone tries to send a message over the channel, nothing happens
    • a maintainer issues either boost list-channels boost list-numbers the phone number associated with the channel does not appear
    • inspecting the contents of signal_data docker vlume will not reveal any directories associated with the old channel phone numbers
    • fetching all phone numbers from twilio via API (node /cli/boost-commands/listNumbers.js) will not list the phone number

corner cases

don't fire on broadcast messages

GIVEN an existing channel

  • WHEN an admin issues destroy the pigs
  • THEN the message is broadcast to the channel and nothing is destroyed (except the pigs maybe)

deleting a phone number that lacks a channel

GIVEN a phone number that has just been recycled or never been used (phone number VERIFIED, no channel records or associated records)

  • WHEN a maintainer issues boost destroy <phone number>
  • THEN the phone number will be deleted from the database, its keystore will be removed (if not already removed), and the phone number will be released back to twilio

Dependencies

Proper implementation of this card depends on finishing #128 (closed) first and reusing much of its logic

Implementation Notes

  • delete db records referencing channel number (foreign key constrained joins first!):
    • first: messageCounts, memberships where channelNumber = {NUMBER}
    • then: channels, phoneNumber where phoneNumber = {NUMBER}
  • delete keystore files containing key material for conversations associated w/ channel number:
    • rm -rf /var/lib/docker/volumes/signalboost_signal_data/_data/{NUMBER}*
  • release the phone number from twillio:
    • use the twillio api call specified in cli/boost-commands/release-number, which needs an sid
    • get the sid by either:
      • performing this step before deleting phone number (and retrieving it from db)
      • using call similar to that in boost-commands/listNumbers to list numbers and select sid from return results
  • potentially: restart signald service
Edited by aguestuser