nostrclient
nostrclient copied to clipboard
private connections authentication breaks when encrypt_internal_message returns a string with the path separator
From my tests it seems that when using a private connection from an extension
relay_endpoint = encrypt_internal_message("relay")
relay=f"ws://localhost:{settings.port}/nostrclient/api/v1/{relay_endpoint}"
the authentication fails with
server rejected WebSocket connection: HTTP 403
(using the 'websockets' lib) if encrypt_internal_message happens to return a string with the '/' character inside. I've tried to urlencode it with
urllib.parse.quote(relay_endpoint, safe='')
but the connection was still rejected, i assume it's because the '/' character in path components is not automatically urldecoded.
Imo it would be better to pass it as query parameter instead of path.