MCPcopy
hub / github.com/jpadilla/pyjwt / _validate_curve

Method _validate_curve

jwt/algorithms.py:630–639  ·  view source on GitHub ↗

Validate that the key's curve matches the expected curve.

(self, key: AllowedECKeys)

Source from the content-addressed store, hash-verified

628 self.expected_curve = expected_curve
629
630 def _validate_curve(self, key: AllowedECKeys) -> None:
631 """Validate that the key's curve matches the expected curve."""
632 if self.expected_curve is None:
633 return
634
635 if not isinstance(key.curve, self.expected_curve):
636 raise InvalidKeyError(
637 f"The key's curve '{key.curve.name}' does not match the expected "
638 f"curve '{self.expected_curve.name}' for this algorithm"
639 )
640
641 def prepare_key(self, key: AllowedECKeys | str | bytes) -> AllowedECKeys:
642 if isinstance(key, self._crypto_key_types):

Callers 1

prepare_keyMethod · 0.95

Calls 1

InvalidKeyErrorClass · 0.85

Tested by

no test coverage detected