+
    Ai                        ^ RI t ^ RIt ^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHtHt ^ RIHtHt R]P&                  3R	 ltRR
 ltR tR tR tRR ltR tR tR tR tR tRR ltR#   ] d    ^ RIHtHt  Lmi ; i)    N)IterableMapping)r   r   )jwk)Key)
ALGORITHMS)JWSErrorJWSSignatureError)base64url_decodebase64url_encodec                    V\         P                  9  d   \        RV,          4      h\        W2R7      p\	        V 4      p\        WEW14      pV# )a3  Signs a claims set and returns a JWS string.

Args:
    payload (str or dict): A string to sign
    key (str or dict): The key to use for signing the claim set. Can be
        individual JWK or JWK set.
    headers (dict, optional): A set of headers that will be added to
        the default headers.  Any headers that are added as additional
        headers will override the default headers.
    algorithm (str, optional): The algorithm to use for signing the
        the claims.  Defaults to HS256.

Returns:
    str: The string representation of the header, claims, and signature.

Raises:
    JWSError: If there is an error signing the token.

Examples:

    >>> jws.sign({'a': 'b'}, 'secret', algorithm='HS256')
    'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiYiJ9.jiMyrsmD8AoHWeQgmxZ5yq8z0lXS67_QGs52AzC8Ru8'

zAlgorithm %s not supported.)additional_headers)r   	SUPPORTEDr   _encode_header_encode_payload_sign_header_and_claims)payloadkeyheaders	algorithmencoded_headerencoded_payloadsigned_outputs   &&&&   F/var/www/html/photoedit/myenv/lib/python3.14/site-packages/jose/jws.pysignr      sI    4 
,,,4y@AA#IJN%g.O+NY\M    c                L    \        V 4      w  rErgV'       d   \        WdWqV4       V# )ao  Verifies a JWS string's signature.

Args:
    token (str): A signed JWS to be verified.
    key (str or dict): A key to attempt to verify the payload with. Can be
        individual JWK or JWK set.
    algorithms (str or list): Valid algorithms that should be used to verify the JWS.

Returns:
    str: The str representation of the payload, assuming the signature is valid.

Raises:
    JWSError: If there is an exception verifying a token.

Examples:

    >>> token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiYiJ9.jiMyrsmD8AoHWeQgmxZ5yq8z0lXS67_QGs52AzC8Ru8'
    >>> jws.verify(token, 'secret', algorithms='HS256')

)_load_verify_signature)tokenr   
algorithmsverifyheaderr   signing_input	signatures   &&&&    r   r!   r!   4   s&    , 16e-F]-LNr   c                "    \        V 4      w  rr4V# )a  Returns the decoded headers without verification of any kind.

Args:
    token (str): A signed JWS to decode the headers from.

Returns:
    dict: The dict representation of the token headers.

Raises:
    JWSError: If there is an exception decoding the token.
r   r   r"   claimsr#   r$   s   &    r   get_unverified_headerr)   R        05U|,FMMr   c                    \        V 4      # )aW  Returns the decoded headers without verification of any kind.

This is simply a wrapper of get_unverified_header() for backwards
compatibility.

Args:
    token (str): A signed JWS to decode the headers from.

Returns:
    dict: The dict representation of the token headers.

Raises:
    JWSError: If there is an exception decoding the token.
)r)   )r   s   &r   get_unverified_headersr,   b   s     !''r   c                "    \        V 4      w  rr4V# )a  Returns the decoded claims without verification of any kind.

Args:
    token (str): A signed JWS to decode the headers from.

Returns:
    str: The str representation of the token claims.

Raises:
    JWSError: If there is an exception decoding the token.
r&   r'   s   &    r   get_unverified_claimsr.   t   r*   r   c                     R RRV /pV'       d   VP                  V4       \        P                  ! VRRR7      P                  R4      p\	        V4      # )typJWTalgT)
separators	sort_keysutf-8,:)updatejsondumpsencoder   )r   r   r"   json_headers   &&  r   r   r      sR    UE9-F()** fWo	  K((r   c                     \        V \        4      '       d)    \        P                  ! V RR7      P	                  R4      p \        V 4      #   \
         d     Li ; i)r7   )r3   r5   r6   )
