Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
errors.py114 linesDownload Raw Back to jose
1from authlib.common.errors import AuthlibBaseError2 3 4class JoseError(AuthlibBaseError):5    pass6 7 8class DecodeError(JoseError):9    error = 'decode_error'10 11 12class MissingAlgorithmError(JoseError):13    error = 'missing_algorithm'14 15 16class UnsupportedAlgorithmError(JoseError):17    error = 'unsupported_algorithm'18 19 20class BadSignatureError(JoseError):21    error = 'bad_signature'22 23    def __init__(self, result):24        super().__init__()25        self.result = result26 27 28class InvalidHeaderParameterNameError(JoseError):29    error = 'invalid_header_parameter_name'30 31    def __init__(self, name):32        description = f'Invalid Header Parameter Name: {name}'33        super().__init__(34            description=description)35 36 37class InvalidEncryptionAlgorithmForECDH1PUWithKeyWrappingError(JoseError):38    error = 'invalid_encryption_algorithm_for_ECDH_1PU_with_key_wrapping'39 40    def __init__(self):41        description = 'In key agreement with key wrapping mode ECDH-1PU algorithm ' \42                      'only supports AES_CBC_HMAC_SHA2 family encryption algorithms'43        super().__init__(44            description=description)45 46 47class InvalidAlgorithmForMultipleRecipientsMode(JoseError):48    error = 'invalid_algorithm_for_multiple_recipients_mode'49 50    def __init__(self, alg):51        description = f'{alg} algorithm cannot be used in multiple recipients mode'52        super().__init__(53            description=description)54 55 56class KeyMismatchError(JoseError):57    error = 'key_mismatch_error'58    description = 'Key does not match to any recipient'59 60 61class MissingEncryptionAlgorithmError(JoseError):62    error = 'missing_encryption_algorithm'63    description = 'Missing "enc" in header'64 65 66class UnsupportedEncryptionAlgorithmError(JoseError):67    error = 'unsupported_encryption_algorithm'68    description = 'Unsupported "enc" value in header'69 70 71class UnsupportedCompressionAlgorithmError(JoseError):72    error = 'unsupported_compression_algorithm'73    description = 'Unsupported "zip" value in header'74 75 76class InvalidUseError(JoseError):77    error = 'invalid_use'78    description = 'Key "use" is not valid for your usage'79 80 81class InvalidClaimError(JoseError):82    error = 'invalid_claim'83 84    def __init__(self, claim):85        self.claim_name = claim86        description = f'Invalid claim "{claim}"'87        super().__init__(description=description)88 89 90class MissingClaimError(JoseError):91    error = 'missing_claim'92 93    def __init__(self, claim):94        description = f'Missing "{claim}" claim'95        super().__init__(description=description)96 97 98class InsecureClaimError(JoseError):99    error = 'insecure_claim'100 101    def __init__(self, claim):102        description = f'Insecure claim "{claim}"'103        super().__init__(description=description)104 105 106class ExpiredTokenError(JoseError):107    error = 'expired_token'108    description = 'The token is expired'109 110 111class InvalidTokenError(JoseError):112    error = 'invalid_token'113    description = 'The token is not valid yet'114 
codekingpro/portable-devtools · Team Ai