matrix-rust-sdk
matrix-rust-sdk copied to clipboard
Allow `restore_session` without `SessionMeta`
It is possible and desirable to be able to restore a session with having SessionMeta
cached by the client, but instead discovering it via whoami
during the session restoration. Implementing this seems fairly easy, but what API should be created for this is not clear to me. MatrixSession
could be modified to make meta
optional, but I'm not sure this makes sense for other places MatrixSession
is used.
Here are some options I've though of:
- Make
meta
inMatrixSession
an option - Create a new type to replace
MatrixSession
forrestore_session
- Create a new method on
Client
for this use case
Additionally, what should the client do if whoami
does not return a device id?
I'd like feedback on how to implement this please.
This would definitely be nice to have, but we need to make it very clear that it's not the preferred solution since it does an extra network request, and the user has to make sure that the access token actually is for the same device that the crypto store has keys for (it's a very common problem that people just copy-paste their access token out of Element Web's settings and try to use it for bots and such).
What is your use case for this?