Skip to content

Commit

Permalink
fix: adding more type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Sep 6, 2023
1 parent e114821 commit c83166b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/joserfc/rfc7517/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
)


GenericKey = t.TypeVar("GenericKey", bound="BaseKey")
NativePrivateKey = t.TypeVar("NativePrivateKey")
NativePublicKey = t.TypeVar("NativePublicKey")
GenericKey = t.TypeVar("GenericKey", bound="BaseKey[t.Any, t.Any]")


class NativeKeyBinding(metaclass=ABCMeta):
Expand All @@ -44,8 +44,12 @@ def import_from_bytes(cls, value: bytes, password: t.Optional[t.Any] = None) ->
pass

@staticmethod
def as_bytes(key: GenericKey, encoding=None, private=None, password=None) -> bytes: # pragma: no cover
return key.raw_value
def as_bytes(
key: GenericKey,
encoding: t.Optional[str] = None,
private: t.Optional[bool] = None,
password: t.Optional[str] = None) -> bytes:
raise NotImplementedError()

@classmethod
def validate_dict_key_registry(cls, dict_key: DictKey, registry: KeyParameterRegistryDict) -> None:
Expand Down Expand Up @@ -288,10 +292,10 @@ def as_bytes(
password: t.Optional[str] = None) -> bytes:
return self.binding.as_bytes(self, encoding, private, password)

def as_pem(self, private=None, password=None) -> bytes:
def as_pem(self, private: t.Optional[bool] = None, password: t.Optional[str] = None) -> bytes:
return self.as_bytes(private=private, password=password)

def as_der(self, private=None, password=None) -> bytes:
def as_der(self, private: t.Optional[bool] = None, password: t.Optional[str] = None) -> bytes:
return self.as_bytes(encoding="DER", private=private, password=password)


Expand Down

0 comments on commit c83166b

Please sign in to comment.