summaryrefslogtreecommitdiff
path: root/jwt/utils.py
blob: e6c1ef3beeafff5c79a113a155f006b4fffa002e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import base64


def base64url_decode(input):
    rem = len(input) % 4

    if rem > 0:
        input += b'=' * (4 - rem)

    return base64.urlsafe_b64decode(input)


def base64url_encode(input):
    return base64.urlsafe_b64encode(input).replace(b'=', b'')