encrypted reg
This commit is contained in:
parent
668eb581c4
commit
de995ec626
@ -1,4 +1,4 @@
|
||||
aiohttp
|
||||
PyNaCl~=1.4.0
|
||||
git+https://gitea.ongoteam.net/PTV/ptvp35.git
|
||||
git+https://gitea.ongoteam.net/PTV/v6d0auth.git
|
||||
git+https://gitea.ongoteam.net/PTV/ptvp35.git@25727aabd7
|
||||
git+https://gitea.ongoteam.net/PTV/v6d0auth.git@2837d32dd6
|
||||
|
@ -39,7 +39,7 @@ class V6D1TokensAppFactory(AppFactory):
|
||||
token_encrypted = await self.tdb.get(await request.read())
|
||||
except BadSignatureError:
|
||||
raise web.HTTPUnauthorized
|
||||
except json.JSONDecodeError:
|
||||
except (json.JSONDecodeError, AssertionError):
|
||||
raise web.HTTPBadRequest
|
||||
except KeyError:
|
||||
raise web.HTTPNotFound
|
||||
|
@ -7,7 +7,7 @@ from v6d0auth.config import host, port
|
||||
|
||||
|
||||
async def main():
|
||||
request = certs.sign(json.dumps([input('token_id:'), input('token:')]).encode())
|
||||
request = certs.encrypt_self(certs.sign(json.dumps([input('token_id:'), input('token:')]).encode()))
|
||||
async with aiohttp.ClientSession() as session:
|
||||
# noinspection HttpUrlsUsage
|
||||
async with session.post(f'http://{host}:{port}/reg', data=request) as response:
|
||||
|
@ -32,7 +32,7 @@ class TDB:
|
||||
await self.db.set(token_id, token)
|
||||
|
||||
async def reg(self, request: bytes) -> None:
|
||||
request = certs.verify(request)
|
||||
request = certs.verify(certs.receive(request))
|
||||
token_id, token = json.loads(request)
|
||||
assert type(token_id) == type(token) == str
|
||||
await self._reg(token_id, token)
|
||||
|
Reference in New Issue
Block a user