MCPcopy
hub / github.com/authlib/authlib / _prepare_algorithm_key

Method _prepare_algorithm_key

authlib/jose/rfc7515/jws.py:259–277  ·  view source on GitHub ↗
(self, header, payload, key)

Source from the content-addressed store, hash-verified

257 return self.deserialize_compact(s, key, decode)
258
259 def _prepare_algorithm_key(self, header, payload, key):
260 if "alg" not in header:
261 raise MissingAlgorithmError()
262
263 alg = header["alg"]
264 if alg not in self.ALGORITHMS_REGISTRY:
265 raise UnsupportedAlgorithmError()
266
267 algorithm = self.ALGORITHMS_REGISTRY[alg]
268 if self._algorithms is None:
269 if algorithm.deprecated:
270 raise UnsupportedAlgorithmError()
271 elif alg not in self._algorithms:
272 raise UnsupportedAlgorithmError()
273
274 if callable(key):
275 key = key(header, payload)
276 key = algorithm.prepare_key(key)
277 return algorithm, key
278
279 def _validate_private_headers(self, header):
280 # only validate private headers when developers set

Callers 4

serialize_compactMethod · 0.95
deserialize_compactMethod · 0.95
_signMethod · 0.95
_validate_json_jwsMethod · 0.95

Calls 3

prepare_keyMethod · 0.45

Tested by

no test coverage detected