
    &g^                         d Z ddlZddlZddlZddlmZ dZdZ G d dej                  Z	 G d	 d
ej                  Z
 G d dej                  ZdS )z5Base classes for cryptographic signers and verifiers.    N)
exceptionsprivate_keyprivate_key_idc                   2    e Zd ZdZej        d             ZdS )Verifierz9Abstract base class for crytographic signature verifiers.c                      t          d          )a  Verifies a message against a cryptographic signature.

        Args:
            message (Union[str, bytes]): The message to verify.
            signature (Union[str, bytes]): The cryptography signature to check.

        Returns:
            bool: True if message was signed by the private key associated
            with the public key that this object was constructed with.
        zVerify must be implementedNotImplementedError)selfmessage	signatures      H/var/www/api/venv/lib/python3.11/site-packages/google/auth/crypt/base.pyverifyzVerifier.verify   s     "">???    N)__name__
__module____qualname____doc__abcabstractmethodr    r   r   r   r      s<        CC@ @ @ @ @r   r   )	metaclassc                   R    e Zd ZdZej        d             Zej        d             ZdS )Signerz.Abstract base class for cryptographic signers.c                      t          d          )z<Optional[str]: The key ID used to identify this private key.zKey id must be implementedr	   )r   s    r   key_idzSigner.key_id2   s     "">???r   c                      t          d          )zSigns a message.

        Args:
            message (Union[str, bytes]): The message to be signed.

        Returns:
            bytes: The signature of the message.
        zSign must be implementedr	   )r   r   s     r   signzSigner.sign7   s     ""<===r   N)	r   r   r   r   r   abstractpropertyr   r   r   r   r   r   r   r   /   sY        88@ @ @ 	> > > > >r   r   c                   `    e Zd ZdZej        dd            Zed             Zed             Z	dS )FromServiceAccountMixinz3Mix-in to enable factory constructors for a Signer.Nc                      t          d          )ad  Construct an Signer instance from a private key string.

        Args:
            key (str): Private key as a string.
            key_id (str): An optional key id used to identify the private key.

        Returns:
            google.auth.crypt.Signer: The constructed signer.

        Raises:
            ValueError: If the key cannot be parsed.
        zfrom_string must be implementedr	   )clskeyr   s      r   from_stringz#FromServiceAccountMixin.from_stringI   s     ""CDDDr   c                     t           |vrt          j        d          |                     |t                    |                    t
                              S )a  Creates a Signer instance instance from a dictionary containing
        service account info in Google format.

        Args:
            info (Mapping[str, str]): The service account info in Google
                format.

        Returns:
            google.auth.crypt.Signer: The constructed signer.

        Raises:
            ValueError: If the info is not in the expected format.
        z@The private_key field was not found in the service account info.)_JSON_FILE_PRIVATE_KEYr   MalformedErrorr%   get_JSON_FILE_PRIVATE_KEY_ID)r#   infos     r   from_service_account_infoz1FromServiceAccountMixin.from_service_account_infoY   sW     "--+U   '($((3L*M*M
 
 	
r   c                     t          j        |dd          5 }t          j        |          }ddd           n# 1 swxY w Y   |                     |          S )a  Creates a Signer instance from a service account .json file
        in Google format.

        Args:
            filename (str): The path to the service account .json file.

        Returns:
            google.auth.crypt.Signer: The constructed signer.
        rzutf-8)encodingN)ioopenjsonloadr,   )r#   filename	json_filedatas       r   from_service_account_filez1FromServiceAccountMixin.from_service_account_fileq   s     WXsW555 	(9Y''D	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( ,,T222s   9= =)N)
r   r   r   r   r   r   r%   classmethodr,   r7   r   r   r   r!   r!   F   sv        ==E E E E 
 
 [
. 3 3 [3 3 3r   r!   )r   r   r0   r2   google.authr   r'   r*   ABCMetar   r   r!   r   r   r   <module>r;      s    < ; 



 				  " " " " " "& , @ @ @ @ @ @ @ @ @(> > > > >s{ > > > >.93 93 93 93 93 93 93 93 93 93 93r   