[kimi] Add WebSocket authentication for Matrix connections (#682) #744
Reference in New Issue
Block a user
Delete Branch "kimi/issue-682"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #682
Summary
Added token-based authentication to the WebSocket endpoints used by the Matrix.
Changes
matrix_ws_tokensetting for WebSocket auth token_authenticate_ws()helper function that:?token=) or first message ({type: auth, token: ...})connection_ackmessage after successful authenticationmatrix_ws_tokenis empty (dev mode)Acceptance Criteria
- Add matrix_ws_token setting to config.py for token-based WS auth - Add _authenticate_ws() helper to validate tokens in world.py - Support token via query param (?token=) or first message ({type: auth}) - Close connection with code 4001 on invalid/missing token - Send connection_ack message after successful authentication - Auth disabled when matrix_ws_token is empty (dev mode) - Add comprehensive tests for WS auth scenarios Fixes #6822b102be69ato41b0dc58b5