MCPcopy
hub / github.com/authlib/authlib / create_load_key

Function create_load_key

authlib/jose/rfc7519/jwt.py:170–191  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

168
169
170def create_load_key(key):
171 def load_key(header, payload):
172 if isinstance(key, KeySet):
173 return key.find_by_kid(header.get("kid"))
174
175 if isinstance(key, dict) and "keys" in key:
176 keys = key["keys"]
177 kid = header.get("kid")
178
179 if kid is not None:
180 # look for the requested key
181 for k in keys:
182 if k.get("kid") == kid:
183 return k
184 else:
185 # use the only key
186 if len(keys) == 1:
187 return keys[0]
188 raise ValueError("Invalid JSON Web Key Set")
189 return key
190
191 return load_key

Callers 1

decodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…