openapi-core/openapi_core/security/util.py

10 lines
255 B
Python
Raw Normal View History

2020-03-03 12:02:58 +00:00
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)