Fix regressions with the remote-auth preventing it from working. Minor usability and style improvements. Changed /auth/api/ws/pair name to permit, to go with other parts of the software.

This commit is contained in:
Leo Vasanko
2025-12-09 21:57:33 +00:00
parent 48a8f575ec
commit 07fb9f79a6
4 changed files with 28 additions and 13 deletions
+3 -3
View File
@@ -38,7 +38,7 @@ async def websocket_remote_auth_request(ws: WebSocket):
1. Client connects
2. Server sends HARD PoW challenge, client solves and responds
3. Server creates a 3-word pairing code and sends it with expiry
4. Server waits for another device to authenticate via /remote-auth/pair
4. Server waits for another device to authenticate via /remote-auth/permit
5. When auth completes, server sends session_token to this client
6. Client can then use the session token to set a cookie
7. Connection times out after 5 minutes with explicit timeout message
@@ -250,9 +250,9 @@ async def websocket_remote_auth_request(ws: WebSocket):
remoteauth.instance.decrement_connections()
@app.websocket("/pair")
@app.websocket("/permit")
@websocket_error_handler
async def websocket_remote_auth_pair(ws: WebSocket):
async def websocket_remote_auth_permit(ws: WebSocket):
"""Complete a remote authentication request using a 3-word pairing code.
This endpoint is called from the user's profile on the authenticating device.
+4 -1
View File
@@ -3,7 +3,7 @@ from uuid import UUID
from fastapi import FastAPI, WebSocket
from paskia.authsession import create_session, get_reset, get_session
from paskia.fastapi import authz
from paskia.fastapi import authz, remote
from paskia.fastapi.session import AUTH_COOKIE, infodict
from paskia.fastapi.wsutil import validate_origin, websocket_error_handler
from paskia.globals import db, passkey
@@ -13,6 +13,9 @@ from paskia.util.tokens import create_token, session_key
# Create a FastAPI subapp for WebSocket endpoints
app = FastAPI()
# Mount the remote auth WebSocket endpoints
app.mount("/remote-auth", remote.app)
async def register_chat(
ws: WebSocket,