ssbc / ssb-friend-pub

7 stars 0 forks source link

suggestion: use friends.createLayer #2

Open dominictarr opened 5 years ago

dominictarr commented 5 years ago

You've basically created a way to express that a pub is owned by a particular person: so it's pubs as second device %Gwqklkj0b2CBT5tPiz5170NWsPp3xiuLbOImEaG/e+4=.sha256

May I suggest using a graph layer here?

https://github.com/ssbc/ssb-friends#createlayername

with ssb-friends@3 the graph is split into layers that represent different ways of specifying relationships (i.e. regular contact messages, user invites, or as in this case: multidevice claims and agreements)

Bascially, you just create a graph {<id1>: {<id2>: hops}} in this particular case, the relationship is always symmetrical, and they represent the same person, so: <id1>: {<id2>: 0.1},<id2>: {<id1>: 0.1}} (a low but non zero value to represent the same, because dijkstra's algorithm doesn't like 0 weight edges)

This then integrates well with the other friend-graph using stuff.

arj03 commented 5 years ago

Yeah I was contemplating that. Might do that in a second pass. First I want to test this out and see how it changes the way messages propagate in the network. Also I'm a bit unsure about how much of your proposal you have implemented with user-invites?

arj03 commented 5 years ago

Just read the updated user invites readme. I see where you are going, it would make sense to use device addr to make it optional in accept.

dominictarr commented 5 years ago

I was thinking of this as part of user invites, but I left out the feed linking stuff because I realized it would delay user-invites even more. I think it complements it very well. There is a bit that finds the nearby pubs (and calls userInvites.willReplicate on each to check if they are willing to replicate the guest that I'm about to invite) I think that's the biggest are of direct overlap.

Also: isn't this basically a contract to set up multidevice? aka same-as? your feed marries your pub basically - one device proposes, the other accepts. seems like you'd just need to change "pub-owner" to "multidevice" or something like that and you'd have multidevice.

dominictarr commented 5 years ago

(oh, and on the front end, you'd need merge linked feeds when rendering messages, obviously)

arj03 commented 5 years ago

It is the same mechanism but I think the semantics are very different. Like i wouldn't want private messages to be sent to my pub as well.

Pretty excited about how this all fits together. Will do the layer but I think first I'd like to integrate this into patchbay.

dominictarr commented 5 years ago

absolutely, on private multidevice there should obviously something to indicate nature of the relationship. Also, just sending messages to both devices isn't gonna scale well, so the plan for that is receive keys %piwFjG7txcVvyKcFfDqNqq9whw+erlXF0rmV/sb/6uQ=.sha256 which I plan to roll out as part of private-groups (which I'm starting to work on now, since user-invites is ready)