Skip to content

feat(voice): implement DAVE end-to-end encryption #10921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Snazzah
Copy link
Contributor

@Snazzah Snazzah commented Jun 4, 2025

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

Implements the Discord Audio & Video End-to-End Encryption (DAVE) Protocol (PR) using @snazzah/davey.

  • State management
  • Encryption
  • Decryption
  • Store clients connected in a set for processProposals
  • Fix issue with session downgrades having some packets not play during playback
  • Handle decryption issues mid and after transition gracefully
  • Add some voice options and propagate some DAVE features

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 changes the library's interface (methods or parameters added)
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

Copy link

vercel bot commented Jun 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2025 2:11am
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2025 2:11am

return Davey?.DAVE_PROTOCOL_VERSION;
}

export interface DAVESession extends EventEmitter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use asynceventemitter like in other packages if you can (unless voice doesn't use it yet, in which case i can look into moving us there)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Networking class nor the VoiceConnection don't seem to use asynceventmitter yet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into it then

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 16.08579% with 313 lines in your changes missing coverage. Please review.

Project coverage is 42.00%. Comparing base (d40ceed) to head (5feb52c).

Files with missing lines Patch % Lines
packages/voice/src/networking/DAVESession.ts 8.06% 171 Missing ⚠️
packages/voice/src/networking/Networking.ts 15.12% 101 Missing ⚠️
packages/voice/src/networking/VoiceWebSocket.ts 8.69% 21 Missing ⚠️
packages/voice/src/networking/DAVESessionError.ts 21.42% 11 Missing ⚠️
packages/voice/src/receive/VoiceReceiver.ts 77.77% 6 Missing ⚠️
...ackages/voice/src/util/generateDependencyReport.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10921      +/-   ##
==========================================
- Coverage   42.69%   42.00%   -0.70%     
==========================================
  Files         262      264       +2     
  Lines       16086    16407     +321     
  Branches     1545     1546       +1     
==========================================
+ Hits         6868     6891      +23     
- Misses       9206     9504     +298     
  Partials       12       12              
Flag Coverage Δ
brokers 31.41% <ø> (ø)
builders 80.52% <ø> (ø)
collection 100.00% <ø> (ø)
core 0.89% <ø> (ø)
formatters 99.63% <ø> (ø)
proxy 65.88% <ø> (ø)
rest 87.67% <ø> (ø)
util 43.28% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 61.59% <16.08%> (-8.86%) ⬇️
ws 36.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants