Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL Encoding/Decoding Differences between JS and Rust client #52

Open
nataliepopescu opened this issue Jan 11, 2023 · 0 comments
Open

Comments

@nataliepopescu
Copy link
Collaborator

To encode the "device_id" search param when getting an otkey from the server, the JS client uses encodeURIComponent and the Rust client uses urlencoding::encode, which seem to encode strings using the same scheme. For example, both methods encode
fWJSs3OTKX/su3jJMzaqc7bwobE2I+7Q/+xT8Fz7mB4
into
fWJSs3OTKX%2Fsu3jJMzaqc7bwobE2I%2B7Q%2F%2BxT8Fz7mB4,
e.g., a %AB hex-encoding scheme.

However, the go server receives
fWJSs3OTKX%252Fsu3jJMzaqc7bwobE2I%252B7Q%252F%252BxT8Fz7
as the encoded string from the JS client (evidently a %ABCD hex-encoding scheme), while still receiving
fWJSs3OTKX%2Fsu3jJMzaqc7bwobE2I%2B7Q%2F%2BxT8Fz7mB4
from the Rust client.

A temporary fix removes one round of decoding from the server for Rust clients, but ideally both Rust and JS clients would use the same server, so I don't see this being a long-term solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant