ó
    €Ï¬  ã                   ó0   • S r SSKrSSKrSSKrSS jrS rg)zm
Utility functions for implementing Proof Key for Code Exchange (PKCE) by OAuth
Public Clients

See RFC7636.
é    Nc                 óà   • [         R                  " [        R                  " U 5      5      R	                  S5      n[        U5      S:  a  [        S5      e[        U5      S:”  a  [        S5      eU$ )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     Ú1platform/bq/third_party/oauth2client_4_0/_pkce.pyÚcode_verifierr      s_   € ô ×'Ò'¬¯
ª
°7Ó(;Ó<×CÑCÀDÓI€Hô ˆ8ƒ}rÓÜÐDÓEÐEÜ	ˆX‹˜Ó	ÜÐCÓDÐDàˆó    c                 ó”   • [         R                  " U 5      R                  5       n[        R                  " U5      R                  S5      $ )ak  
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   5   s7   € ô ^Š^˜HÓ%×,Ñ,Ó.€FÜ×#Ò# FÓ+×2Ñ2°4Ó8Ð8r   )é@   )Ú__doc__r   r   r	   r   r   © r   r   Ú<module>r      s   ðñ ó Û Û 	ôó29r   