mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-24 12:04:57 +01:00
66a77519d7
merging session cache into it so we can better manage and recycle keys without exposing too low-level public methods on BaseLRUCache. Using refCount instead of inUse flag as a key can of course be used by multiple useKey calls at the same time. |
||
---|---|---|
.. | ||
megolm | ||
olm | ||
Account.js | ||
attachment.js | ||
common.js | ||
DecryptionResult.js | ||
DeviceTracker.js | ||
OlmWorker.js | ||
README.md | ||
RoomEncryption.js |
Integratation within the sync lifetime cycle
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
The session can start its own read/write transactions here, rooms only read from a shared transaction
- rooms (with shared read txn)
- megolm decryption read using any new keys decrypted by the session.
room.afterPrepareSync
- rooms
- megolm async decryption
- dispatch to worker
room.writeSync
- rooms (with shared readwrite txn)
- megolm decryption write, yielding decrypted events
- use decrypted events to write room summary
session.writeSync
- writes any room keys that were received
room.afterSync
- rooms
- emit changes
room.afterSyncCompleted
- 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