IndominusByte / fastapi-jwt-auth

FastAPI extension that provides JWT Auth support (secure, easy to use, and lightweight)
http://indominusbyte.github.io/fastapi-jwt-auth/
MIT License
660 stars 153 forks source link

allow strictBytes type for secret #53

Open hampsterx opened 3 years ago

hampsterx commented 3 years ago

we have a secret key that is in bytes (not utf-8 unfortunately).

PyJWT does this..


def force_bytes(value):
    if isinstance(value, text_type):
        return value.encode('utf-8')
    elif isinstance(value, binary_type):
        return value
    else:
        raise TypeError('Expected a string value')

eg it allows to use bytes for the key.

Modifying type confirms works fine.