codekingpro/portable-devtools
114k
1"""2 authlib.jose3 ~~~~~~~~~~~~4 5 JOSE implementation in Authlib. Tracking the status of JOSE specs at6 https://tools.ietf.org/wg/jose/7"""8from .rfc7515 import (9 JsonWebSignature, JWSAlgorithm, JWSHeader, JWSObject,10)11from .rfc7516 import (12 JsonWebEncryption, JWEAlgorithm, JWEEncAlgorithm, JWEZipAlgorithm,13)14from .rfc7517 import Key, KeySet, JsonWebKey15from .rfc7518 import (16 register_jws_rfc7518,17 register_jwe_rfc7518,18 ECDHESAlgorithm,19 OctKey,20 RSAKey,21 ECKey,22)23from .rfc7519 import JsonWebToken, BaseClaims, JWTClaims24from .rfc8037 import OKPKey, register_jws_rfc803725 26from .errors import JoseError27 28# register algorithms29register_jws_rfc7518(JsonWebSignature)30register_jws_rfc8037(JsonWebSignature)31 32register_jwe_rfc7518(JsonWebEncryption)33 34# attach algorithms35ECDHESAlgorithm.ALLOWED_KEY_CLS = (ECKey, OKPKey)36 37# register supported keys38JsonWebKey.JWK_KEY_CLS = {39 OctKey.kty: OctKey,40 RSAKey.kty: RSAKey,41 ECKey.kty: ECKey,42 OKPKey.kty: OKPKey,43}44 45jwt = JsonWebToken(list(JsonWebSignature.ALGORITHMS_REGISTRY.keys()))46 47 48__all__ = [49 'JoseError',50 51 'JsonWebSignature', 'JWSAlgorithm', 'JWSHeader', 'JWSObject',52 'JsonWebEncryption', 'JWEAlgorithm', 'JWEEncAlgorithm', 'JWEZipAlgorithm',53 54 'JsonWebKey', 'Key', 'KeySet',55 56 'OctKey', 'RSAKey', 'ECKey', 'OKPKey',57 58 'JsonWebToken', 'BaseClaims', 'JWTClaims',59 'jwt',60]61 