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

KeysClaimRequest generates malformed bodies #56

Closed
Tracked by #26566
richvdh opened this issue Nov 16, 2023 · 3 comments · Fixed by #72
Closed
Tracked by #26566

KeysClaimRequest generates malformed bodies #56

richvdh opened this issue Nov 16, 2023 · 3 comments · Fixed by #72

Comments

@richvdh
Copy link
Member

richvdh commented Nov 16, 2023

The body of KeysClaimRequest structs looks like this:

{"one_time_keys":{"@richvdh:matrix.org":{"IUYUDKWEMN":"signed_curve25519"}},"timeout":{"nanos":0,"secs":10}}

That timeout property is malformed according to the spec

@richvdh
Copy link
Member Author

richvdh commented Nov 16, 2023

This is something of a replay of matrix-org/matrix-rust-sdk#801, but in different bindings. It seems a bit silly to me if we have to remember to fix this every time we create bindings.

@Hywan as the author of the magical request! macro that generates the body: could we just use the JSON serialisation of ruma's KeysClaimRequest struct (which appears to have code to deal with this case already) rather than building the body ourselves?

@Hywan
Copy link
Member

Hywan commented Nov 20, 2023

Yes, the idea is basically to re-apply matrix-org/matrix-rust-sdk#817 I suppose.

@richvdh
Copy link
Member Author

richvdh commented Nov 20, 2023

Yes, the idea is basically to re-apply matrix-org/matrix-rust-sdk#817 I suppose.

It seems silly to me that each set of bindings has to know which fields are Durations and manually convert them, when the fields in the Ruma structure already have serde annotations (https://docs.rs/ruma-client-api/0.13.0/src/ruma_client_api/keys/claim_keys.rs.html#31-35). Can we not take advantage of that somehow?

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

Successfully merging a pull request may close this issue.

2 participants