
    k7iM                     R    S SK r S SKJr  S SKJr  S SKJr  S SKJr  S rS	S jrS r	g)
    N)
json_loads)
to_unicode)urlsafe_b64decode)DecodeErrorc                     [        U 5      S:  a  [        S5      e[        XS5      n [        UR	                  S5      5      n[        U[        5      (       d  U" S5      eU$ ! [         a  nU" SU 35      UeS nAff = f)N  zValue of header is too longheaderzutf-8zInvalid header string: zHeader must be a json object)len
ValueErrorextract_segmentr   decode
isinstancedict)header_segment	error_clsheader_datar	   es        K/home/james-whalen/.local/lib/python3.13/site-packages/authlib/jose/util.pyextract_headerr   	   s    
>V#677!.XFK>K..w78 fd##677M  >1!56A=>s   A! !
A<+A77A<c                     [        U 5      S:  a  [        SU S35      e [        U 5      $ ! [        [        R
                  4 a  nSU S3nU" U5      UeS nAff = f)Nr   z	Value of z is too longInvalid z padding)r
   r   r   	TypeErrorbinasciiError)segmentr   nameexcmsgs        r   r   r      se    
7|f9TF,788& ))x~~& &h'n#%&s   
+ AAAc                     [        U [        5      (       d   [        [        U 5      5      n [        U [        5      (       d  [        SU 35      eU $ ! [        [
        4 a  n[        SU 35      UeS nAff = f)Nr   )r   r   r   r   r   r   r   )sstructure_namer   s      r   ensure_dictr"   $   sx    a	D:a=)A aH^$4566H I& 	D(89:C	Ds   A A4 A//A4)payload)
r   authlib.common.encodingr   r   r   authlib.jose.errorsr   r   r   r"        r   <module>r(      s#     . . 5 + &
r'   