This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jwt | |
import base64 | |
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicNumbers | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives import serialization | |
def ensure_bytes(key): | |
if isinstance(key, str): | |
key = key.encode('utf-8') | |
return key |