Skip to content

Commit

Permalink
Address first round of review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaine committed Oct 30, 2019
1 parent 5fd41f9 commit 68457a4
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 99 deletions.
1 change: 1 addition & 0 deletions third_party/2and3/cryptography/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class AlreadyFinalized(Exception): ...
class AlreadyUpdated(Exception): ...
class InvalidKey(Exception): ...
class InvalidSignature(Exception): ...
class InvalidTag(Exception): ...
class NotYetFinalized(Exception): ...
Expand Down
10 changes: 6 additions & 4 deletions third_party/2and3/cryptography/fernet.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from typing import List, Optional

class Fernet:
class InvalidToken(Exception): ...

class Fernet(object):
def __init__(self, key: bytes) -> None: ...
def decrypt(self, token: bytes, ttl: Optional[int]) -> bytes: ...
def decrypt(self, token: bytes, ttl: Optional[int] = ...) -> bytes: ...
def encrypt(self, data: bytes) -> bytes: ...
def extract_timestamp(self, token: bytes) -> int: ...
@classmethod
def generate_key(cls) -> bytes: ...

class MultiFernet:
class MultiFernet(object):
def __init__(self, fernets: List[Fernet]) -> None: ...
def decrypt(self, token: bytes, ttl: Optional[int]) -> bytes: ...
def decrypt(self, token: bytes, ttl: Optional[int] = ...) -> bytes: ...
def encrypt(self, data: bytes) -> bytes: ...
def rotate(self, msg: bytes) -> bytes: ...
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any
from typing import Any, Optional

class Binding:
ffi: Any
lib: Any
class Binding(object):
ffi: Optional[Any]
lib: Optional[Any]
def init_static_locks(self) -> None: ...
31 changes: 20 additions & 11 deletions third_party/2and3/cryptography/hazmat/primitives/asymmetric/dh.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ class DHParameters(metaclass=ABCMeta):

DHParametersWithSerialization = DHParameters

class DHParameterNumbers:
p: int
g: int
q: int
class DHParameterNumbers(object):
@property
def p(self) -> int: ...
@property
def g(self) -> int: ...
@property
def q(self) -> int: ...
def __init__(self, p: int, g: int, q: Optional[int]) -> None: ...
def parameters(self, backend: DHBackend) -> DHParameters: ...

Expand All @@ -44,14 +47,18 @@ class DHPrivateKeyWithSerialization(DHPrivateKey):
@abstractmethod
def private_numbers(self) -> DHPrivateNumbers: ...

class DHPrivateNumbers:
public_numbers: DHPublicNumbers
x: int
class DHPrivateNumbers(object):
@property
def public_numbers(self) -> DHPublicNumbers: ...
@property
def x(self) -> int: ...
def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: ...
def private_key(self, backend: DHBackend) -> DHPrivateKey: ...

class DHPublicKey(metaclass=ABCMeta):
key_size: int
@property
@abstractmethod
def key_size(self) -> int: ...
@abstractmethod
def parameters(self) -> DHParameters: ...
@abstractmethod
Expand All @@ -61,8 +68,10 @@ class DHPublicKey(metaclass=ABCMeta):

DHPublicKeyWithSerialization = DHPublicKey

class DHPublicNumbers:
parameter_numbers: DHParameterNumbers
y: int
class DHPublicNumbers(object):
@property
def parameter_numbers(self) -> DHParameterNumbers: ...
@property
def y(self) -> int: ...
def __init__(self, y: int, parameter_numbers: DHParameterNumbers) -> None: ...
def public_key(self, backend: DHBackend) -> DHPublicKey: ...
35 changes: 23 additions & 12 deletions third_party/2and3/cryptography/hazmat/primitives/asymmetric/dsa.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ class DSAParametersWithNumbers(DSAParameters):
@abstractmethod
def parameter_numbers(self) -> DSAParameterNumbers: ...

class DSAParameterNumbers:
p: int
q: int
g: int
class DSAParameterNumbers(object):
@property
def p(self) -> int: ...
@property
def q(self) -> int: ...
@property
def g(self) -> int: ...
def __init__(self, p: int, q: int, g: int) -> None: ...
def parameters(self, backend: DSABackend) -> DSAParameters: ...

class DSAPrivateKey(metaclass=ABCMeta):
key_size: int
@property
@abstractmethod
def key_size(self) -> int: ...
@abstractmethod
def parameters(self) -> DSAParameters: ...
@abstractmethod
Expand All @@ -37,13 +42,17 @@ class DSAPrivateKeyWithSerialization(DSAPrivateKey):
@abstractmethod
def private_numbers(self) -> DSAPrivateNumbers: ...

class DSAPrivateNumbers:
x: int
public_numbers: DSAPublicNumbers
class DSAPrivateNumbers(object):
@property
def x(self) -> int: ...
@property
def public_numbers(self) -> DSAPublicNumbers: ...
def __init__(self, x: int, public_numbers: DSAPublicNumbers) -> None: ...

class DSAPublicKey(metaclass=ABCMeta):
key_size: int
@property
@abstractmethod
def key_size(self) -> int: ...
@abstractmethod
def public_bytes(self, encoding: Encoding, format: PublicFormat) -> bytes: ...
@abstractmethod
Expand All @@ -55,9 +64,11 @@ class DSAPublicKey(metaclass=ABCMeta):

DSAPublicKeyWithSerialization = DSAPublicKey

class DSAPublicNumbers:
y: int
parameter_numbers: DSAParameterNumbers
class DSAPublicNumbers(object):
@property
def y(self) -> int: ...
@property
def parameter_numbers(self) -> DSAParameterNumbers: ...
def __init__(self, y: int, parameter_numbers: DSAParameterNumbers) -> None: ...

def generate_parameters(key_size: int, backend: DSABackend) -> DSAParameters: ...
Expand Down
Loading

0 comments on commit 68457a4

Please sign in to comment.