Skip to content

DaveSession

Defined in: packages/voice/src/dave.ts:85

One end-to-end encrypted (DAVE) media session: the MLS group of a voice channel, its protocol transitions, and Opus frame encryption. Follows the DAVE protocol’s client flow (key package → proposals → commit/welcome → transition ready → execute).

new DaveSession(module, protocolVersion, userId, channelId, hooks): DaveSession

Defined in: packages/voice/src/dave.ts:100

DaveyModule

number

string

string

DaveSessionHooks

DaveSession

protocolVersion: number

Defined in: packages/voice/src/dave.ts:86

get active(): boolean

Defined in: packages/voice/src/dave.ts:115

Whether frames are currently end-to-end encrypted.

boolean


get voicePrivacyCode(): string | null

Defined in: packages/voice/src/dave.ts:120

The voice privacy code users can compare, or null without DAVE.

string | null

decrypt(frame, userId): Uint8Array<ArrayBufferLike> | null

Defined in: packages/voice/src/dave.ts:263

Decrypts a frame from userId.

Uint8Array

string

Uint8Array<ArrayBufferLike> | null

The Opus frame, or null to drop it.


destroy(): void

Defined in: packages/voice/src/dave.ts:293

Drops the MLS state.

void


encrypt(frame): Uint8Array<ArrayBufferLike> | null

Defined in: packages/voice/src/dave.ts:255

End-to-end encrypts an outgoing Opus frame. Silence frames, frames without DAVE (protocol version 0) and frames during an upgrade from transport-only stay as they are.

Uint8Array

Uint8Array<ArrayBufferLike> | null

The frame to send, or null to drop it: DAVE is required but the MLS group is not ready (joining, or recovering from an invalid commit), so it must not leave unencrypted.


executeTransition(transitionId): boolean

Defined in: packages/voice/src/dave.ts:172

Op 22.

number

boolean

Whether a pending transition was executed.


prepareEpoch(epoch, protocolVersion): void

Defined in: packages/voice/src/dave.ts:193

Op 24.

number

number

void


prepareTransition(transitionId, protocolVersion): boolean

Defined in: packages/voice/src/dave.ts:154

Op 21.

number

number

boolean

Whether to answer with op 23 (transition ready).


process(kind, payload): object

Defined in: packages/voice/src/dave.ts:218

Op 29 (commit) or op 30 (welcome).

"commit" | "welcome"

Uint8Array

object

The transition and whether it applied; a failure re-initializes.

ok: boolean

transitionId: number


processProposals(payload, connectedUserIds): Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/voice/src/dave.ts:203

Op 27.

Uint8Array

Iterable<string>

Uint8Array<ArrayBufferLike> | undefined

The op 28 payload (commit, then welcome) to send, if any.


reinit(): void

Defined in: packages/voice/src/dave.ts:127

(Re)creates the MLS state and announces a fresh key package.

void


setExternalSender(payload): void

Defined in: packages/voice/src/dave.ts:149

Op 25.

Uint8Array

void