Skip to content

Commit 1ff9a19

Browse files
style(pre-commit): auto fixes from pre-commit.com hooks
1 parent 5a62808 commit 1ff9a19

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
@@ -32,7 +32,10 @@
3232
from .snowflake import Snowflake
3333

3434
SupportedModes = Literal[
35-
"xsalsa20_poly1305_lite", "xsalsa20_poly1305_suffix", "xsalsa20_poly1305", "aead_xchacha20_poly1305_rtpsize"
35+
"xsalsa20_poly1305_lite",
36+
"xsalsa20_poly1305_suffix",
37+
"xsalsa20_poly1305",
38+
"aead_xchacha20_poly1305_rtpsize",
3639
]
3740

3841

discord/voice_client.py

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

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

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

602606
def _decrypt_xsalsa20_poly1305(self, header, data):
603607
# Deprecated, remove in 2.7
@@ -635,7 +639,9 @@ def _decrypt_aead_xchacha20_poly1305_rtpsize(self, header, data):
635639
nonce[:4] = data[-4:]
636640
data = data[:-4]
637641

638-
return self.strip_header_ext(box.decrypt(bytes(data), bytes(header), bytes(nonce)))
642+
return self.strip_header_ext(
643+
box.decrypt(bytes(data), bytes(header), bytes(nonce))
644+
)
639645

640646
@staticmethod
641647
def strip_header_ext(data):

0 commit comments

Comments
 (0)