Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

[LC-382] update coincurve usage in peer service #474

Merged
merged 1 commit into from
Feb 18, 2020
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: 3 additions & 0 deletions loopchain/crypto/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def __init__(self):
super().__init__()
self.private_key: PrivateKey = None

def get_private_secret(self):
return self.private_key.secret

def sign_data(self, data):
return self.sign(data, False)

Expand Down
2 changes: 1 addition & 1 deletion loopchain/peer/peer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _init_node_key(self):
password = getpass.getpass(f"Input your keystore password: ")
signer = Signer.from_prikey_file(prikey_file, password)
self._make_peer_id(signer.address)
self._node_key = signer.private_key.private_key
self._node_key = signer.get_private_secret()

def _make_peer_id(self, address):
self._peer_id = address
Expand Down
8 changes: 4 additions & 4 deletions testcase/unittest/test_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ def test_data_signatures_equal(self):
self.signer_private_key_pem.sign_data(data))

def test_signer_private_keys_equal(self):
self.assertEquals(self.signer_private_key_bytes.private_key.secret,
self.signer_private_key_der.private_key.secret)
self.assertEquals(self.signer_private_key_bytes.private_key.secret,
self.signer_private_key_pem.private_key.secret)
self.assertEquals(self.signer_private_key_bytes.get_private_secret(),
self.signer_private_key_der.get_private_secret())
self.assertEquals(self.signer_private_key_bytes.get_private_secret(),
self.signer_private_key_pem.get_private_secret())

def test_signer_sign_verifier_addresses_equal(self):
self.assertEquals(self.signer_private_key_bytes.address, self.signer_private_key_der.address)
Expand Down