Open peacememories opened 6 years ago
Nevermind, I found the main problem I think. One abstraction later too much (the key I supply is never passed through).
Another question though. Do I really need to share the key across the databases? Or can I just use authorization?
@peacememories what do you mean by sharing the key?
Seems like just another misunderstanding. I assumed that providing the "key" of the first db to the second one on creation would result in both using the same key pair, but it seems the local stream key is generated every time anyway. The only question I have now is, why do I need one database to be the "first" (and supply its public key to subsequent db instances on creation)? What does that do in the background?
@peacememories it's part of the capability system and to have a joint discovery key. the first one to create the db, becomes the source. this simply means that the discoveryKey of the first one is the discovery key for the db forever. the first writer can disappear though without any issues.
@peacememories once you figure this out, I'd love to see your example!
I'm trying to replicate a db over
webrtc-swarm
and always running into the dreaded "First shared hypercore must be the same" message.Below is the code I am trying to use. I use the same key for both dbs, and as far as i can tell i am looping both replication streams similarly to the tcp example in #19 .
Does anyone notice anything I'm doing wrong?