Allow serializing and passing of credentials_hashes in DeviceConfig (#607)

* Allow passing of credentials_hashes in DeviceConfig

* Update following review
This commit is contained in:
sdb9696
2024-01-03 21:46:08 +00:00
committed by GitHub
parent 3692e4812f
commit e9bf9f58ee
13 changed files with 183 additions and 34 deletions

View File

@@ -56,6 +56,7 @@ class BaseTransport(ABC):
self._host = config.host
self._port = config.port_override or self.default_port
self._credentials = config.credentials
self._credentials_hash = config.credentials_hash
self._timeout = config.timeout
@property
@@ -63,6 +64,11 @@ class BaseTransport(ABC):
def default_port(self) -> int:
"""The default port for the transport."""
@property
@abstractmethod
def credentials_hash(self) -> str:
"""The hashed credentials used by the transport."""
@abstractmethod
async def send(self, request: str) -> Dict:
"""Send a message to the device and return a response."""
@@ -120,6 +126,11 @@ class _XorTransport(BaseTransport):
"""Default port for the transport."""
return self.DEFAULT_PORT
@property
def credentials_hash(self) -> str:
"""The hashed credentials used by the transport."""
return ""
async def send(self, request: str) -> Dict:
"""Send a message to the device and return a response."""
return {}