style: move import hmac to module-level per PEP 8

This commit is contained in:
Brian Krabach
2026-04-01 11:37:55 -07:00
parent d07800c8c5
commit 2dad066a5e
+1 -1
View File
@@ -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)