HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/josepy/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/josepy/__pycache__/b64.cpython-311.pyc
�

*b���N�dZddlZddlmZdedefd�Zdeeefdefd�ZdS)a`JOSE Base64`_ is defined as:

  - URL-safe Base64
  - padding stripped

.. _`JOSE Base64`:
    https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-37#appendix-C

.. Do NOT try to call this module "base64", as it will "shadow" the
   standard library.

�N)�Union�data�returnc��t|t��std���tj|���d��S)z�JOSE Base64 encode.

    :param data: Data to be encoded.
    :type data: bytes

    :returns: JOSE Base64 string.
    :rtype: bytes

    :raises TypeError: if ``data`` is of incorrect type

    zargument should be bytes�=)�
isinstance�bytes�	TypeError�base64�urlsafe_b64encode�rstrip�rs �,/usr/lib/python3/dist-packages/josepy/b64.py�	b64encodersD���d�E�"�"�4��2�3�3�3��#�D�)�)�0�0��6�6�6�c�6�t|t��r4	|�d��}nA#t$rt	d���wxYwt|t
��st
d���tj|ddt|��dzz
zz��S)a^JOSE Base64 decode.

    :param data: Base64 string to be decoded. If it's unicode, then
                 only ASCII characters are allowed.
    :type data: bytes or unicode

    :returns: Decoded data.
    :rtype: bytes

    :raises TypeError: if input is of incorrect type
    :raises ValueError: if input is unicode with non-ASCII characters

    �asciiz5unicode argument should contain only ASCII charactersz#argument should be a str or unicoder�)
r�str�encode�UnicodeEncodeError�
ValueErrorr	r
r�urlsafe_b64decode�lenrs r�	b64decoder"s����$����?�	I��;�;�w�'�'�D�D��!�	I�	I�	I��G�I�I�
I�	I������e�
$�
$�?��=�>�>�>��#�D�4�1��D�	�	�A�
�3F�+G�$G�H�H�Hs	�-�A)�__doc__r�typingrr	rrr�rr�<module>rs������
�
�
�������7�E�7�e�7�7�7�7�"I�E�%��*�%�I�%�I�I�I�I�I�Ir