Spade
Mini Shell
�
�t0^c@s4dZddlZddlZd�Zd�ZdS(s`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.
i����NcCsCt|tj�s-tdjtj���ntj|�jd�S(s�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
sargument should be {0}t=(t
isinstancetsixtbinary_typet TypeErrortformattbase64turlsafe_b64encodetrstrip(tdata((s./usr/lib/python2.7/site-packages/josepy/b64.pyt b64encodescCs�t|tj�rHy|jd�}Wqitk
rDtd��qiXn!t|tj�sitd��ntj |ddt
|�d�S(s^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
tasciis5unicode argument should contain only ASCII
characterss#argument should be a str or
unicodeRi(RRtstring_typestencodetUnicodeEncodeErrort
ValueErrorRRRturlsafe_b64decodetlen(R ((s./usr/lib/python2.7/site-packages/josepy/b64.pyt b64decode#s
(t__doc__RRR
R(((s./usr/lib/python2.7/site-packages/josepy/b64.pyt<module>s