VoiceGroupCryptoTrait
Provides group-based AEAD encryption and decryption for Discord voice RTP packets.
Tags
Table of Contents
Properties
- $secret_key : string
- $mode : string
Methods
- decryptRTPPacket() : string|false
- Decrypt an RTP packet (header + encrypted payload).
- encryptRTPPacket() : string
- Encrypt an RTP packet (header + Opus payload).
- buildNonce() : string
- Build a nonce for RTP-style AEAD.
- decrypt() : string|false
- Decrypt a message from Discord's MLS Group.
- encrypt() : string
- Encrypt a message for Discord's MLS Group.
Properties
$secret_key
public
string
$secret_key
The group secret used for key derivation.
$mode
protected
string
$mode
Methods
decryptRTPPacket()
Decrypt an RTP packet (header + encrypted payload).
public
decryptRTPPacket(VoicePacket $packet[, int $seq = 0 ]) : string|false
Parameters
- $packet : VoicePacket
- $seq : int = 0
Return values
string|falseencryptRTPPacket()
Encrypt an RTP packet (header + Opus payload).
public
encryptRTPPacket(VoicePacket $packet[, int $seq = 0 ]) : string
Parameters
- $packet : VoicePacket
- $seq : int = 0
-
Sequence number for AES-GCM mode
Return values
stringbuildNonce()
Build a nonce for RTP-style AEAD.
protected
buildNonce([string $header = '' ][, int $seq = 0 ]) : string
Parameters
- $header : string = ''
- $seq : int = 0
Return values
stringdecrypt()
Decrypt a message from Discord's MLS Group.
protected
decrypt(string $ciphertext[, string $header = '' ][, int $seq = 0 ]) : string|false
Parameters
- $ciphertext : string
- $header : string = ''
-
Optional RTP header
- $seq : int = 0
-
Optional sequence number
Return values
string|falseencrypt()
Encrypt a message for Discord's MLS Group.
protected
encrypt(string $plaintext[, string $header = '' ][, int $seq = 0 ]) : string
Parameters
- $plaintext : string
- $header : string = ''
-
Optional 12-byte RTP header (for RTP-style nonce)
- $seq : int = 0
-
Optional sequence number (for AES-GCM)