mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Wire some missing properties up
This commit is contained in:
@ -2,11 +2,12 @@ import asyncio
|
||||
|
||||
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.security.base_transport import BaseSecureTransport
|
||||
from libp2p.security.insecure.transport import InsecureSession
|
||||
from libp2p.security.secure_conn_interface import ISecureConn
|
||||
from libp2p.security.secure_transport_interface import ISecureTransport
|
||||
|
||||
|
||||
class SimpleSecurityTransport(ISecureTransport):
|
||||
class SimpleSecurityTransport(BaseSecureTransport):
|
||||
key_phrase: str
|
||||
|
||||
def __init__(self, key_phrase: str) -> None:
|
||||
@ -26,7 +27,12 @@ class SimpleSecurityTransport(ISecureTransport):
|
||||
"Key phrase differed between nodes. Expected " + self.key_phrase
|
||||
)
|
||||
|
||||
return conn
|
||||
session = InsecureSession(self, conn, ID(b""))
|
||||
# NOTE: this is abusing the abstraction we have here
|
||||
# but this code may be deprecated soon and this exists
|
||||
# mainly to satisfy a test that will go along w/ it
|
||||
session.key_phrase = self.key_phrase
|
||||
return session
|
||||
|
||||
async def secure_outbound(self, conn: IRawConnection, peer_id: ID) -> ISecureConn:
|
||||
"""
|
||||
@ -46,4 +52,9 @@ class SimpleSecurityTransport(ISecureTransport):
|
||||
"Key phrase differed between nodes. Expected " + self.key_phrase
|
||||
)
|
||||
|
||||
return conn
|
||||
session = InsecureSession(self, conn, peer_id)
|
||||
# NOTE: this is abusing the abstraction we have here
|
||||
# but this code may be deprecated soon and this exists
|
||||
# mainly to satisfy a test that will go along w/ it
|
||||
session.key_phrase = self.key_phrase
|
||||
return session
|
||||
|
||||
Reference in New Issue
Block a user