Skip to content

Conversation

@hampsterx
Copy link

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.

@hampsterx hampsterx closed this by deleting the head repository Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant