forked from mystiq/hydrogen-web
.. | ||
DecryptionChanges.js | ||
DecryptionPreparation.js | ||
README.md | ||
ReplayDetectionEntry.js | ||
SessionCache.js | ||
SessionDecryption.js | ||
SessionInfo.js |
Lots of classes here. The complexity comes from needing to offload decryption to a webworker, mainly for IE11. We can't keep a idb transaction open while waiting for the response from the worker, so need to batch decryption of multiple events and do decryption in multiple steps:
- Read all used inbound sessions for the batch of events, requires a read txn. This happens in
Decryption
. Sessions are loaded intoSessionInfo
objects, which are also kept in aSessionCache
to prevent having to read and unpickle them all the time. - Actually decrypt. No txn can stay open during this step, as it can be offloaded to a worker and is thus async. This happens in
DecryptionPreparation
, which delegates toSessionDecryption
per session. - Read and write for the replay detection, requires a read/write txn. This happens in
DecryptionChanges
- Return the decrypted entries, and errors if any