Skip to content

Commit e3c2c05

Browse files
committed
chore: type clarifying in public key
Signed-off-by: exploreriii <[email protected]>
1 parent 2c5bbb6 commit e3c2c05

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/hiero_sdk_python/crypto/public_key.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ def verify_ed25519(self, signature: bytes, data: bytes) -> None:
465465
"""
466466
Verify an Ed25519 signature for clarity purposes. Raises InvalidSignature on failure.
467467
"""
468+
if not isinstance(self._public_key, ed25519.Ed25519PublicKey):
469+
raise TypeError("Not an Ed25519 key")
468470
# Ed25519 has no external hash; the library does it internally.
469471
self._public_key.verify(signature, data)
470472

@@ -479,6 +481,8 @@ def verify_ecdsa(self, signature: bytes, data: bytes) -> None:
479481
Raises:
480482
InvalidSignature: If the signature does not match.
481483
"""
484+
if not isinstance(self._public_key, ec.EllipticCurvePublicKey):
485+
raise TypeError("Not an ECDSA key")
482486
self._public_key.verify(signature, data, ec.ECDSA(hashes.SHA256()))
483487

484488
def __repr__(self) -> str:

0 commit comments

Comments
 (0)