openapi-core/openapi_core/security/util.py
2020-03-03 12:11:24 +00:00

9 lines
255 B
Python

from base64 import urlsafe_b64decode
def b64decode(s):
# Code from
# https://github.com/GehirnInc/python-jwt/blob/master/jwt/utils.py#L29
s_bin = s.encode('ascii')
s_bin += b'=' * (4 - len(s_bin) % 4)
return urlsafe_b64decode(s_bin)