From 1ff9a196b7283da701fa1efd1731e4fafca1ff10 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 17 Nov 2024 02:38:16 +0000 Subject: [PATCH] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/types/voice.py | 5 ++++- discord/voice_client.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/discord/types/voice.py b/discord/types/voice.py index 8cc5bd6a1d..899719185c 100644 --- a/discord/types/voice.py +++ b/discord/types/voice.py @@ -32,7 +32,10 @@ from .snowflake import Snowflake SupportedModes = Literal[ - "xsalsa20_poly1305_lite", "xsalsa20_poly1305_suffix", "xsalsa20_poly1305", "aead_xchacha20_poly1305_rtpsize" + "xsalsa20_poly1305_lite", + "xsalsa20_poly1305_suffix", + "xsalsa20_poly1305", + "aead_xchacha20_poly1305_rtpsize", ] diff --git a/discord/voice_client.py b/discord/voice_client.py index 77e193ec9b..341c7f6828 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -594,10 +594,14 @@ def _encrypt_aead_xchacha20_poly1305_rtpsize(self, header: bytes, data) -> bytes box = nacl.secret.Aead(bytes(self.secret_key)) nonce = bytearray(24) - nonce[:4] = struct.pack('>I', self._lite_nonce) - self.checked_add('_lite_nonce', 1, 4294967295) + nonce[:4] = struct.pack(">I", self._lite_nonce) + self.checked_add("_lite_nonce", 1, 4294967295) - return header + box.encrypt(bytes(data), bytes(header), bytes(nonce)).ciphertext + nonce[:4] + return ( + header + + box.encrypt(bytes(data), bytes(header), bytes(nonce)).ciphertext + + nonce[:4] + ) def _decrypt_xsalsa20_poly1305(self, header, data): # Deprecated, remove in 2.7 @@ -635,7 +639,9 @@ def _decrypt_aead_xchacha20_poly1305_rtpsize(self, header, data): nonce[:4] = data[-4:] data = data[:-4] - return self.strip_header_ext(box.decrypt(bytes(data), bytes(header), bytes(nonce))) + return self.strip_header_ext( + box.decrypt(bytes(data), bytes(header), bytes(nonce)) + ) @staticmethod def strip_header_ext(data):