Implementing secrets in more complex document structures

How would I go about restricting viewing a specific object on a document?
I’m currently aware of something like this being used in LegendKeeper with their embedded secrets.

For example, say I have a YText type named secret that I want only certain people to be able to see and modify. I already have a modified version of y-websocket that I’m using on the server, but manually modifying the YDoc’s share (deleting the field if they don’t have access) for each new connection as a way to ‘serialize’ the document separately causes errors when encoding.

Is it possible for me to somehow separate the various objects on the document to dispatch events separately and serialize separately? Perhaps there is a better way to approach this problem entirely?

Thanks in advance!

You can restrict access by separating the data into subdocuments. This is what LegendKeeper does.

I’m not aware of any open-source provider that supports access control yet. So it is up to you to extend your provider to support encryption / secrets / auth.

1 Like