From 76bc600477e60e1cd42d6e57b6a8961941a45783 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:03:09 +0100 Subject: [PATCH 1/2] refactor: remove unused to hex public key method --- crypto/identity/public_key.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/crypto/identity/public_key.py b/crypto/identity/public_key.py index d32f2b02..cbea84e6 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) From baaeb4b851bbcb248d3dcaab5d0b202fc21b1f52 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:03:15 +0100 Subject: [PATCH 2/2] test --- tests/identity/test_public_key.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/identity/test_public_key.py b/tests/identity/test_public_key.py index af10b8a8..b7047606 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']