Convert from base58/pubkey/privkey to class method

This commit is contained in:
NIC619
2019-07-31 19:31:58 +08:00
parent 80481252ca
commit b928bdb356
7 changed files with 46 additions and 19 deletions

View File

@ -4,7 +4,7 @@ from Crypto.PublicKey import RSA
from .security.insecure_security import InsecureTransport
from .peer.peerstore import PeerStore
from .peer.id import id_from_public_key
from .peer.id import ID
from .network.swarm import Swarm
from .host.basic_host import BasicHost
from .transport.upgrader import TransportUpgrader
@ -29,7 +29,7 @@ async def cleanup_done_tasks():
def generate_id():
new_key = RSA.generate(2048, e=65537)
new_id = id_from_public_key(new_key.publickey())
new_id = ID.from_pubkey(new_key.publickey())
# private_key = new_key.exportKey("PEM")
return new_id