
    ([f	                     X     G d  d          Z  G d de          Z G d de          ZdS )c                   4    e Zd ZdZdZdZdZdZd Zd Z	d Z
dS )JWSAlgorithmzInterface for JWS algorithm. JWA specification (RFC7518) SHOULD
    implement the algorithms for JWS with this base implementation.
    NJWSalgc                     t                      )z0Prepare key for signing and verifying signature.NotImplementedError)selfraw_datas     O/var/www/piapp/venv/lib/python3.11/site-packages/authlib/jose/rfc7515/models.pyprepare_keyzJWSAlgorithm.prepare_key
   s    !###    c                     t           )zSign the text msg with a private/sign key.

        :param msg: message bytes to be signed
        :param key: private key to sign the message
        :return: bytes
        r   )r	   msgkeys      r   signzJWSAlgorithm.sign   s
     "!r   c                     t           )zVerify the signature of text msg with a public/verify key.

        :param msg: message bytes to be signed
        :param sig: result signature to be compared
        :param key: public key to verify the signature
        :return: boolean
        r   )r	   r   sigr   s       r   verifyzJWSAlgorithm.verify   s
     "!r   )__name__
__module____qualname____doc__namedescriptionalgorithm_typealgorithm_locationr   r   r    r   r   r   r      sb          DKN$ $ $" " "" " " " "r   r   c                   8     e Zd ZdZ fdZed             Z xZS )	JWSHeadera  Header object for JWS. It combine the protected header and unprotected
    header together. JWSHeader itself is a dict of the combined dict. e.g.

        >>> protected = {'alg': 'HS256'}
        >>> header = {'kid': 'a'}
        >>> jws_header = JWSHeader(protected, header)
        >>> print(jws_header)
        {'alg': 'HS256', 'kid': 'a'}
        >>> jws_header.protected == protected
        >>> jws_header.header == header

    :param protected: dict of protected header
    :param header: dict of unprotected header
    c                     i }|r|                     |           |r|                     |           t                                          |           || _        || _        d S )N)updatesuper__init__	protectedheader)r	   r$   r%   obj	__class__s       r   r#   zJWSHeader.__init__1   sf     	"JJy!!! 	JJv"r   c                     t          ||           r|S  | |                    d          |                    d                    S )Nr$   r%   )
isinstanceget)clsr&   s     r   	from_dictzJWSHeader.from_dict;   sC    c3 	Js377;''):):;;;r   )r   r   r   r   r#   classmethodr,   __classcell__r'   s   @r   r   r   "   s]              < < [< < < < <r   r   c                   :     e Zd ZdZd fd	Zed             Z xZS )	JWSObjectz*A dict instance to represent a JWS object.compactc                 x    t                                          ||           || _        || _        || _        d S )N)r%   payload)r"   r#   r%   r4   type)r	   r%   r4   r5   r'   s       r   r#   zJWSObject.__init__D   sE     	 	
 	
 	
 			r   c                 ,    | j         dk    r| d         S dS )z'Alias of ``header`` for JSON typed JWS.jsonr%   N)r5   )r	   s    r   headerszJWSObject.headersM   s#     9>! r   )r2   )r   r   r   r   r#   propertyr8   r.   r/   s   @r   r1   r1   B   s^        44      " " X" " " " "r   r1   N)r   dictr   r1   r   r   r   <module>r;      s   " " " " " " " "B< < < < < < < <@" " " " " " " " " "r   