MCPcopy Create free account
hub / github.com/authlib/authlib / register_algorithm

Method register_algorithm

authlib/jose/rfc7516/jwe.py:57–67  ·  view source on GitHub ↗

Register an algorithm for ``alg`` or ``enc`` or ``zip`` of JWE.

(cls, algorithm)

Source from the content-addressed store, hash-verified

55
56 @classmethod
57 def register_algorithm(cls, algorithm):
58 """Register an algorithm for ``alg`` or ``enc`` or ``zip`` of JWE."""
59 if not algorithm or algorithm.algorithm_type != "JWE":
60 raise ValueError(f"Invalid algorithm for JWE, {algorithm!r}")
61
62 if algorithm.algorithm_location == "alg":
63 cls.ALG_REGISTRY[algorithm.name] = algorithm
64 elif algorithm.algorithm_location == "enc":
65 cls.ENC_REGISTRY[algorithm.name] = algorithm
66 elif algorithm.algorithm_location == "zip":
67 cls.ZIP_REGISTRY[algorithm.name] = algorithm
68
69 def serialize_compact(self, protected, payload, key, sender_key=None):
70 """Generate a JWE Compact Serialization.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected