Okay, this is now just about ready. It feels like I've been standing up a lot of dominos and I'm about to tip them all over. This enables user-invites and pubs-as-second-device (which means gossip gets to be refactored, and you'll prioritize connecting to friends!) and it allows same-as to work nicely. and we can also use this to implement blocklists.
Am just deciding what the new ssb-friends api should look like. Hmm, how it interacts with other things:
The friends plugin uses hooks into auth (to prevent blocked peers from connecting) and, and createHistoryStream (to prevent blocked peers requesting feeds that have blocked them) ebt has it's own copy of the block data, so ssb-ebt uses friends.stream()
(this is a somewhat awkward api, that @arj
recently found a bug in)
There were several other places that used friends.get
and then checked wether one id was following another. since the internal data structure has changed, it was obvious to decouple this: now they just call isFollows({source,dest}, cb)
hmm, patchcore, and theirfore patchwork, uses friends.stream to copy the follow graph into the front end. This is a bad idea performance-wise, but I want to get this deployed asap, so I think the right move is to make friensd.stream backwards compatible. (note: patchless just uses friends.get when it needs to know who follows who, rather than at startup, which is much faster)