Dave
Entry point for the DAVE (Discord Audio/Video Encryption) end-to-end encryption protocol.
DAVE provides authenticated encryption for Discord voice channels using MLS (Messaging Layer Security). The typical lifecycle for a client joining a voice channel is:
- Create a
Sessionand callinitwith the protocol version and channel group ID. - Call
setExternalSenderwith the credential package provided by the voice server. - Receive the client’s
getMarshalledKeyPackagebytes and send them to the voice server as an MLS proposal. - Process incoming
processProposals/processCommit/processWelcomemessages relayed by the voice server to advance the group epoch. - After each epoch change, call
Session:getKeyRatchetfor each participant and pass the result to the appropriateEncryptororDecryptor. - Pass every outgoing media frame through
Encryptor:encryptand every incoming frame throughDecryptor:decrypt.
setLogSinkCallback can be used to route libdave’s internal log output into the
application’s own logging system.
Summary
Properties
Section titled “Properties”Raw FFI bindings and constants for libdave. Exposes codec IDs, media type constants,
result codes, and the underlying C function table. Prefer the higher-level classes
over calling sys.lib directly.
Session
Section titled “Session”Encryptor
Section titled “Encryptor”Decryptor
Section titled “Decryptor”KeyRatchet
Section titled “KeyRatchet”CommitResult
Section titled “CommitResult”WelcomeResult
Section titled “WelcomeResult”Buffer
Section titled “Buffer”Internal FFI interoperability helpers. Not part of the public API.
Functions
Section titled “Functions”setLogSinkCallback
Section titled “setLogSinkCallback”Dave . setLogSinkCallback ( callback ) -> ()
Registers a global callback that receives all log messages emitted by libdave.
severity maps to Dave.sys.loggingSeverity constants. Set this early in
startup if you want to capture verbose or debug output from the library.
Parameters
| callback: (severity: number, message: string) -> () |