2020-09-10 12:11:43 +02:00
|
|
|
## Integratation within the sync lifetime cycle
|
|
|
|
|
2021-03-02 15:29:35 +01:00
|
|
|
### session.prepareSync
|
|
|
|
|
|
|
|
Decrypt any device messages, and turn them into RoomKey instances.
|
|
|
|
Any rooms that are not in the sync response but for which we receive keys will be included in the rooms to sync.
|
|
|
|
|
|
|
|
Runs before any room.prepareSync, so the new room keys can be passed to each room prepareSync to use in decryption.
|
|
|
|
|
|
|
|
### room.prepareSync
|
2020-09-10 12:11:43 +02:00
|
|
|
|
|
|
|
The session can start its own read/write transactions here, rooms only read from a shared transaction
|
|
|
|
|
|
|
|
- rooms (with shared read txn)
|
2021-03-02 15:29:35 +01:00
|
|
|
- megolm decryption read using any new keys decrypted by the session.
|
2020-09-10 12:11:43 +02:00
|
|
|
|
2021-03-02 15:29:35 +01:00
|
|
|
### room.afterPrepareSync
|
2020-09-10 12:11:43 +02:00
|
|
|
|
|
|
|
- rooms
|
|
|
|
- megolm async decryption
|
|
|
|
- dispatch to worker
|
|
|
|
|
2021-03-02 15:29:35 +01:00
|
|
|
### room.writeSync
|
2020-09-10 12:11:43 +02:00
|
|
|
|
|
|
|
- rooms (with shared readwrite txn)
|
|
|
|
- megolm decryption write, yielding decrypted events
|
|
|
|
- use decrypted events to write room summary
|
|
|
|
|
2021-03-02 15:29:35 +01:00
|
|
|
### session.writeSync
|
|
|
|
|
|
|
|
- writes any room keys that were received
|
|
|
|
|
|
|
|
### room.afterSync
|
2020-09-10 12:11:43 +02:00
|
|
|
|
|
|
|
- rooms
|
|
|
|
- emit changes
|
|
|
|
|
2021-03-02 15:29:35 +01:00
|
|
|
### room.afterSyncCompleted
|
2020-09-10 12:11:43 +02:00
|
|
|
|
|
|
|
- session
|
|
|
|
- e2ee account
|
|
|
|
- generate more otks if needed
|
|
|
|
- upload new otks if needed or device keys if not uploaded before
|
|
|
|
- rooms
|
|
|
|
- share new room keys if needed
|