mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-09 06:46:18 +08:00
[Authlib] Annotate more (#15203)
This commit is contained in:
@@ -10,6 +10,9 @@ authlib.jose.rfc7518.AESAlgorithm.description
|
||||
authlib.jose.rfc7518.AESAlgorithm.name
|
||||
authlib.jose.rfc7518.ECDHESAlgorithm.description
|
||||
authlib.jose.rfc7518.ECDHESAlgorithm.name
|
||||
authlib.jose.rfc7518.CBCHS2EncAlgorithm.CEK_SIZE
|
||||
authlib.jose.rfc7518.CBCHS2EncAlgorithm.description
|
||||
authlib.jose.rfc7518.CBCHS2EncAlgorithm.name
|
||||
authlib.jose.rfc7518.jwe_algs.AESAlgorithm.description
|
||||
authlib.jose.rfc7518.jwe_algs.AESAlgorithm.name
|
||||
authlib.jose.rfc7518.jwe_algs.AESGCMAlgorithm.description
|
||||
@@ -18,6 +21,20 @@ authlib.jose.rfc7518.jwe_algs.ECDHESAlgorithm.description
|
||||
authlib.jose.rfc7518.jwe_algs.ECDHESAlgorithm.name
|
||||
authlib.jose.rfc7518.jwe_algs.RSAAlgorithm.description
|
||||
authlib.jose.rfc7518.jwe_algs.RSAAlgorithm.name
|
||||
authlib.jose.rfc7518.jwe_encs.CBCHS2EncAlgorithm.CEK_SIZE
|
||||
authlib.jose.rfc7518.jwe_encs.CBCHS2EncAlgorithm.description
|
||||
authlib.jose.rfc7518.jwe_encs.CBCHS2EncAlgorithm.name
|
||||
authlib.jose.rfc7518.jwe_encs.GCMEncAlgorithm.CEK_SIZE
|
||||
authlib.jose.rfc7518.jwe_encs.GCMEncAlgorithm.description
|
||||
authlib.jose.rfc7518.jwe_encs.GCMEncAlgorithm.name
|
||||
authlib.jose.rfc7518.jws_algs.ECAlgorithm.description
|
||||
authlib.jose.rfc7518.jws_algs.ECAlgorithm.name
|
||||
authlib.jose.rfc7518.jws_algs.HMACAlgorithm.description
|
||||
authlib.jose.rfc7518.jws_algs.HMACAlgorithm.name
|
||||
authlib.jose.rfc7518.jws_algs.RSAAlgorithm.description
|
||||
authlib.jose.rfc7518.jws_algs.RSAAlgorithm.name
|
||||
authlib.jose.rfc7518.jws_algs.RSAPSSAlgorithm.description
|
||||
authlib.jose.rfc7518.jws_algs.RSAPSSAlgorithm.name
|
||||
|
||||
# Methods whose *args and **kwargs arguments are added dynamically due to the @hooked decorator:
|
||||
authlib.oauth2.rfc6749.AuthorizationCodeGrant.create_token_response
|
||||
|
||||
@@ -11,7 +11,7 @@ _ExplodedQueryString: TypeAlias = list[tuple[str, str]]
|
||||
def url_encode(params: _ExplodedQueryString) -> str: ...
|
||||
def url_decode(query: str) -> _ExplodedQueryString: ...
|
||||
def add_params_to_qs(query: str, params: _ExplodedQueryString) -> str: ...
|
||||
def add_params_to_uri(uri: str, params: _ExplodedQueryString, fragment: bool = False): ...
|
||||
def add_params_to_uri(uri: str, params: _ExplodedQueryString, fragment: bool = False) -> str: ...
|
||||
def quote(s: str, safe: bytes = b"/") -> str: ...
|
||||
def unquote(s: str | bytes) -> str: ...
|
||||
def quote_url(s: str) -> str: ...
|
||||
|
||||
@@ -21,7 +21,7 @@ class OAuth2Session(OAuth2Client):
|
||||
client_auth_class = OAuth2ClientAuth
|
||||
token_auth_class = OAuth2Auth
|
||||
oauth_error_class = OAuthError # type: ignore[assignment]
|
||||
SESSION_REQUEST_PARAMS: tuple[str, ...]
|
||||
SESSION_REQUEST_PARAMS: tuple[str, ...] # type: ignore[assignment]
|
||||
default_timeout: Incomplete
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -3,16 +3,18 @@ from collections.abc import Iterable
|
||||
from typing import ClassVar, Final
|
||||
|
||||
from authlib.jose.rfc7516 import JWEAlgorithmWithTagAwareKeyAgreement
|
||||
from authlib.jose.rfc7518 import AESAlgorithm, ECKey
|
||||
from authlib.jose.rfc8037 import OKPKey
|
||||
|
||||
class ECDH1PUAlgorithm(JWEAlgorithmWithTagAwareKeyAgreement):
|
||||
EXTRA_HEADERS: ClassVar[Iterable[str]]
|
||||
ALLOWED_KEY_CLS: Incomplete
|
||||
ALLOWED_KEY_CLS: tuple[type, ...]
|
||||
name: str
|
||||
description: str
|
||||
key_size: Incomplete
|
||||
aeskw: Incomplete
|
||||
aeskw: AESAlgorithm
|
||||
def __init__(self, key_size=None) -> None: ...
|
||||
def prepare_key(self, raw_data): ...
|
||||
def prepare_key(self, raw_data) -> ECKey | OKPKey: ...
|
||||
def generate_preset(self, enc_alg, key) -> dict[str, Incomplete]: ...
|
||||
def compute_shared_key(self, shared_key_e, shared_key_s): ...
|
||||
def compute_fixed_info(self, headers, bit_size, tag) -> bytes: ...
|
||||
@@ -22,7 +24,7 @@ class ECDH1PUAlgorithm(JWEAlgorithmWithTagAwareKeyAgreement):
|
||||
self, recipient_key, sender_static_pubkey, sender_ephemeral_pubkey, headers, bit_size, tag
|
||||
) -> bytes: ...
|
||||
def generate_keys_and_prepare_headers(self, enc_alg, key, sender_key, preset=None) -> dict[str, Incomplete]: ...
|
||||
def agree_upon_key_and_wrap_cek(self, enc_alg, headers, key, sender_key, epk, cek, tag): ...
|
||||
def agree_upon_key_and_wrap_cek(self, enc_alg, headers, key, sender_key, epk, cek, tag) -> dict[str, Incomplete]: ...
|
||||
def wrap(self, enc_alg, headers, key, sender_key, preset=None) -> dict[str, Incomplete]: ...
|
||||
def unwrap(self, enc_alg, ek, headers, key, sender_key, tag=None) -> bytes: ...
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@ class XC20PEncAlgorithm(JWEEncAlgorithm):
|
||||
key_size: Incomplete
|
||||
CEK_SIZE: Incomplete
|
||||
def __init__(self, key_size) -> None: ...
|
||||
def encrypt(self, msg, aad, iv, key): ...
|
||||
def decrypt(self, ciphertext, aad, iv, tag, key): ...
|
||||
def encrypt(self, msg, aad, iv, key) -> tuple[bytes, bytes]: ...
|
||||
def decrypt(self, ciphertext, aad, iv, tag, key) -> bytes: ...
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import Incomplete, ReadableBuffer
|
||||
from collections.abc import Iterable
|
||||
from typing import SupportsBytes, SupportsIndex
|
||||
|
||||
from .models import JWSObject
|
||||
from .models import JWSAlgorithm, JWSObject
|
||||
|
||||
class JsonWebSignature:
|
||||
REGISTERED_HEADER_PARAMETER_NAMES: frozenset[str]
|
||||
MAX_CONTENT_LENGTH: int
|
||||
ALGORITHMS_REGISTRY: dict[str, Incomplete]
|
||||
ALGORITHMS_REGISTRY: dict[str, JWSAlgorithm]
|
||||
def __init__(self, algorithms=None, private_headers=None) -> None: ...
|
||||
@classmethod
|
||||
def register_algorithm(cls, algorithm) -> None: ...
|
||||
def register_algorithm(cls, algorithm: JWSAlgorithm) -> None: ...
|
||||
def serialize_compact(self, protected, payload, key) -> bytes: ...
|
||||
def deserialize_compact(self, s, key, decode=None) -> JWSObject: ...
|
||||
def serialize_json(self, header_obj, payload, key): ...
|
||||
def deserialize_compact(
|
||||
self, s: str | bytes | float | Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer, key, decode=None
|
||||
) -> JWSObject: ...
|
||||
def serialize_json(self, header_obj, payload, key) -> dict[str, Incomplete]: ...
|
||||
def deserialize_json(self, obj, key, decode=None) -> JWSObject: ...
|
||||
def serialize(self, header, payload, key): ...
|
||||
def serialize(self, header, payload, key) -> dict[str, Incomplete] | bytes: ...
|
||||
def deserialize(self, s, key, decode=None) -> JWSObject: ...
|
||||
|
||||
@@ -2,8 +2,8 @@ from _typeshed import Incomplete
|
||||
from typing_extensions import Self
|
||||
|
||||
class JWSAlgorithm:
|
||||
name: Incomplete
|
||||
description: Incomplete
|
||||
name: str | None
|
||||
description: str | None
|
||||
algorithm_type: str
|
||||
algorithm_location: str
|
||||
def prepare_key(self, raw_data): ...
|
||||
@@ -20,7 +20,7 @@ class JWSHeader(dict[str, object]):
|
||||
class JWSObject(dict[str, object]):
|
||||
header: Incomplete
|
||||
payload: Incomplete
|
||||
type: Incomplete
|
||||
type: str
|
||||
def __init__(self, header, payload, type: str = "compact") -> None: ...
|
||||
@property
|
||||
def headers(self): ...
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import Incomplete, ReadableBuffer
|
||||
from collections import OrderedDict
|
||||
from collections.abc import Iterable
|
||||
from typing import SupportsBytes, SupportsIndex
|
||||
|
||||
from .models import JWEAlgorithmBase, JWEEncAlgorithm, JWEZipAlgorithm
|
||||
|
||||
class JsonWebEncryption:
|
||||
REGISTERED_HEADER_PARAMETER_NAMES: frozenset[str]
|
||||
ALG_REGISTRY: dict[Incomplete, Incomplete]
|
||||
ENC_REGISTRY: dict[Incomplete, Incomplete]
|
||||
ZIP_REGISTRY: dict[Incomplete, Incomplete]
|
||||
ALG_REGISTRY: dict[str, JWEAlgorithmBase]
|
||||
ENC_REGISTRY: dict[str, JWEEncAlgorithm]
|
||||
ZIP_REGISTRY: dict[str, JWEZipAlgorithm]
|
||||
def __init__(self, algorithms=None, private_headers=None) -> None: ...
|
||||
@classmethod
|
||||
def register_algorithm(cls, algorithm) -> None: ...
|
||||
def register_algorithm(cls, algorithm: JWEAlgorithmBase | JWEEncAlgorithm | JWEZipAlgorithm) -> None: ...
|
||||
def serialize_compact(self, protected, payload, key, sender_key=None) -> bytes: ...
|
||||
def serialize_json(self, header_obj, payload, keys, sender_key=None) -> OrderedDict[Incomplete, Incomplete]: ...
|
||||
def serialize(self, header, payload, key, sender_key=None): ...
|
||||
def deserialize_compact(self, s, key, decode=None, sender_key=None): ...
|
||||
def serialize(self, header, payload, key, sender_key=None) -> OrderedDict[Incomplete, Incomplete] | bytes: ...
|
||||
def deserialize_compact(
|
||||
self,
|
||||
s: str | bytes | float | Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer,
|
||||
key,
|
||||
decode=None,
|
||||
sender_key=None,
|
||||
) -> dict[str, Incomplete]: ...
|
||||
def deserialize_json(self, obj, key, decode=None, sender_key=None) -> dict[str, Incomplete]: ...
|
||||
def deserialize(self, obj, key, decode=None, sender_key=None): ...
|
||||
def deserialize(self, obj, key, decode=None, sender_key=None) -> dict[str, Incomplete]: ...
|
||||
@staticmethod
|
||||
def parse_json(obj) -> dict[Incomplete, Incomplete]: ...
|
||||
def get_header_alg(self, header): ...
|
||||
def get_header_enc(self, header): ...
|
||||
def get_header_zip(self, header): ...
|
||||
def get_header_alg(self, header) -> JWEAlgorithmBase: ...
|
||||
def get_header_enc(self, header) -> JWEEncAlgorithm: ...
|
||||
def get_header_zip(self, header) -> JWEZipAlgorithm: ...
|
||||
|
||||
def prepare_key(alg, header, key): ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Incomplete
|
||||
from abc import ABCMeta
|
||||
from collections.abc import Iterable
|
||||
from collections.abc import Iterable, Sized
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
@@ -28,13 +28,13 @@ class JWEEncAlgorithm:
|
||||
description: str | None
|
||||
algorithm_type: str
|
||||
algorithm_location: str
|
||||
IV_SIZE: Incomplete
|
||||
CEK_SIZE: Incomplete
|
||||
def generate_cek(self): ...
|
||||
def generate_iv(self): ...
|
||||
def check_iv(self, iv) -> None: ...
|
||||
def encrypt(self, msg, aad, iv, key): ...
|
||||
def decrypt(self, ciphertext, aad, iv, tag, key): ...
|
||||
IV_SIZE: int | None
|
||||
CEK_SIZE: int | None
|
||||
def generate_cek(self) -> bytes: ...
|
||||
def generate_iv(self) -> bytes: ...
|
||||
def check_iv(self, iv: Sized) -> None: ...
|
||||
def encrypt(self, msg, aad, iv, key) -> tuple[bytes, bytes]: ...
|
||||
def decrypt(self, ciphertext, aad, iv, tag, key) -> bytes: ...
|
||||
|
||||
class JWEZipAlgorithm:
|
||||
name: Incomplete
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
from _typeshed import Incomplete, ReadableBuffer
|
||||
from collections.abc import Iterable
|
||||
from typing import ClassVar, Literal, SupportsBytes, SupportsIndex
|
||||
from typing_extensions import Self
|
||||
|
||||
from authlib.jose.rfc7517 import Key
|
||||
@@ -26,9 +27,22 @@ class AsymmetricKey(Key):
|
||||
def load_public_key(self): ...
|
||||
def as_dict(self, is_private: bool = False, **params) -> dict[Incomplete, Incomplete]: ...
|
||||
def as_key(self, is_private: bool = False): ...
|
||||
def as_bytes(self, encoding=None, is_private: bool = False, password=None): ...
|
||||
def as_pem(self, is_private: bool = False, password=None): ...
|
||||
def as_der(self, is_private: bool = False, password=None): ...
|
||||
def as_bytes(
|
||||
self,
|
||||
encoding: Literal["PEM", "DER"] | None = None,
|
||||
is_private: bool = False,
|
||||
password: str | bytes | float | Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer | None = None,
|
||||
): ...
|
||||
def as_pem(
|
||||
self,
|
||||
is_private: bool = False,
|
||||
password: str | bytes | float | Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer | None = None,
|
||||
): ...
|
||||
def as_der(
|
||||
self,
|
||||
is_private: bool = False,
|
||||
password: str | bytes | float | Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer | None = None,
|
||||
): ...
|
||||
@classmethod
|
||||
def import_dict_key(cls, raw, options=None) -> Self: ...
|
||||
@classmethod
|
||||
|
||||
@@ -7,7 +7,7 @@ class Key:
|
||||
PRIVATE_KEY_OPS: ClassVar[list[str]]
|
||||
PUBLIC_KEY_OPS: ClassVar[list[str]]
|
||||
REQUIRED_JSON_FIELDS: ClassVar[list[str]]
|
||||
options: Incomplete
|
||||
options: dict[Incomplete, Incomplete]
|
||||
def __init__(self, options=None) -> None: ...
|
||||
@property
|
||||
def tokens(self) -> dict[Incomplete, Incomplete]: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from authlib.jose.rfc7517 import AsymmetricKey
|
||||
@@ -6,8 +5,8 @@ from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey
|
||||
|
||||
class ECKey(AsymmetricKey):
|
||||
kty: str
|
||||
DSS_CURVES: Incomplete
|
||||
CURVES_DSS: Incomplete
|
||||
DSS_CURVES: dict[str, type]
|
||||
CURVES_DSS: dict[property, str]
|
||||
REQUIRED_JSON_FIELDS: ClassVar[list[str]]
|
||||
PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS
|
||||
PRIVATE_KEY_FIELDS: ClassVar[list[str]]
|
||||
|
||||
@@ -4,6 +4,7 @@ from typing import ClassVar, Final, SupportsBytes, SupportsIndex
|
||||
|
||||
from authlib.jose.rfc7516 import JWEAlgorithm
|
||||
|
||||
from .ec_key import ECKey
|
||||
from .oct_key import OctKey
|
||||
from .rsa_key import RSAKey
|
||||
|
||||
@@ -20,7 +21,7 @@ class RSAAlgorithm(JWEAlgorithm):
|
||||
name: str
|
||||
description: str
|
||||
padding: Incomplete
|
||||
def __init__(self, name, description, pad_fn) -> None: ...
|
||||
def __init__(self, name: str, description: str, pad_fn) -> None: ...
|
||||
def prepare_key(self, raw_data) -> RSAKey: ...
|
||||
def generate_preset(self, enc_alg, key) -> dict[str, Incomplete]: ...
|
||||
def wrap(self, enc_alg, headers, key, preset=None) -> dict[str, Incomplete]: ...
|
||||
@@ -29,8 +30,8 @@ class RSAAlgorithm(JWEAlgorithm):
|
||||
class AESAlgorithm(JWEAlgorithm):
|
||||
name: str
|
||||
description: str
|
||||
key_size: Incomplete
|
||||
def __init__(self, key_size) -> None: ...
|
||||
key_size: int
|
||||
def __init__(self, key_size: int) -> None: ...
|
||||
def prepare_key(self, raw_data) -> OctKey: ...
|
||||
def generate_preset(self, enc_alg, key) -> dict[str, Incomplete]: ...
|
||||
def wrap_cek(self, cek, key) -> dict[str, Incomplete]: ...
|
||||
@@ -41,8 +42,8 @@ class AESGCMAlgorithm(JWEAlgorithm):
|
||||
EXTRA_HEADERS: ClassVar[Iterable[str]]
|
||||
name: str
|
||||
description: str
|
||||
key_size: Incomplete
|
||||
def __init__(self, key_size) -> None: ...
|
||||
key_size: int
|
||||
def __init__(self, key_size: int) -> None: ...
|
||||
def prepare_key(self, raw_data) -> OctKey: ...
|
||||
def generate_preset(self, enc_alg, key) -> dict[str, Incomplete]: ...
|
||||
def wrap(self, enc_alg, headers, key, preset=None) -> dict[str, Incomplete]: ...
|
||||
@@ -53,12 +54,12 @@ class ECDHESAlgorithm(JWEAlgorithm):
|
||||
ALLOWED_KEY_CLS = Incomplete
|
||||
name: str
|
||||
description: str
|
||||
key_size: Incomplete
|
||||
aeskw: Incomplete
|
||||
def __init__(self, key_size=None) -> None: ...
|
||||
def prepare_key(self, raw_data): ...
|
||||
key_size: int | None
|
||||
aeskw: AESAlgorithm
|
||||
def __init__(self, key_size: int | None = None) -> None: ...
|
||||
def prepare_key(self, raw_data) -> ECKey: ...
|
||||
def generate_preset(self, enc_alg, key) -> dict[str, Incomplete]: ...
|
||||
def compute_fixed_info(self, headers, bit_size): ...
|
||||
def compute_fixed_info(self, headers, bit_size) -> bytes: ...
|
||||
def compute_derived_key(self, shared_key, fixed_info, bit_size) -> bytes: ...
|
||||
def deliver(self, key, pubkey, headers, bit_size) -> bytes: ...
|
||||
def wrap(self, enc_alg, headers, key, preset=None) -> dict[str, Incomplete]: ...
|
||||
|
||||
@@ -5,23 +5,23 @@ from authlib.jose.rfc7516 import JWEEncAlgorithm
|
||||
|
||||
class CBCHS2EncAlgorithm(JWEEncAlgorithm):
|
||||
IV_SIZE: int
|
||||
name: Incomplete
|
||||
description: Incomplete
|
||||
key_size: Incomplete
|
||||
key_len: Incomplete
|
||||
CEK_SIZE: Incomplete
|
||||
name: str
|
||||
description: str
|
||||
key_size: int
|
||||
key_len: int
|
||||
CEK_SIZE: int
|
||||
hash_alg: Incomplete
|
||||
def __init__(self, key_size, hash_type) -> None: ...
|
||||
def __init__(self, key_size: int, hash_type: int | str) -> None: ...
|
||||
def encrypt(self, msg, aad, iv, key) -> tuple[bytes, bytes]: ...
|
||||
def decrypt(self, ciphertext, aad, iv, tag, key) -> bytes: ...
|
||||
|
||||
class GCMEncAlgorithm(JWEEncAlgorithm):
|
||||
IV_SIZE: int
|
||||
name: Incomplete
|
||||
description: Incomplete
|
||||
key_size: Incomplete
|
||||
CEK_SIZE: Incomplete
|
||||
def __init__(self, key_size) -> None: ...
|
||||
name: str
|
||||
description: str
|
||||
key_size: int
|
||||
CEK_SIZE: int
|
||||
def __init__(self, key_size: int) -> None: ...
|
||||
def encrypt(self, msg, aad, iv, key) -> tuple[bytes, bytes]: ...
|
||||
def decrypt(self, ciphertext, aad, iv, tag, key) -> bytes: ...
|
||||
|
||||
|
||||
@@ -2,61 +2,67 @@ import hashlib
|
||||
from _typeshed import Incomplete
|
||||
|
||||
from authlib.jose.rfc7515 import JWSAlgorithm
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15
|
||||
|
||||
from .ec_key import ECKey
|
||||
from .oct_key import OctKey
|
||||
from .rsa_key import RSAKey
|
||||
|
||||
class NoneAlgorithm(JWSAlgorithm):
|
||||
name: str
|
||||
description: str
|
||||
def prepare_key(self, raw_data): ...
|
||||
def sign(self, msg, key): ...
|
||||
def prepare_key(self, raw_data) -> None: ...
|
||||
def sign(self, msg, key) -> bytes: ...
|
||||
def verify(self, msg, sig, key) -> bool: ...
|
||||
|
||||
class HMACAlgorithm(JWSAlgorithm):
|
||||
SHA256 = hashlib.sha256
|
||||
SHA384 = hashlib.sha384
|
||||
SHA512 = hashlib.sha512
|
||||
name: Incomplete
|
||||
description: Incomplete
|
||||
name: str
|
||||
description: str
|
||||
hash_alg: Incomplete
|
||||
def __init__(self, sha_type) -> None: ...
|
||||
def prepare_key(self, raw_data): ...
|
||||
def sign(self, msg, key): ...
|
||||
def __init__(self, sha_type: int | str) -> None: ...
|
||||
def prepare_key(self, raw_data) -> OctKey: ...
|
||||
def sign(self, msg, key) -> bytes: ...
|
||||
def verify(self, msg, sig, key) -> bool: ...
|
||||
|
||||
class RSAAlgorithm(JWSAlgorithm):
|
||||
SHA256: Incomplete
|
||||
SHA384: Incomplete
|
||||
SHA512: Incomplete
|
||||
name: Incomplete
|
||||
description: Incomplete
|
||||
SHA256 = hashes.SHA256
|
||||
SHA384 = hashes.SHA384
|
||||
SHA512 = hashes.SHA512
|
||||
name: str
|
||||
description: str
|
||||
hash_alg: Incomplete
|
||||
padding: Incomplete
|
||||
def __init__(self, sha_type) -> None: ...
|
||||
def prepare_key(self, raw_data): ...
|
||||
padding: PKCS1v15
|
||||
def __init__(self, sha_type: int | str) -> None: ...
|
||||
def prepare_key(self, raw_data) -> RSAKey: ...
|
||||
def sign(self, msg, key): ...
|
||||
def verify(self, msg, sig, key) -> bool: ...
|
||||
|
||||
class ECAlgorithm(JWSAlgorithm):
|
||||
SHA256: Incomplete
|
||||
SHA384: Incomplete
|
||||
SHA512: Incomplete
|
||||
name: Incomplete
|
||||
SHA256 = hashes.SHA256
|
||||
SHA384 = hashes.SHA384
|
||||
SHA512 = hashes.SHA512
|
||||
name: str
|
||||
curve: Incomplete
|
||||
description: Incomplete
|
||||
description: str
|
||||
hash_alg: Incomplete
|
||||
def __init__(self, name, curve, sha_type) -> None: ...
|
||||
def prepare_key(self, raw_data): ...
|
||||
def sign(self, msg, key): ...
|
||||
def __init__(self, name: str, curve, sha_type: int | str) -> None: ...
|
||||
def prepare_key(self, raw_data) -> ECKey: ...
|
||||
def sign(self, msg, key) -> bytes: ...
|
||||
def verify(self, msg, sig, key) -> bool: ...
|
||||
|
||||
class RSAPSSAlgorithm(JWSAlgorithm):
|
||||
SHA256: Incomplete
|
||||
SHA384: Incomplete
|
||||
SHA512: Incomplete
|
||||
name: Incomplete
|
||||
description: Incomplete
|
||||
SHA256 = hashes.SHA256
|
||||
SHA384 = hashes.SHA384
|
||||
SHA512 = hashes.SHA512
|
||||
name: str
|
||||
description: str
|
||||
hash_alg: Incomplete
|
||||
def __init__(self, sha_type) -> None: ...
|
||||
def prepare_key(self, raw_data): ...
|
||||
def __init__(self, sha_type: int | str) -> None: ...
|
||||
def prepare_key(self, raw_data) -> RSAKey: ...
|
||||
def sign(self, msg, key): ...
|
||||
def verify(self, msg, sig, key) -> bool: ...
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class OctKey(Key):
|
||||
raw_key: Incomplete
|
||||
def __init__(self, raw_key=None, options=None) -> None: ...
|
||||
@property
|
||||
def public_only(self): ...
|
||||
def public_only(self) -> bool: ...
|
||||
def get_op_key(self, operation): ...
|
||||
def load_raw_key(self) -> None: ...
|
||||
def load_dict_key(self) -> None: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from collections.abc import Iterable
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
@@ -21,4 +22,4 @@ class RSAKey(AsymmetricKey):
|
||||
@classmethod
|
||||
def import_dict_key(cls, raw, options=None) -> Self: ...
|
||||
|
||||
def has_all_prime_factors(obj) -> bool: ...
|
||||
def has_all_prime_factors(obj: Iterable[str]) -> bool: ...
|
||||
|
||||
@@ -17,7 +17,7 @@ class OKPKey(AsymmetricKey):
|
||||
PUBLIC_KEY_CLS: ClassVar[tuple[type, ...]]
|
||||
PRIVATE_KEY_CLS: ClassVar[tuple[type, ...]]
|
||||
SSH_PUBLIC_PREFIX: ClassVar[bytes]
|
||||
def exchange_shared_key(self, pubkey) -> bytes: ...
|
||||
def exchange_shared_key(self, pubkey: X25519PrivateKey | X448PublicKey) -> bytes: ...
|
||||
@staticmethod
|
||||
def get_key_curve(key) -> str | None: ...
|
||||
def load_private_key(self) -> Ed25519PrivateKey | Ed448PrivateKey | X25519PrivateKey | X448PrivateKey: ...
|
||||
|
||||
@@ -4,9 +4,9 @@ from typing import Any, NoReturn
|
||||
from authlib.oauth1 import ClientAuth
|
||||
|
||||
class OAuth1Client:
|
||||
auth_class: type[ClientAuth] = ...
|
||||
auth_class: type[ClientAuth]
|
||||
session: Incomplete
|
||||
auth: Incomplete
|
||||
auth: ClientAuth
|
||||
def __init__(
|
||||
self,
|
||||
session,
|
||||
@@ -28,14 +28,14 @@ class OAuth1Client:
|
||||
@redirect_uri.setter
|
||||
def redirect_uri(self, uri) -> None: ...
|
||||
@property
|
||||
def token(self): ...
|
||||
def token(self) -> dict[Incomplete, Incomplete]: ...
|
||||
@token.setter
|
||||
def token(self, token) -> None: ...
|
||||
def create_authorization_url(self, url, request_token=None, **kwargs): ...
|
||||
def create_authorization_url(self, url, request_token=None, **kwargs) -> str: ...
|
||||
def fetch_request_token(self, url: str, **kwargs) -> dict[str, Any]: ...
|
||||
def fetch_access_token(self, url, verifier=None, **kwargs): ...
|
||||
def parse_authorization_response(self, url): ...
|
||||
def parse_response_token(self, status_code, text): ...
|
||||
def parse_authorization_response(self, url: str) -> dict[str, str]: ...
|
||||
def parse_response_token(self, status_code: int, text: str): ...
|
||||
@staticmethod
|
||||
def handle_error(error_type, error_description) -> NoReturn: ...
|
||||
def handle_error(error_type: str, error_description: str) -> NoReturn: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
from authlib.oauth1.rfc5849.base_server import BaseServer
|
||||
|
||||
class AuthorizationServer(BaseServer):
|
||||
TOKEN_RESPONSE_HEADER: Incomplete
|
||||
TOKEN_RESPONSE_HEADER: list[tuple[str, str]]
|
||||
TEMPORARY_CREDENTIALS_METHOD: str
|
||||
def create_oauth1_request(self, request): ...
|
||||
def handle_response(self, status_code, payload, headers): ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
|
||||
class BaseServer:
|
||||
SIGNATURE_METHODS: Incomplete
|
||||
SUPPORTED_SIGNATURE_METHODS: Incomplete
|
||||
SIGNATURE_METHODS: dict[str, Callable[..., bool]]
|
||||
SUPPORTED_SIGNATURE_METHODS: list[str]
|
||||
EXPIRY_TIME: int
|
||||
@classmethod
|
||||
def register_signature_method(cls, name, verify) -> None: ...
|
||||
def register_signature_method(cls, name: str, verify: Callable[..., bool]) -> None: ...
|
||||
def validate_timestamp_and_nonce(self, request) -> None: ...
|
||||
def validate_oauth_signature(self, request) -> None: ...
|
||||
def get_client_by_id(self, client_id): ...
|
||||
def exists_nonce(self, nonce, request): ...
|
||||
def exists_nonce(self, nonce, request) -> bool: ...
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing import Final
|
||||
|
||||
CONTENT_TYPE_FORM_URLENCODED: str
|
||||
CONTENT_TYPE_MULTI_PART: str
|
||||
CONTENT_TYPE_FORM_URLENCODED: Final = "application/x-www-form-urlencoded"
|
||||
CONTENT_TYPE_MULTI_PART: Final = "multipart/form-data"
|
||||
|
||||
class ClientAuth:
|
||||
SIGNATURE_METHODS: Incomplete
|
||||
SIGNATURE_METHODS: dict[str, Callable[..., str]]
|
||||
@classmethod
|
||||
def register_signature_method(cls, name, sign) -> None: ...
|
||||
def register_signature_method(cls, name: str, sign: Callable[..., str]) -> None: ...
|
||||
client_id: Incomplete
|
||||
client_secret: Incomplete
|
||||
token: Incomplete
|
||||
@@ -33,7 +35,7 @@ class ClientAuth:
|
||||
force_include_body: bool = False,
|
||||
) -> None: ...
|
||||
def get_oauth_signature(self, method, uri, headers, body) -> str: ...
|
||||
def get_oauth_params(self, nonce, timestamp) -> list[Incomplete]: ...
|
||||
def get_oauth_params(self, nonce, timestamp) -> list[tuple[str, Incomplete]]: ...
|
||||
def sign(self, method, uri, headers, body) -> tuple[Incomplete, Incomplete, Incomplete]: ...
|
||||
def prepare(self, method, uri, headers, body) -> tuple[Incomplete, ...]: ...
|
||||
|
||||
|
||||
@@ -16,6 +16,6 @@ class TemporaryCredential(dict[str, object], TemporaryCredentialMixin):
|
||||
def get_client_id(self): ...
|
||||
def get_user_id(self): ...
|
||||
def get_redirect_uri(self): ...
|
||||
def check_verifier(self, verifier): ...
|
||||
def check_verifier(self, verifier) -> bool: ...
|
||||
def get_oauth_token(self): ...
|
||||
def get_oauth_token_secret(self): ...
|
||||
|
||||
@@ -5,13 +5,17 @@ class OAuth1Request:
|
||||
uri: Incomplete
|
||||
body: Incomplete
|
||||
headers: Incomplete
|
||||
client: Incomplete
|
||||
credential: Incomplete
|
||||
user: Incomplete
|
||||
client: Incomplete | None
|
||||
credential: Incomplete | None
|
||||
user: Incomplete | None
|
||||
query: Incomplete
|
||||
query_params: Incomplete
|
||||
body_params: Incomplete
|
||||
params: Incomplete
|
||||
auth_params: Incomplete
|
||||
realm: Incomplete
|
||||
signature_type: str | None
|
||||
oauth_params: Incomplete
|
||||
params: list[Incomplete]
|
||||
def __init__(self, method, uri, body=None, headers=None) -> None: ...
|
||||
@property
|
||||
def client_id(self): ...
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
def encode_client_secret_basic(client, method, uri, headers, body): ...
|
||||
def encode_client_secret_post(client, method, uri, headers, body): ...
|
||||
def encode_none(client, method, uri, headers, body): ...
|
||||
def encode_client_secret_basic(client, method, uri, headers, body) -> tuple[Incomplete, Incomplete, Incomplete]: ...
|
||||
def encode_client_secret_post(client, method, uri, headers, body) -> tuple[Incomplete, Incomplete, str]: ...
|
||||
def encode_none(client, method, uri, headers, body) -> tuple[Incomplete, Incomplete, Incomplete]: ...
|
||||
|
||||
class ClientAuth:
|
||||
DEFAULT_AUTH_METHODS: Incomplete
|
||||
DEFAULT_AUTH_METHODS: dict[str, Incomplete]
|
||||
client_id: Incomplete
|
||||
client_secret: Incomplete
|
||||
auth_method: Incomplete
|
||||
@@ -14,12 +14,12 @@ class ClientAuth:
|
||||
|
||||
class TokenAuth:
|
||||
DEFAULT_TOKEN_TYPE: str
|
||||
SIGN_METHODS: Incomplete
|
||||
SIGN_METHODS: dict[str, Incomplete]
|
||||
token: Incomplete
|
||||
token_placement: Incomplete
|
||||
client: Incomplete
|
||||
hooks: Incomplete
|
||||
token_placement: str
|
||||
client: Incomplete | None
|
||||
hooks: set[Incomplete]
|
||||
def __init__(self, token, token_placement: str = "header", client=None) -> None: ...
|
||||
def set_token(self, token) -> None: ...
|
||||
def prepare(self, uri, headers, body): ...
|
||||
def prepare(self, uri, headers, body) -> tuple[Incomplete, Incomplete, Incomplete]: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Literal
|
||||
|
||||
from authlib.common.errors import AuthlibHTTPError
|
||||
|
||||
@@ -10,7 +11,7 @@ class OAuth2Error(AuthlibHTTPError):
|
||||
redirect_fragment: Incomplete
|
||||
def __init__(
|
||||
self,
|
||||
description=None,
|
||||
description: str | None = None,
|
||||
uri=None,
|
||||
status_code=None,
|
||||
state=None,
|
||||
@@ -18,5 +19,5 @@ class OAuth2Error(AuthlibHTTPError):
|
||||
redirect_fragment: bool = False,
|
||||
error=None,
|
||||
) -> None: ...
|
||||
def get_body(self) -> list[Incomplete]: ...
|
||||
def __call__(self, uri=None): ...
|
||||
def get_body(self) -> list[tuple[Literal["error", "error_description", "error_uri"], str | None]]: ...
|
||||
def __call__(self, uri: str | None = None): ...
|
||||
|
||||
@@ -8,8 +8,8 @@ class OAuth2Client:
|
||||
client_auth_class = ClientAuth
|
||||
token_auth_class = TokenAuth
|
||||
oauth_error_class = OAuth2Error
|
||||
EXTRA_AUTHORIZE_PARAMS: Incomplete
|
||||
SESSION_REQUEST_PARAMS: Incomplete
|
||||
EXTRA_AUTHORIZE_PARAMS: tuple[str, ...]
|
||||
SESSION_REQUEST_PARAMS: list[str]
|
||||
session: Incomplete
|
||||
client_id: Incomplete
|
||||
client_secret: Incomplete
|
||||
@@ -21,9 +21,9 @@ class OAuth2Client:
|
||||
code_challenge_method: Incomplete
|
||||
token_auth: Incomplete
|
||||
update_token: Incomplete
|
||||
metadata: Incomplete
|
||||
compliance_hook: Incomplete
|
||||
leeway: Incomplete
|
||||
metadata: dict[str, Incomplete]
|
||||
compliance_hook: dict[str, set[Incomplete]]
|
||||
leeway: int
|
||||
def __init__(
|
||||
self,
|
||||
session,
|
||||
@@ -39,6 +39,11 @@ class OAuth2Client:
|
||||
token_placement: str = "header",
|
||||
update_token=None,
|
||||
leeway: int = 60,
|
||||
*,
|
||||
token_updater=None,
|
||||
response_type=None,
|
||||
grant_type: str | None = None,
|
||||
token_endpoint=None,
|
||||
**metadata,
|
||||
) -> None: ...
|
||||
def register_client_auth_method(self, auth) -> None: ...
|
||||
@@ -47,11 +52,11 @@ class OAuth2Client:
|
||||
def token(self): ...
|
||||
@token.setter
|
||||
def token(self, token) -> None: ...
|
||||
def create_authorization_url(self, url, state=None, code_verifier=None, **kwargs): ...
|
||||
def create_authorization_url(self, url, state=None, code_verifier=None, **kwargs) -> tuple[str, Incomplete]: ...
|
||||
def fetch_token(
|
||||
self, url=None, body: str = "", method: str = "POST", headers=None, auth=None, grant_type=None, state=None, **kwargs
|
||||
): ...
|
||||
def token_from_fragment(self, authorization_response, state=None): ...
|
||||
def token_from_fragment(self, authorization_response, state=None) -> dict[Incomplete, Incomplete]: ...
|
||||
def refresh_token(self, url=None, refresh_token=None, body: str = "", auth=None, headers=None, **kwargs): ...
|
||||
def ensure_active_token(self, token=None): ...
|
||||
def revoke_token(self, url, token=None, token_type_hint=None, body=None, auth=None, headers=None, **kwargs): ...
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
def add_to_uri(token, uri): ...
|
||||
from _typeshed import Incomplete
|
||||
|
||||
def add_to_uri(token, uri) -> str: ...
|
||||
def add_to_headers(token, headers=None): ...
|
||||
def add_to_body(token, body=None) -> str: ...
|
||||
def add_bearer_token(token, uri, headers, body, placement: str = "header"): ...
|
||||
def add_bearer_token(token, uri, headers, body, placement: str = "header") -> tuple[Incomplete, Incomplete, Incomplete]: ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
class AuthorizationServerMetadata(dict[str, object]):
|
||||
REGISTRY_KEYS: Incomplete
|
||||
REGISTRY_KEYS: list[str]
|
||||
def validate_require_signed_request_object(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user