matrix-org / matrix-spec

The Matrix protocol specification
Apache License 2.0
195 stars 97 forks source link

Olm to-device event format missing `sender` field #961

Open dkasak opened 2 years ago

dkasak commented 2 years ago

Link to problem area: https://spec.matrix.org/unstable/client-server-api/#molmv1curve25519-aes-sha2

Issue The example to-device payload is missing the sender field which is present in actual implementations.

Expected behaviour Presumably the example should be modified to mention the sender field.

uhoreg commented 2 years ago

The sender field is set by the server, and will be present in every to-device message that is received. The example there in the spec shows the things that are set by the sender (event type and content), though not in the exact format that the sender sets them in. And it's not ideal that someone needs to know more stuff about to-device messages in general to know that there will be a sender field available. So, the documentation could be improved there. But I'm not entirely sure that just adding sender to the example is the right thing. Will think about it more.

dkasak commented 2 years ago

I don't think the example as it stands makes sense either way, since it is neither the thing the client sends (the client only sends the content field value), nor the thing received from the server.

I guess this is what you were referring to when you said

though not in the exact format that the sender sets them in.

But that really seems like the maximally confusing thing to do. We should either show there what the client sends or what the client receives.

uhoreg commented 2 years ago

Agreed. I think maybe we should just show the content in the code block, say that it's sent with type m.room.encrypted, and mention the fields that the server will add.