ssb-server icon indicating copy to clipboard operation
ssb-server copied to clipboard

Docs — RPC protocol

Open nichoth opened this issue 5 years ago • 3 comments

Hey. I had a question that I couldn't find here or in the protocol guide. It says that peers replicate by calling createHistoryStream via RPC, but I was curious about where the permissions for RPC are created. For example, you wouldn't be able to call .publish on a remote server, to publish a message under the remote id.

nichoth avatar Oct 19 '20 20:10 nichoth

Hi @nichoth,

Plugins specify permissions: https://github.com/ssb-js/secret-stack/blob/main/PLUGINS.md#pluginpermissions-object-optional

To make a method public, it should be included in the anonymous array in the permissions object. e.g. the example in the above linked file makes a localPeers method public:

  permissions: {
    anonymous: [ 'localPeers' ]                                         
  },

createHistoryStream has it specified here: https://github.com/ssbc/ssb-db/blob/master/index.js#L50

anonymous is the permission group that all remote callers are in by default. The local user and ssb-master-authenticated callers can call any method by default.

clehner avatar Oct 19 '20 21:10 clehner

thanks @clehner !

nichoth avatar Oct 19 '20 22:10 nichoth

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

stale[bot] avatar Jun 02 '21 18:06 stale[bot]