isinstancer   r:   r;   r<   
ValueErrorr   )r   s   &r   r   r      sW    '7##	jj% fWo  G$$  		s   'A
 
AAc                 <   R P                  W.4      p \        V\        4      '       g   \        P                  ! W24      pVP                  V4      p\        T4      pR P                  YT.4      pTP                  R4      #   \         d   p\        T4      hRp?ii ; i)   .Nr5   )
joinr?   r   r   	constructr   	Exceptionr   r   decode)	r   encoded_claimsr   r   r#   r$   eencoded_signatureencoded_strings	   &&&&     r   r   r      s    II~>?M#s##--/CHH]+	 )3YY@QRSN  ))  qks   =B   BBBc                    \        V \        4      '       d   V P                  R 4      p  V P                  R^4      w  rVP	                  R^4      w  r4\        V4      p \        P                  ! TP                  R 4      4      p\        T\        4      '       g   \        R4      h \        T4      p \        T4      p	YhY3#   \         d    \        R4      h\        \        P                  3 d    \        R4      hi ; i  \         d   p\        RT,          4      hRp?ii ; i  \        \        P                  3 d    \        R4      hi ; i  \        \        P                  3 d    \        R4      hi ; i)	r5   rB   zNot enough segmentszInvalid header paddingzInvalid header string: %sNz,Invalid header string: must be a json objectzInvalid payload paddingzInvalid crypto padding)r?   strr<   rsplitsplitr
   r@   r   	TypeErrorbinasciiErrorr:   loadsrF   r   )
jwtr#   crypto_segmentheader_segmentclaims_segmentheader_datar"   rH   r   r$   s
   &         r   r   r      s^   #sjj!1(+

4(;%)6)<)<T1)E&&~68K..w78 fg&&EFF2">21$^4	 ]66/  .,--x~~& 1/001
  82Q6778 x~~& 20112
 x~~& 1/001sA   3B? %C> $D# 0E ?.C;.C;>D 	DD #'E
'E4c                     V  FJ  p\        V\        4      '       g   \        P                  ! WC4      p VP	                  W4      '       d    R # KL  	  R#   \
         d     K^  i ; i)TF)r?   r   r   rD   r!   rE   )keysr#   r$   r2   r   s   &&&& r   _sig_matches_keysrZ      s\    #s##--)C	zz-33 4	    		s   AA"!A"c                    \        V \        4      '       d   V 3#  \        P                  ! V \        \        R 7      p \        V \        4      '       d8   RV 9   d
   V R,          # RV 9   d   V 3# V P                  4       pV'       d   V# V 3# \        V \        4      '       d/   \        V \        4      '       g   \        V \        4      '       g   V # V 3#   \
         d     Li ; i))	parse_intparse_floatrY   kty)
r?   r   r:   rR   rL   rE   r   valuesr   bytes)r   r_   s   & r   	_get_keysra      s    #svjj= #wS=v;c\6M ZZ\F6M 
C	"	"JsC,@,@JsTYDZDZ
 v/  s   !C CCc                 4   VP                  R 4      pV'       g   \        R4      hVe   WT9  d   \        R4      h\        V4      p \        W`W%4      '       g   \	        4       hR#   \         d    \        R4      h\         d    \        RT,          4      hi ; i)r2   z-No algorithm was specified in the JWS header.Nz&The specified alg value is not allowedzSignature verification failed.z$Invalid or unsupported algorithm: %s)getr   ra   rZ   r	   )r#   r"   r$   r   r    r2   rY   s   &&&&&  r   r   r      s    
**U
CFGG#"7?@@S>DE iEE#%% F 9788 E=CDDEs   A$ $BB)T)N) N) rP   r:   collections.abcr   r   ImportErrorcollectionsjoser   jose.backends.baser   jose.constantsr   jose.exceptionsr   r	   
jose.utilsr
   r   HS256r   r!   r)   r,   r.   r   r   r   r   rZ   ra   r    r   r   <module>ro      s     .1  " % 7 9  $z/?/? !H< ($ )
%* 7B	@Eo  .--.s   A. .B ?B 