-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration with mapeo-core - decoupling sync and discovery #5
Comments
Right now sync happens using the Currently it takes a noise stream as input, which, yeah, might not be what we need for this use case. Or it might just work by following this example but using @hyperswarm/secret-stream or perhaps another framed stream.
Yes, this is handled by the replication state machine in mapeo-core-next that Gregor worked on: https://github.com/digidem/mapeo-core-next/blob/main/lib/core-manager/replication-state-machine.js |
Yes, we can do: const wss = createWebSocketStream(new WebSocket(url))
const noiseStream = new SecretStream()
noiseStream.pipe(wss).pipe(noiseStream)
const replicateStream = coreManager.replicate(noiseStream) The encryption from @hyperswarm/secret-stream is superfluous, because we will run the websocket over TLS, but the handshake that validates the public keys of each peer is useful / necessary — we need to be able to trust the server ID to authenticate it for sync beyond auth cores. I opened an issue for turning off encryption for secret-stream. |
for this we need this issue merged right ? (so that coreManager is exposed from mapeo-core) |
@tomasciccola for now replicating a hypercore would be a good enough test. I'll have that replicate method available to use by the end of my day today. |
Closing because we've dramatically revamped our cloud server work. |
The proposal of mapeo-cloud is to sync with peers over just websockets.
This means that mapeo-core needs a way of getting a stream to replicate with that can be easily hooked to a websocket.
Currently mapeo-core has a sync method which is a noop.
Maybe, ideally, this sync method should just return a duplex stream so that I can bee hook to discovery over any method (hyperswarm, websocket, etc...).
Or maybe there should be a method in mapeo core like
getReplicationStream
andsync
is a wrapper over that.Also, the order of replication cores (first authcore so that we know what can be replicated, the data, lastly media), is it going to be handled directly in mapeo-core so mapeo-cloud doesn't need to worry?
@gmaclennan , @sethvincent wdyt?
The text was updated successfully, but these errors were encountered: