From 17af88919f23b909f7e87eb6bd0877c383c9227d Mon Sep 17 00:00:00 2001 From: Radik Islamov Date: Thu, 1 Aug 2024 19:52:17 +0500 Subject: [PATCH] Add stubs for `TgCrypto` (#12469) --- stubs/TgCrypto/@tests/stubtest_allowlist.txt | 7 +++++++ stubs/TgCrypto/METADATA.toml | 2 ++ stubs/TgCrypto/tgcrypto/__init__.pyi | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100644 stubs/TgCrypto/@tests/stubtest_allowlist.txt create mode 100644 stubs/TgCrypto/METADATA.toml create mode 100644 stubs/TgCrypto/tgcrypto/__init__.pyi diff --git a/stubs/TgCrypto/@tests/stubtest_allowlist.txt b/stubs/TgCrypto/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000..38f87688d --- /dev/null +++ b/stubs/TgCrypto/@tests/stubtest_allowlist.txt @@ -0,0 +1,7 @@ +# stubtest doesn't recognize these function as taking only positional-only arguments. +tgcrypto.cbc256_decrypt +tgcrypto.cbc256_encrypt +tgcrypto.ctr256_decrypt +tgcrypto.ctr256_encrypt +tgcrypto.ige256_decrypt +tgcrypto.ige256_encrypt diff --git a/stubs/TgCrypto/METADATA.toml b/stubs/TgCrypto/METADATA.toml new file mode 100644 index 000000000..e941624c0 --- /dev/null +++ b/stubs/TgCrypto/METADATA.toml @@ -0,0 +1,2 @@ +version = "1.2.*" +upstream_repository = "https://github.com/pyrogram/tgcrypto" diff --git a/stubs/TgCrypto/tgcrypto/__init__.pyi b/stubs/TgCrypto/tgcrypto/__init__.pyi new file mode 100644 index 000000000..ffee3190d --- /dev/null +++ b/stubs/TgCrypto/tgcrypto/__init__.pyi @@ -0,0 +1,8 @@ +from typing_extensions import Buffer + +def ige256_encrypt(data: Buffer, key: Buffer, iv: Buffer, /) -> bytes: ... +def ige256_decrypt(data: Buffer, key: Buffer, iv: Buffer, /) -> bytes: ... +def ctr256_encrypt(data: Buffer, key: Buffer, iv: Buffer, state: Buffer, /) -> bytes: ... +def ctr256_decrypt(data: Buffer, key: Buffer, iv: Buffer, state: Buffer, /) -> bytes: ... +def cbc256_encrypt(data: Buffer, key: Buffer, iv: Buffer, /) -> bytes: ... +def cbc256_decrypt(data: Buffer, key: Buffer, iv: Buffer, /) -> bytes: ...