gungundb

private write and public read in gundb


I want to create a microblog where everyone can read all posts, but just owner can delete or edit the posts. In gundb without sea everyone can edit or delete posts, in sea( gun.user()) I have to share public key, in sea how I get all user's post and show posts in timeline?

How could I create this with gundb?


Solution

  • Each time a user is created, the public key could be shared with all other users. (Have a super user who maintains a list) Then your front-end website would iterate over all public keys to get all the posts people have made and show them. That way, people can read all the posts, but not edit. Another way to do this, is have a super user run a process that constantly indexes and 'copies' posts into his own graph and that graph can be what is viewed. (making it even more protected) This is very high level answer but all this is possible using gun.user() and the gun core structure.