Now, this is a story all about how
Certificates work in Android town
And I'd like to take a minute
Enter, close the door
I'll tell you how I've figured out the inner workings of the Keystore
Well it all boils down the fact that Google got scared
It said, "You're certs are movin' to a place you won't find".
So the directory, user certificates are stored, is hard to find, and possibly
not readable by your application[1]. Instead, we need to use the Keystore[2]
API, specifically we'll need to open the `AndroidCAStore` Keystore type.
The various Keystore types are supposedly documented[3], but I'm failing to
find a logical path that would lead you to conclude that:
a) System certificates can or should be accessed using the Keystore,
specifically the AndroidCAStore type
b) User certificates can be found in the same Keystore type as the system
certificates
So this was mostly found using random googling, swearing, and a couple of
educated guesses.
[1]: https://android-developers.googleblog.com/2016/07/changes-to-trusted-certificate.html
[2]: https://developer.android.com/reference/java/security/KeyStore
[3]: https://docs.oracle.com/en/java/javase/17/docs/specs/security/standard-names.html#keystore-types
* Fix crash about several DataStores using the same file
- Create `@SessionCoroutineScope` annotation to pass a session-managed coroutine scope to the DI.
- Expose this scope from `MatrixClient`.
- Rework DataStore file creation a bit.
- Centralise session preference creation through `DefaultSessionPreferencesStoreFactory` until we figure out what went wrong with the scoping
* Use cached users from the Rust SDK.
Also lazy load received users by batches.
* Create `RoomMemberListFetcher` to wrap all the room member loading logic
* Ensure we clear `RoomMember` Rust references if the fetching coroutine is canceled
* Try mitigating unexpected logouts.
Try making getting/storing session data use a Mutex for synchronization.
Also added some more logs so we can understand exactly where it's failing.
The passphrase is stored in the SessionData, so that a Session created by Element Android can be restored.
Existing sessions will have a null passphrase and will continue to work.
New session will use a passphrase, only on Nightly and Debug build for now.