kord
kord copied to clipboard
Implement AES Encryption for Voice
I tested voice send/receive for all 3 xsalsa20 poly1305 nonce strategies, all work as expected.
i'm not very familiar with voice connections, can you explain a bit why this is needed?
i'm not very familiar with voice connections, can you explain a bit why this is needed?
It kinda is and kinda isn't. I initially wanted to implement AES because it was faster than xsalsa but after doing a couple benchmarks it looks like xsalsa is a little bit more consistent and a couple microseconds faster.
This isn't really that surprising considering Kord Voice isn't the most efficient voice library, it doesn't help that Java relies on ByteBuffer
s to be performant.
Functionality-wise LGTM. It likely will make adding/working with encryption a bit easier in the future too, if (or rather when) Discord decides to change things up.
- Implemented voice receive for AES, had to refactor a bit of the code to support passing of AEAD data.
- Removed
VoiceEncryption#supportsDecryption
- Removed the sealed modifier for
VoiceEncryption
to allow external implementations (??) - Added kdoc to the
VoiceEncryption
interface.
Not sure if removing supportsDecryption
is a good idea with it being an open interface now 🤷🏼