mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Clean up key gen
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from libp2p.crypto.keys import PrivateKey, PublicKey
|
||||
from libp2p.crypto.keys import KeyPair
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.security.secure_transport_interface import ISecureTransport
|
||||
|
||||
@ -9,8 +9,6 @@ class BaseSecureTransport(ISecureTransport):
|
||||
is only meant to be used in clases that derive from it.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, local_private_key: PrivateKey, local_public_key: PublicKey
|
||||
) -> None:
|
||||
self.local_private_key = local_private_key
|
||||
self.local_peer = ID.from_pubkey(local_public_key)
|
||||
def __init__(self, local_key_pair: KeyPair) -> None:
|
||||
self.local_private_key = local_key_pair.private_key
|
||||
self.local_peer = ID.from_pubkey(local_key_pair.public_key)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
|
||||
from libp2p.crypto.keys import KeyPair
|
||||
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.security.base_transport import BaseSecureTransport
|
||||
@ -10,10 +11,8 @@ from libp2p.security.secure_conn_interface import ISecureConn
|
||||
class SimpleSecurityTransport(BaseSecureTransport):
|
||||
key_phrase: str
|
||||
|
||||
def __init__(
|
||||
self, local_private_key: bytes, local_public_key: bytes, key_phrase: str
|
||||
) -> None:
|
||||
super().__init__(local_private_key, local_public_key)
|
||||
def __init__(self, local_key_pair: KeyPair, key_phrase: str) -> None:
|
||||
super().__init__(local_key_pair)
|
||||
self.key_phrase = key_phrase
|
||||
|
||||
async def secure_inbound(self, conn: IRawConnection) -> ISecureConn:
|
||||
|
||||
Reference in New Issue
Block a user