In ssb-box2 we're going to have to traverse "my" metafeed tree, and then match that with other peers' metafeed tree to create DH keys.
Problem
When using default branchStream, it returns any branch in the "forest" (the collection of all trees), and there isn't any way how we can know whether a branch belongs to my tree, or some other peer's tree.
Solution
Add .keys field for all feed details returned by branchStream if I own that feed. If details.keys exists, it means you own the subfeed (well, by definition, because if you have the keys, you can publish to that feed).
In the implementation, this requires loading our seed before querying ssb-db2 for messages that build up the branches lookup data structure. We also load the root metafeed keys in that data structure ASAP, so that whenever we stumble upon a feed, we can check if it's parents details.keys exists, and then hydrate the keys with the seed.
Asking for a review from @arj03, but pinging @mixmix just to be aware of this PR.
Context
In ssb-box2 we're going to have to traverse "my" metafeed tree, and then match that with other peers' metafeed tree to create DH keys.
Problem
When using default branchStream, it returns any branch in the "forest" (the collection of all trees), and there isn't any way how we can know whether a branch belongs to my tree, or some other peer's tree.
Solution
Add
.keys
field for all feed details returned by branchStream if I own that feed. Ifdetails.keys
exists, it means you own the subfeed (well, by definition, because if you have thekeys
, you can publish to that feed).In the implementation, this requires loading our
seed
before querying ssb-db2 for messages that build up the branches lookup data structure. We also load the root metafeed keys in that data structure ASAP, so that whenever we stumble upon a feed, we can check if it's parentsdetails.keys
exists, and then hydrate the keys with the seed.Asking for a review from @arj03, but pinging @mixmix just to be aware of this PR.