discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

feat(voice)!: add new encryption methods, remove old methods

Open nyapat opened this issue 6 months ago • 3 comments

Please describe the changes this PR makes and why it should be merged:

  • [x] aes256gcm encryption
  • [x] xchacha20 encryption
  • [x] aes256gcm decryption
  • [x] xchacha20 decryption
  • [x] test if alternative sodiums work for above
  • [x] alternative for tweetnacl
  • [x] remove old encryption, decryption methods
  • [x] tests (waiting on #10472)

Added the new encryption methods that Discord will enforce for all voice users in November. Since the older methods are being deprecated entirely, I am removing them as well. Because tweetnacl does not support the cipher methods necessary for xchacha, I have removed it and replaced it with @stablelib/xchacha20poly1305 (aes256gcm does not require anything other than node:crypto, so that could theoretically be the only one needed if the vc always requested that)

Testing has been added for the encryption methods aswell, and I have changed some older tests to properly remove the RTP header based on the original encrypted data.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

nyapat avatar Aug 19 '24 13:08 nyapat