matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Allow `restore_session` without `SessionMeta`

Open gaykitty opened this issue 1 year ago • 1 comments

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 in MatrixSession an option
  • Create a new type to replace MatrixSession for restore_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.

gaykitty avatar Nov 15 '23 06:11 gaykitty

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?

jplatte avatar Nov 22 '23 13:11 jplatte