mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 07:30:55 +00:00
Supply local priv and pub key when upgrading to a secure transport
This commit is contained in:
@ -8,6 +8,6 @@ class BaseSecureTransport(ISecureTransport):
|
||||
is only meant to be used in clases that derive from it.
|
||||
"""
|
||||
|
||||
def __init__(self, local_private_key: bytes) -> None:
|
||||
def __init__(self, local_private_key: bytes, local_public_key: bytes) -> None:
|
||||
self.local_private_key = local_private_key
|
||||
self.local_peer = ID.from_privkey(local_private_key)
|
||||
self.local_peer = ID.from_pubkey(local_public_key)
|
||||
|
||||
@ -10,7 +10,10 @@ from libp2p.security.secure_conn_interface import ISecureConn
|
||||
class SimpleSecurityTransport(BaseSecureTransport):
|
||||
key_phrase: str
|
||||
|
||||
def __init__(self, key_phrase: str) -> None:
|
||||
def __init__(
|
||||
self, local_private_key: bytes, local_public_key: bytes, key_phrase: str
|
||||
) -> None:
|
||||
super().__init__(local_private_key, local_public_key)
|
||||
self.key_phrase = key_phrase
|
||||
|
||||
async def secure_inbound(self, conn: IRawConnection) -> ISecureConn:
|
||||
|
||||
Reference in New Issue
Block a user