Skip to content

feat: add DAVE E2EE voice support#453

Open
coderobe wants to merge 3 commits into
shardlab:mainfrom
coderobe:main
Open

feat: add DAVE E2EE voice support#453
coderobe wants to merge 3 commits into
shardlab:mainfrom
coderobe:main

Conversation

@coderobe
Copy link
Copy Markdown

@coderobe coderobe commented May 3, 2026

Summary

Adds DAVE E2EE voice protocol support through ffi discord/libdave bindings. DAVE support is only enabled when the libdave native libraries are found and can be loaded, so it is not a new hard dependency unless bot operators want to use voice features.

For testing on macos, i provide a libdave homebrew cask so you can brew tap coderobe/libdave && brew install libdave and this change should pick it up and enable it automatically.

The path to the libdave shared library can be overridden by setting DISCORDRB_LIBDAVE_PATH, and additional libdave-internal debug log verbosity can be tuned with DISCORDRB_LIBDAVE_LOG_LEVEL (defaults to warning).


Added

discordrb/voice/dave: DAVE E2EE protocol support

coderobe added 2 commits May 3, 2026 16:32
… add a handful of short DAVE: debug lines in the voice state machine so debug mode still shows useful milestones without dumping MLS payload hex
@coderobe
Copy link
Copy Markdown
Author

coderobe commented May 3, 2026

resolves #448

@coderobe coderobe changed the title add DAVE E2EE voice support feat: add DAVE E2EE voice support May 3, 2026
Comment thread lib/discordrb/voice/network.rb Outdated
Co-authored-by: Droid <johnship2876@gmail.com>
@Droid00000
Copy link
Copy Markdown
Collaborator

Droid00000 commented May 9, 2026

Hey, thank you for the PR. After some more testing, I've found a few issues. It may be worth noting that I'm on MacOS, and unsure if any of these issues are platform specific. In essence:

  1. Whenever someone joins or leaves the voice channel, the errors listed below occur
  2. You cannot hear any audio from the bot, when playing a file, e.g. VoiceBot#play_file

User Join:

[DEBUG : vws-i @ 2026-05-08 22:27:46.692] DAVE: Processing MLS proposals (499 bytes)
[ERROR : vws-i @ 2026-05-08 22:27:46.693] DAVE: Attempted to verify credential for unrecognized user ID: 673658900435697665
[ERROR : vws-i @ 2026-05-08 22:27:46.693] DAVE: MLS add proposal must be for recognized user
[WARN : vws-i @ 2026-05-08 22:27:46.694] VWS close: DAVE MLS failure from ValidateProposalMessage: Unexpected user ID in add proposal
[DEBUG : vws-i @ 2026-05-08 22:27:46.701] Received VWS binary opcode 30 (958 bytes)
[DEBUG : vws-i @ 2026-05-08 22:27:46.701] DAVE: Processing MLS welcome for transition 0
[ERROR : vws-i @ 2026-05-08 22:27:46.703] DAVE: Attempted to verify credential for unrecognized user ID: 673658900435697665
[ERROR : vws-i @ 2026-05-08 22:27:46.703] DAVE: MLS welcome lists unrecognized user ID
[DEBUG : vws-i @ 2026-05-08 22:27:46.703] DAVE: Transition 0 is ready
[DEBUG : vws-i @ 2026-05-08 22:27:46.703] Sending voice opcode 23 with data: {transition_id: 0}
#<Thread:0x0000000123bcc270 core.rb:60 run> terminated with exception (report_on_exception is true):
/Users/qs/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/bundler/gems/discordrb-dave-0a7c89b4be88/lib/discordrb/voice/network.rb:440:in 'Discordrb::Voice::VoiceWS#ready_for_media?': RuntimeError (RuntimeError)
        from /Users/qs/.rbenv/versions/4.0.1/lib/ruby/gems/4.0.0/bundler/gems/discordrb-dave-0a7c89b4be88/lib/discordrb/voice/network.rb:429:in 'Discordrb::Voice::VoiceWS#connect'
        from core.rb:60:in 'block in Discordrb::Voice::VoiceBot#initialize'

User Leave

[DEBUG : vws-i @ 2026-05-08 22:28:22.635] Received VWS message! {"seq":8,"op":13,"d":{"user_id":"673658900435697665"}}
[DEBUG : vws-i @ 2026-05-08 22:28:22.636] Received VWS message! {"seq":9,"op":24,"d":{"protocol_version":1,"epoch":1}}
[DEBUG : vws-i @ 2026-05-08 22:28:22.636] DAVE: Preparing epoch 1 for protocol version 1
[DEBUG : vws-i @ 2026-05-08 22:28:22.638] DAVE: Sending MLS key package
[DEBUG : vws-i @ 2026-05-08 22:28:22.639] Sending voice binary opcode 26 (390 bytes)
[DEBUG : vws-i @ 2026-05-08 22:28:22.642] Received VWS message! {"seq":10,"op":21,"d":{"transition_id":0,"protocol_version":1}}
[DEBUG : vws-i @ 2026-05-08 22:28:22.642] DAVE: Preparing transition 0 for protocol version 1
[WARN : vws-i @ 2026-05-08 22:28:22.644] VWS close: Failed to create DAVE key ratchet for user 1268769703027933235

@coderobe
Copy link
Copy Markdown
Author

coderobe commented May 13, 2026

I get the user leave warn on close occasionally, although not always. Haven't investigated, but it's not fatal. The other issue i can't reproduce. Audio works fine for me - I have been using my branch for multiple sound bots, although largely with short soundbites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants