Implementing end-to-end encryption

Hi @dhmacs,

I propose that you don’t interpret the data on the server when doing e2e encryption. You can simply store a linear history of all the document updates. If you enumerate them, the clients can specifically ask for a range of document updates.

There is room for optimization. In case the history of document updates is too long, you can ask the clients (that have read-permission) to merge ranges of document updates. Very soon this API might be helpful to you to merge ranges. In the meantime, you can easily polyfill the missing API by creating a Yjs document to merge document updates.

Hope this gave you a new perspective.

Helpful docs about how document updates work: https://docs.yjs.dev/api/document-updates

y-websocket server probably can’t be extended to support e2e encryption because it needs to interpret document updates.