style: move import hmac to module-level per PEP 8
This commit is contained in:
+1
-1
@@ -9,6 +9,7 @@ Background poll loop reconciles tmux session state every POLL_INTERVAL seconds.
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import hmac
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@@ -614,7 +615,6 @@ async def terminal_ws_proxy(websocket: WebSocket) -> None:
|
|||||||
if _federation_key:
|
if _federation_key:
|
||||||
auth_header = websocket.headers.get("authorization", "")
|
auth_header = websocket.headers.get("authorization", "")
|
||||||
if auth_header.lower().startswith("bearer "):
|
if auth_header.lower().startswith("bearer "):
|
||||||
import hmac
|
|
||||||
bearer_ok = hmac.compare_digest(auth_header[7:], _federation_key)
|
bearer_ok = hmac.compare_digest(auth_header[7:], _federation_key)
|
||||||
if not cookie_ok and not bearer_ok:
|
if not cookie_ok and not bearer_ok:
|
||||||
await websocket.close(code=4001)
|
await websocket.close(code=4001)
|
||||||
|
|||||||
Reference in New Issue
Block a user