ci: Lint source

This commit is contained in:
2023-10-29 09:55:39 +01:00
parent 53994b77a7
commit d28ca167f2
14 changed files with 267 additions and 65 deletions

View File

@@ -1,3 +1,5 @@
"""Example SHS client"""
import os
from asyncio import get_event_loop
from base64 import b64decode
@@ -7,11 +9,13 @@ from nacl.signing import SigningKey
from secret_handshake import SHSClient
with open(os.path.expanduser("~/.ssb/secret")) as f:
with open(os.path.expanduser("~/.ssb/secret"), encoding="utf-8") as f:
config = yaml.safe_load(f)
async def main():
"""Main function to run"""
server_pub_key = b64decode(config["public"][:-8])
client = SHSClient("localhost", 8008, SigningKey.generate(), server_pub_key)
await client.open()

View File

@@ -1,3 +1,5 @@
"""Example SHS server"""
import os
from asyncio import get_event_loop
from base64 import b64decode
@@ -7,7 +9,7 @@ from nacl.signing import SigningKey
from secret_handshake import SHSServer
with open(os.path.expanduser("~/.ssb/secret")) as f:
with open(os.path.expanduser("~/.ssb/secret"), encoding="utf-8") as f:
config = yaml.safe_load(f)
@@ -17,6 +19,8 @@ async def _on_connect(conn):
async def main():
"""Main function to run"""
server_keypair = SigningKey(b64decode(config["private"][:-8])[:32])
server = SHSServer("localhost", 8008, server_keypair)
server.on_connect(_on_connect)