mirror of https://github.com/nucypher/pyUmbral.git
Some type hint and docstring fixes
parent
104d1a4c20
commit
70fb1157b5
|
@ -56,7 +56,7 @@ A delegating key pair and a signing key pair.
|
|||
Encrypt with a public key
|
||||
--------------------------
|
||||
Now let's encrypt data with Alice's public key.
|
||||
Invocation of :py:func:`encrypt` returns both a ``capsule`` and a ``ciphertext``.
|
||||
Invocation of :py:func:`umbral.encrypt` returns both a ``capsule`` and a ``ciphertext``.
|
||||
Note that anyone with Alice's public key can perform this operation.
|
||||
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ class Deserializable(HasSerializedSize):
|
|||
A mixin for composable deserialization.
|
||||
"""
|
||||
|
||||
_T = TypeVar('_T', bound='Deserializable')
|
||||
Self = TypeVar('Self', bound='Deserializable')
|
||||
|
||||
@classmethod
|
||||
def from_bytes(cls: Type[_T], data: bytes) -> _T:
|
||||
def from_bytes(cls: Type[Self], data: bytes) -> Self:
|
||||
"""
|
||||
Restores the object from serialized bytes.
|
||||
"""
|
||||
|
@ -64,7 +64,7 @@ class Deserializable(HasSerializedSize):
|
|||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def _from_exact_bytes(cls: Type[_T], data: bytes) -> _T:
|
||||
def _from_exact_bytes(cls: Type[Self], data: bytes) -> Self:
|
||||
"""
|
||||
Deserializes the object from a bytestring of exactly the expected length
|
||||
(defined by ``serialized_size()``).
|
||||
|
|
|
@ -22,7 +22,7 @@ class Signer:
|
|||
def __init__(self, secret_key: SecretKey):
|
||||
self.__secret_key = secret_key
|
||||
|
||||
def sign_digest(self, digest: 'Hash') -> 'Signature':
|
||||
def sign_digest(self, digest: Hash) -> 'Signature':
|
||||
|
||||
secret_bn = self.__secret_key.secret_scalar()._backend_bignum
|
||||
r_int, s_int = openssl.ecdsa_sign(curve=CURVE,
|
||||
|
@ -75,7 +75,7 @@ class Signature(Serializable, Deserializable):
|
|||
self.r = r
|
||||
self.s = s
|
||||
|
||||
def verify_digest(self, verifying_key: 'PublicKey', digest: 'Hash') -> bool:
|
||||
def verify_digest(self, verifying_key: PublicKey, digest: Hash) -> bool:
|
||||
return openssl.ecdsa_verify(curve=CURVE,
|
||||
sig_r=int(self.r),
|
||||
sig_s=int(self.s),
|
||||
|
|
Loading…
Reference in New Issue