diff --git a/crypto/identity/public_key.py b/crypto/identity/public_key.py index d32f2b0..cbea84e 100644 --- a/crypto/identity/public_key.py +++ b/crypto/identity/public_key.py @@ -8,9 +8,6 @@ class PublicKey(object): def __init__(self, public_key: str): self.public_key = PubKey(unhexlify(public_key.encode())) - def to_hex(self) -> str: - return hexlify(self.public_key.format()).decode() - @classmethod def from_passphrase(cls, passphrase: str) -> str: private_key = PrivateKey.from_passphrase(passphrase) diff --git a/tests/identity/test_public_key.py b/tests/identity/test_public_key.py index af10b8a..b704760 100644 --- a/tests/identity/test_public_key.py +++ b/tests/identity/test_public_key.py @@ -1,3 +1,4 @@ +from binascii import hexlify from crypto.identity.public_key import PublicKey @@ -9,4 +10,7 @@ def test_public_key_from_passphrase(identity): def test_public_key_from_hex(identity): public_key = PublicKey.from_hex(identity['data']['public_key']) assert isinstance(public_key, PublicKey) - assert public_key.to_hex() == identity['data']['public_key'] + + public_key_hex = hexlify(public_key.public_key.format()).decode() + + assert public_key_hex == identity['data']['public_key']