MCPcopy Create free account
hub / github.com/mpdavis/python-jose / construct

Function construct

jose/jwk.py:63–79  ·  view source on GitHub ↗

Construct a Key object for the given algorithm with the given key_data.

(key_data, algorithm=None)

Source from the content-addressed store, hash-verified

61
62
63def construct(key_data, algorithm=None):
64 """
65 Construct a Key object for the given algorithm with the given
66 key_data.
67 """
68
69 # Allow for pulling the algorithm off of the passed in jwk.
70 if not algorithm and isinstance(key_data, dict):
71 algorithm = key_data.get("alg", None)
72
73 if not algorithm:
74 raise JWKError("Unable to find an algorithm for key")
75
76 key_class = get_key(algorithm)
77 if not key_class:
78 raise JWKError("Unable to find an algorithm for key")
79 return key_class(key_data, algorithm)

Callers

nothing calls this directly

Calls 2

JWKErrorClass · 0.90
get_keyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…