mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
11
third_party/3/jwt/algorithms.pyi
vendored
11
third_party/3/jwt/algorithms.pyi
vendored
@@ -44,11 +44,6 @@ class NoneAlgorithm(Algorithm[None]):
|
||||
class _HashAlg:
|
||||
def __call__(self, arg: Union[bytes, bytearray, memoryview] = ...) -> _Hash: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_LoadsString = Union[str, bytes, bytearray]
|
||||
else:
|
||||
_LoadsString = str
|
||||
|
||||
class HMACAlgorithm(Algorithm[bytes]):
|
||||
SHA256: ClassVar[_HashAlg]
|
||||
SHA384: ClassVar[_HashAlg]
|
||||
@@ -59,7 +54,7 @@ class HMACAlgorithm(Algorithm[bytes]):
|
||||
@staticmethod
|
||||
def to_jwk(key_obj: Union[str, bytes]) -> str: ...
|
||||
@staticmethod
|
||||
def from_jwk(jwk: _LoadsString) -> bytes: ...
|
||||
def from_jwk(jwk: Union[str, bytes]) -> bytes: ...
|
||||
|
||||
# Only defined if cryptography is installed.
|
||||
class RSAAlgorithm(Algorithm[Any]):
|
||||
@@ -70,7 +65,7 @@ class RSAAlgorithm(Algorithm[Any]):
|
||||
def __init__(self, hash_alg: Union[HashAlgorithm, Prehashed]) -> None: ...
|
||||
def prepare_key(self, key: Union[bytes, str, RSAPrivateKey, RSAPublicKey]) -> Union[RSAPrivateKey, RSAPublicKey]: ...
|
||||
@staticmethod
|
||||
def from_jwk(jwk: Union[_LoadsString, Dict[str, Any]]) -> Union[RSAPrivateKey, RSAPublicKey]: ...
|
||||
def from_jwk(jwk: Union[str, bytes, Dict[str, Any]]) -> Union[RSAPrivateKey, RSAPublicKey]: ...
|
||||
def sign(self, msg: bytes, key: RSAPrivateKey) -> bytes: ...
|
||||
def verify(self, msg: bytes, key: RSAPublicKey, sig: bytes) -> bool: ...
|
||||
|
||||
@@ -87,7 +82,7 @@ class ECAlgorithm(Algorithm[Any]):
|
||||
@staticmethod
|
||||
def to_jwk(key_obj: Union[EllipticCurvePrivateKeyWithSerialization, EllipticCurvePublicKeyWithSerialization]) -> str: ...
|
||||
@staticmethod
|
||||
def from_jwk(jwk: _LoadsString) -> Union[EllipticCurvePrivateKey, EllipticCurvePublicKey]: ...
|
||||
def from_jwk(jwk: Union[str, bytes]) -> Union[EllipticCurvePrivateKey, EllipticCurvePublicKey]: ...
|
||||
def sign(self, msg: bytes, key: EllipticCurvePrivateKey) -> bytes: ...
|
||||
def verify(self, msg: bytes, key: EllipticCurvePublicKey, sig: bytes) -> bool: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user