(self, header, payload, key)
| 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 |
no test coverage detected