-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
/keys/upload is ambiguous about what data should be signed #395
Comments
Hey, after talking to Matthew I will comment with what I found and think should be changed/added to the /keys/upload endpoint:
Also, the ordering of the fields isn't important because the canonical json function takes care of ordering it. The fields can be found here: Also: I don't like that the signature isn't checked when uploaded. So, at the moment, you can basically upload ANYTHING as a signature resulting in others not being able to verify it.
If you login without a given device_id the server will create a new one (stated in the /login endpoint documention).
This looks very confusing and somewhere in the code i found:
I think it would be helpful to mention and/or check that you MUST be logged in with the device_id you intent to upload keys to. Also a better response from the server would be helpful if the device IDs mismatch. |
Addition:
(also parsed with canonical JSON) |
Hello! Is the issue from point 2 still relevant?
Should client implementation follow the current spec |
Regarding point 2, it looks like a typo in the spec. The one with the |
Contributes to #1733 Signed-off-by: Alexey Andreyev <aa13q@ya.ru>
Contributes to #1733 Signed-off-by: Alexey Andreyev <aa13q@ya.ru>
Contributes to #1733 Signed-off-by: Alexey Andreyev <aa13q@ya.ru>
Looking at this, I'm not sure how this can be made clearer. The |
The documentation does say the entire object. Using Gson and JOLM, some of the object json formats don't map well to objects and need to be manipulated at the json string level. This isn't a bug, but having been through the examples at https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-keys-upload So for this example DeviceKeys jolm object that converts to Json string: I get this DeviceKeys signed format. It returns a 200, so it appears to succeed. For one time keys, I have the format that comes from JOLM class OneTimeKey: The exact upload format in the example shows both a single key and key value, but also signed_curve:device json object with a key and signatures. So my immediate question that I'm looking for clarification on is, can I sign all of the one time keys at the same time or do I have to sign each one individually. Also for each one time key, what is the exact format of the json that is supposed to be uploaded for each key or all keys at the same time? Any guidance would be greatly appreciated. |
@cryptoapebot the format of one-time keys is documented at https://spec.matrix.org/unstable/client-server-api/#key-algorithms You want to use the |
should signatures span the whole DeviceKeys object or just a single keys field? You can guess from context that it is just a single keys field, but would be better to be clearer
The text was updated successfully, but these errors were encountered: