o
    i$                     @   sL   d dl Z ddlmZ ddlmZ eddgZdZG dd	 d	eZd
d ZdS )    N   )JsonWebEncryption)JWEZipAlgorithmx      i  c                   @   s8   e Zd ZdZdZdedefddZdedefddZd	S )
DeflateZipAlgorithmDEFDEFLATEsreturnc                 C   s   t |}|dd S )z+Compress bytes data with DEFLATE algorithm.r   )zlibcompress)selfr
   data r   c/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/authlib/jose/rfc7518/jwe_zips.pyr      s   
zDeflateZipAlgorithm.compressc                 C   sH   | tr
t }nttj }||t}|jr"tdt d|S )zDecompress DEFLATE bytes data.zDecompressed string exceeds z bytes)	
startswith	GZIP_HEADr   decompressobj	MAX_WBITS
decompressMAX_SIZEunconsumed_tail
ValueError)r   r
   decompressorvaluer   r   r   r      s   

zDeflateZipAlgorithm.decompressN)__name__
__module____qualname__namedescriptionbytesr   r   r   r   r   r   r   
   s
    r   c                   C   s   t t  d S )N)r   register_algorithmr   r   r   r   r   register_jwe_rfc7518!   s   r$   )	r   rfc7516r   r   r"   r   r   r   r$   r   r   r   r   <module>   s    