
    Ki	                     D     G d  d      Z  G d de      Z G d de      Zy)c                   6    e Zd ZdZdZdZdZdZdZd Z	d Z
d Zy)	JWSAlgorithmzInterface for JWS algorithm. JWA specification (RFC7518) SHOULD
    implement the algorithms for JWS with this base implementation.
    NFJWSalgc                     t               )z0Prepare key for signing and verifying signature.NotImplementedError)selfraw_datas     g/home/jay/workspace/scripts/.codegraph-venv/lib/python3.12/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
deprecatedalgorithm_typealgorithm_locationr   r   r    r   r   r   r      s2     DKJN$""r   r   c                   2     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|j                  |       |r|j                  |       t        | 	  |       || _        || _        y )N)updatesuper__init__	protectedheader)r	   r%   r&   obj	__class__s       r   r$   zJWSHeader.__init__4   sA    JJvJJy!"r   c                 l    t        ||       r|S  | |j                  d      |j                  d            S )Nr%   r&   )
isinstanceget)clsr'   s     r   	from_dictzJWSHeader.from_dict>   s0    c3J377;'):;;r   )r   r   r   r   r$   classmethodr-   __classcell__r(   s   @r   r    r    $   s!     < <r   r    c                   4     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.c                 R    t         |   ||       || _        || _        || _        y )N)r&   payload)r#   r$   r&   r4   type)r	   r&   r4   r5   r(   s       r   r$   zJWSObject.__init__H   s2     	 	
 	r   c                 ,    | j                   dk(  r| d   S y)z'Alias of ``header`` for JSON typed JWS.jsonr&   N)r5   )r	   s    r   headerszJWSObject.headersQ   s     99>! r   )compact)r   r   r   r   r$   propertyr8   r/   r0   s   @r   r2   r2   E   s    4 " "r   r2   N)r   dictr    r2   r   r   r   <module>r<      s)    "  "F< <B" "r   