Skip to content

RtpCrypto

Handles RTP packet encryption and decryption for a voice connection. Owns the session secret key, encryption mode selection, and all sequence, timestamp, and nonce counters.

RtpCrypto.secretKey  :: buffer?
RtpCrypto.encryptionMode  :: string?
RtpCrypto.rtpSequence  :: number
RtpCrypto.rtpTimestamp  :: number
RtpCrypto.rtpNonceCounter  :: number
RtpCrypto : encryptRtp ( rtpPacket daveEncryptor ssrc )  -> buffer

Encrypts an RTP packet. If a DAVE encryptor with an active key ratchet is provided, the Opus payload is DAVE-encrypted before the session cipher is applied.

Parameters

rtpPacket: buffer
daveEncryptor: Encryptor?
ssrc: number

Returns

buffer
RtpCrypto : decryptRtp ( rtpPacket ssrcToUserId daveDecryptors )  -> buffer

Decrypts an RTP packet using the session cipher. Handles RTP header extensions and padding, then optionally DAVE-decrypts the Opus payload using the per-user decryptor for the sender’s SSRC.

Parameters

rtpPacket: buffer
ssrcToUserId: {
{ [number]: string } }
daveDecryptors: {
{ [string]: dave.Decryptor } }

Returns

buffer
RtpCrypto : reset ( )  -> ()

Clears the secret key and encryption mode, and resets all sequence, timestamp, and nonce counters to zero.

RtpCrypto . new ( )  -> RtpCrypto

Responsible for constructing this class.

Returns

RtpCrypto