Get LVSP secret fron config.py

This commit is contained in:
Evie Viau 2022-02-17 22:52:45 -05:00
parent 70a0379615
commit 21e9b782a4
No known key found for this signature in database
GPG Key ID: DBCFB51C41FF87FF
1 changed files with 6 additions and 8 deletions

View File

@ -103,17 +103,15 @@ class LVSPConnection:
"""Handle HELLO message.""" """Handle HELLO message."""
data = msg["d"] data = msg["d"]
nonce = data['nonce']
self._hb_interval = data["heartbeat_interval"] self._hb_interval = data["heartbeat_interval"]
# actually do this token = hmac.new(
shared_secret = "deez nutz" self.app.config.get("LVSP_SECRET").encode(),
deez = hmac.new(shared_secret.encode(), nonce.encode(), hashlib.sha256).hexdigest() data["nonce"].encode(),
hashlib.sha256,
).hexdigest()
await self.send_op(OP.identify, { await self.send_op(OP.identify, {"token": token})
"token": deez
})
async def _update_health(self, new_health: float): async def _update_health(self, new_health: float):
"""Update the health value of a given voice server.""" """Update the health value of a given voice server."""