Ë
    €Ï–  ã                   ó.   — d Z ddlZddlZddlZdd„Zd„ Zy)zm
Utility functions for implementing Proof Key for Code Exchange (PKCE) by OAuth
Public Clients

See RFC7636.
é    Nc                 óØ   — t        j                  t        j                  | «      «      j	                  d«      }t        |«      dk  rt        d«      ‚t        |«      dkD  rt        d«      ‚|S )aŸ  
    Generates a 'code_verifier' as described in section 4.1 of RFC 7636.

    This is a 'high-entropy cryptographic random string' that will be
    impractical for an attacker to guess.

    Args:
        n_bytes: integer between 31 and 96, inclusive. default: 64
            number of bytes of entropy to include in verifier.

    Returns:
        Bytestring, representing urlsafe base64-encoded random data.
    ó   =é+   z)Verifier too short. n_bytes must be > 30.é€   z(Verifier too long. n_bytes must be < 97.)Úbase64Úurlsafe_b64encodeÚosÚurandomÚrstripÚlenÚ
ValueError)Ún_bytesÚverifiers     ú%lib/third_party/oauth2client/_pkce.pyÚcode_verifierr      s_   € ô ×'Ñ'¬¯
©
°7Ó(;Ó<×CÑCÀDÓI€Hô ˆ8ƒ}rÒÜÐDÓEÐEÜ	ˆX‹˜Ò	ÜÐCÓDÐDàˆó    c                 ó   — t        j                  | «      j                  «       }t        j                  |«      j                  d«      S )a“  
    Creates a 'code_challenge' as described in section 4.2 of RFC 7636
    by taking the sha256 hash of the verifier and then urlsafe
    base64-encoding it.

    Args:
        verifier: bytestring, representing a code_verifier as generated by
            code_verifier().

    Returns:
        Bytestring, representing a urlsafe base64-encoded sha256 hash digest,
            without '=' padding.
    r   )ÚhashlibÚsha256Údigestr   r   r   )r   r   s     r   Úcode_challenger   4   s7   € ô ^‰^˜HÓ%×,Ñ,Ó.€FÜ×#Ñ# FÓ+×2Ñ2°4Ó8Ð8r   )é@   )Ú__doc__r   r   r	   r   r   © r   r   Ú<module>r      s   ðñó Û Û 	óó29r   