Skip to content

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:

  1. Create a Session and call init with the protocol version and channel group ID.
  2. Call setExternalSender with the credential package provided by the voice server.
  3. Receive the client’s getMarshalledKeyPackage bytes and send them to the voice server as an MLS proposal.
  4. Process incoming processProposals / processCommit / processWelcome messages relayed by the voice server to advance the group epoch.
  5. After each epoch change, call Session:getKeyRatchet for each participant and pass the result to the appropriate Encryptor or Decryptor.
  6. Pass every outgoing media frame through Encryptor:encrypt and every incoming frame through Decryptor:decrypt.

setLogSinkCallback can be used to route libdave’s internal log output into the application’s own logging system.

Dave.sys  :: Sys

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.

Dave.Session  :: Session
Dave.Encryptor  :: Encryptor
Dave.Decryptor  :: Decryptor
Dave.KeyRatchet  :: KeyRatchet
Dave.CommitResult  :: CommitResult
Dave.WelcomeResult  :: WelcomeResult
Dave.Buffer  :: Buffer

Internal FFI interoperability helpers. Not part of the public API.

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) -> ()