From ed26eced471219009ab2d54f6c1a94dc715d6099 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Thu, 28 Jan 2021 19:38:20 +0200 Subject: [PATCH] cyptography: Add default to few remaining backend= arguments (#4982) This was changed in cryptography 3.1. Most places in typeshed were already correct, fixed few remaining omissions. --- .../hazmat/primitives/serialization/__init__.pyi | 2 +- .../cryptography/hazmat/primitives/twofactor/hotp.pyi | 7 ++++++- .../cryptography/hazmat/primitives/twofactor/totp.pyi | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi b/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi index 93575117d..39d3ad26c 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi @@ -28,7 +28,7 @@ def load_der_public_key( data: bytes, backend: Optional[DERSerializationBackend] = ... ) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey] def load_ssh_public_key( - data: bytes, backend: Union[RSABackend, DSABackend, EllipticCurveBackend, None] + data: bytes, backend: Union[RSABackend, DSABackend, EllipticCurveBackend, None] = ... ) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey, Ed25519PublicKey] class Encoding(Enum): diff --git a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi index e83c3ac92..c1e5607e0 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi @@ -5,7 +5,12 @@ from cryptography.hazmat.primitives.hashes import HashAlgorithm class HOTP(object): def __init__( - self, key: bytes, length: int, algorithm: HashAlgorithm, backend: HMACBackend, enforce_key_length: bool = ... + self, + key: bytes, + length: int, + algorithm: HashAlgorithm, + backend: Optional[HMACBackend] = ..., + enforce_key_length: bool = ..., ): ... def generate(self, counter: int) -> bytes: ... def get_provisioning_uri(self, account_name: str, counter: int, issuer: Optional[str]) -> str: ... diff --git a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi index 306bfe1c1..152591087 100644 --- a/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi +++ b/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi @@ -10,7 +10,7 @@ class TOTP(object): length: int, algorithm: HashAlgorithm, time_step: int, - backend: HMACBackend, + backend: Optional[HMACBackend] = ..., enforce_key_length: bool = ..., ): ... def generate(self, time: int) -> bytes: ...