Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions crypto/identity/public_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion tests/identity/test_public_key.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from binascii import hexlify
from crypto.identity.public_key import PublicKey


Expand All @@ -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']