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.
Summary
Properties
RtpCrypto.secretKey :: buffer?RtpCrypto.encryptionMode :: string?RtpCrypto.rtpSequence :: numberRtpCrypto.rtpTimestamp :: numberRtpCrypto.rtpNonceCounter :: numberMethods
RtpCrypto:encryptRtp(rtpPacket: buffer, daveEncryptor: dave.Encryptor?, ssrc: number) → bufferRtpCrypto:decryptRtp(rtpPacket: buffer, ssrcToUserId: { [number]: string }, daveDecryptors: { [string]: dave.Decryptor }) → bufferRtpCrypto:reset()Functions
RtpCrypto.new() → RtpCryptoProperties
Section titled “Properties”secretKey
Section titled “secretKey” RtpCrypto.secretKey :: buffer?
encryptionMode
Section titled “encryptionMode”rtpSequence
Section titled “rtpSequence”rtpTimestamp
Section titled “rtpTimestamp”rtpNonceCounter
Section titled “rtpNonceCounter”Methods
Section titled “Methods”encryptRtp
Section titled “encryptRtp”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 |
decryptRtp
Section titled “decryptRtp”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.
Functions
Section titled “Functions”RtpCrypto . new ( ) -> RtpCrypto
Responsible for constructing this class.
Returns
| RtpCrypto |