Skip to content

Commit a487a78

Browse files
committed
Add type definitions for the crypto data types
1 parent f06a72b commit a487a78

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

kitty/fast_data_types.pyi

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,3 +1413,56 @@ def remove_signal_handlers() -> None:
14131413

14141414
def getpeereid(fd: int) -> Tuple[int, int]:
14151415
pass
1416+
1417+
1418+
X25519: int
1419+
SHA1_HASH: int
1420+
SHA224_HASH: int
1421+
SHA256_HASH: int
1422+
SHA384_HASH: int
1423+
SHA512_HASH: int
1424+
1425+
1426+
class Secret:
1427+
pass
1428+
1429+
1430+
class EllipticCurveKey:
1431+
1432+
def __init__(
1433+
self, algorithm: int = 0 # X25519
1434+
): pass
1435+
1436+
def derive_secret(
1437+
self, pubkey: bytes, hash_algorithm: int = 0 # SHA256_HASH
1438+
) -> Secret: pass
1439+
1440+
@property
1441+
def public(self) -> bytes: ...
1442+
1443+
@property
1444+
def private(self) -> Secret: ...
1445+
1446+
1447+
class AES256GCMEncrypt:
1448+
1449+
def __init__(self, key: Secret): ...
1450+
1451+
def add_authenticated_but_unencrypted_data(self, data: bytes) -> None: ...
1452+
1453+
def add_data_to_be_encrypted(self, data: bytes, finished: bool = False) -> bytes: ...
1454+
1455+
@property
1456+
def iv(self) -> bytes: ...
1457+
1458+
@property
1459+
def tag(self) -> bytes: ...
1460+
1461+
1462+
class AES256GCMDecrypt:
1463+
1464+
def __init__(self, key: Secret, iv: bytes, tag: bytes): ...
1465+
1466+
def add_data_to_be_authenticated_but_not_decrypted(self, data: bytes) -> None: ...
1467+
1468+
def add_data_to_be_decrypted(self, data: bytes, finished: bool = False) -> bytes: ...

0 commit comments

Comments
 (0)