hydrogen-web/src/matrix/e2ee
Bruno Windels a499689bd8 also write room key that we create ourselves with RoomKey infrastructure
so all keys are written in one place and the flags are always correct
2022-01-28 13:10:48 +01:00
..
megolm also write room key that we create ourselves with RoomKey infrastructure 2022-01-28 13:10:48 +01:00
olm Merge branch 'master' into bwindels/log-signature-failure 2021-12-09 18:34:36 +01:00
Account.js missing otk count does not mean 0 but rather no change 2022-01-05 14:26:15 +01:00
attachment.js move base64/58 encoding into platform 2021-02-12 16:01:54 +01:00
common.js Merge branch 'master' into bwindels/log-signature-failure 2021-12-09 18:34:36 +01:00
DecryptionResult.js convert SessionDecryption to TS and adapt to use KeyLoader 2021-10-22 17:48:35 +02:00
Dehydration.js Fix imports 2021-12-03 11:36:49 +05:30
DeviceTracker.js log signature verification failure in logger, not console 2021-11-15 15:27:57 +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 rename session backup to key backup to be consistent with RoomKey 2022-01-26 09:51:48 +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