class DAVESession

extends

EventEmitter
export declare class DAVESession extends EventEmitter

Manages the DAVE protocol group session.

Constructors

constructor(
protocolVersion: number
userId: string
channelId: string
)

Constructs a new instance of the DAVESession class

channelId : string

The channel id represented by this session.

optional
lastTransitionId? : number | undefined

The last transition id executed.

protocolVersion : number

The protocol version being used.

reinitializing : boolean

Whether this session is currently re-initializing due to an invalid transition.

The underlying DAVE Session of this wrapper.

userId : string

The user id represented by this session.

readonly
voicePrivacyCode : string | null

The current voice privacy code of the session. Will be null if there is no session.

decrypt(
packet: Buffer
userId: string
) : Buffer | null

Decrypt a packet using end-to-end encryption.

Returns: The decrypted packet, or null if the decryption failed but should be ignored

destroy() : void

Resets the session.

encrypt(
packet: Buffer
) : Buffer

Encrypt a packet using end-to-end encryption.

executeTransition(
transitionId: number
) : boolean | undefined

Execute a transition.

getVerificationCode(
userId: string
) : Promise<string>

Gets the verification code for a user in the session.

prepareEpoch() : void

Prepare for a new epoch.

prepareTransition() : boolean

Prepare for a transition.

Returns: Whether we should signal to the voice server that we are ready

processCommit(
payload: Buffer
) : TransitionResult

Processes a commit from the MLS group.

Returns: The transaction id and whether it was successful

processProposals(
payload: Buffer
connectedClients: Set<string>
) : Buffer | undefined

Processes proposals from the MLS group.

Returns: The payload to send back to the voice server, if there is one

processWelcome(
payload: Buffer
) : TransitionResult

Processes a welcome from the MLS group.

Returns: The transaction id and whether it was successful

recoverFromInvalidTransition(
transitionId: number
) : void

Recover from an invalid transition by re-initializing.

reinit() : void

Re-initializes (or initializes) the underlying session.

setExternalSender(
externalSender: Buffer
) : void

Set the external sender for this session.

on(
event: 'error'
listener: (error: Error) => void
) : this