hydrogen-web/src/matrix/e2ee
Bruno Windels e0d14207ac make opening a txn async again
as we'll need to await a bogus request first thing after opening the txn

funny enough, we originally made it sync to accommodate the same bug
in safari, but that didn't prevent any microtask being awaited
before scheduling a request in the calling code closing the txn.

We'll await a bogus request within the transaction class now so it
doesn't depend on the calling code
2021-03-04 19:47:02 +01:00
..
megolm make opening a txn async again 2021-03-04 19:47:02 +01:00
olm make opening a txn async again 2021-03-04 19:47:02 +01:00
Account.js make opening a txn async again 2021-03-04 19:47:02 +01:00
attachment.js move base64/58 encoding into platform 2021-02-12 16:01:54 +01:00
common.js createEnum does not take an array 2020-09-18 13:08:35 +02:00
DecryptionResult.js make decryption algorithms return DecryptionResult 2020-09-08 10:48:11 +02:00
DeviceTracker.js make opening a txn async again 2021-03-04 19:47:02 +01:00
OlmWorker.js provide random value for IE11 2020-11-10 18:31:18 +01:00
README.md WIP to store missing session event ids 2021-03-03 14:03:50 +01:00
RoomEncryption.js make opening a txn async again 2021-03-04 19:47:02 +01:00

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