src/fedoidcmsg/bundle.py
def jwks_to_keyjar(jwks, iss=''):
    """
    Convert a JWKS to a KeyJar instance.

    :param jwks: String representation of a JWKS
    :return: A :py:class:`oidcmsg.key_jar.KeyJar` instance
    """
    if not isinstance(jwks, dict):
        try:
            jwks = json.loads(jwks)
        except json.JSONDecodeError:
            raise ValueError('No proper JSON')

    kj = KeyJar()
    kj.import_jwks(jwks, issuer=iss)
    return kj
def jwks_to_keyjar(jwks, iss=''):
    """
    Convert a JWKS to a KeyJar instance.

    :param jwks: String representation of a JWKS
    :return: A :py:class:`oidcmsg.key_jar.KeyJar` instance
    """
    if not isinstance(jwks, dict):
        try:
            jwks = json.loads(jwks)
        except json.JSONDecodeError:
            raise ValueError('No proper JSON')

    kj = KeyJar()
    kj.import_jwks(jwks, issuer=iss)
    return kj
Convert a JWKS to a KeyJar instance.

    :param jwks: String representation of a JWKS
    :return: A :py:class:`oidcmsg.key_jar.KeyJar` instance