Skip to content

Commit 756de66

Browse files
pre-commit-ci[bot]Lulalaby
authored andcommitted
style(pre-commit): auto fixes from pre-commit.com hooks
1 parent b91ef85 commit 756de66

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

discord/types/voice.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
from .snowflake import Snowflake
3434

3535
SupportedModes = Literal[
36-
"xsalsa20_poly1305_lite", "xsalsa20_poly1305_suffix", "xsalsa20_poly1305", "aead_xchacha20_poly1305_rtpsize"
36+
"xsalsa20_poly1305_lite",
37+
"xsalsa20_poly1305_suffix",
38+
"xsalsa20_poly1305",
39+
"aead_xchacha20_poly1305_rtpsize",
3740
]
3841

3942

discord/voice_client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,14 @@ def _encrypt_aead_xchacha20_poly1305_rtpsize(self, header: bytes, data) -> bytes
595595
box = nacl.secret.Aead(bytes(self.secret_key))
596596
nonce = bytearray(24)
597597

598-
nonce[:4] = struct.pack('>I', self._lite_nonce)
599-
self.checked_add('_lite_nonce', 1, 4294967295)
598+
nonce[:4] = struct.pack(">I", self._lite_nonce)
599+
self.checked_add("_lite_nonce", 1, 4294967295)
600600

601-
return header + box.encrypt(bytes(data), bytes(header), bytes(nonce)).ciphertext + nonce[:4]
601+
return (
602+
header
603+
+ box.encrypt(bytes(data), bytes(header), bytes(nonce)).ciphertext
604+
+ nonce[:4]
605+
)
602606

603607
def _decrypt_xsalsa20_poly1305(self, header, data):
604608
# Deprecated, remove in 2.7
@@ -636,7 +640,9 @@ def _decrypt_aead_xchacha20_poly1305_rtpsize(self, header, data):
636640
nonce[:4] = data[-4:]
637641
data = data[:-4]
638642

639-
return self.strip_header_ext(box.decrypt(bytes(data), bytes(header), bytes(nonce)))
643+
return self.strip_header_ext(
644+
box.decrypt(bytes(data), bytes(header), bytes(nonce))
645+
)
640646

641647
@staticmethod
642648
def strip_header_ext(data):

0 commit comments

Comments
 (0)