Skip to content

Instantly share code, notes, and snippets.

@pgte
Last active June 27, 2018 14:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgte/be843d58d6f29efabe1e5623d8132aff to your computer and use it in GitHub Desktop.
Save pgte/be843d58d6f29efabe1e5623d8132aff to your computer and use it in GitHub Desktop.
peer-star-app
  • Released on June 27th 2018
  • Expires on July 31st 2018

peer-star-app for peer-star app developers

Hello peer-star app developer! 👋

In an effor to make PeerPad scale better for many users editing the same pad, over the last few weeks I've been focused on implementing the topology and protocol described here. This is materializing in the form of a package named peer-star-app.

Here is a quick demo of it:

https://youtu.be/gBtAt0qTIUU?t=564

This is still an on-going effort, but, for the sake of you trying it out, I've documented the API and published a first version of the package (v0.1.0).

Current issues

js-ipfs version

As you an see from the API, this package already includes js-ipfs. This is to make life easier to app developers, and also because, currently, while this libp2p issue is not solved, we're using a fork of js-ipfs, which includes very slight changes. This is, of course, only temporary.

You can access the ipfs node using app.ipfs.

delta-crdts

In previous iterations we were using op-based CRDTs. Recently I grokked the concept of delta-crdts and I think they're a better fit to our use case (as do other specialists). Op-based CRDTs are more popular (all major CRDT libraries are op-based), but since delta-crdts make it easier to reason about log retention, snapshotting and garbage collection, and given that we're pressed for time, I decided to use them. This is not to say that peer-crdt should be deprecated. Again, it's entirely your choice to either use this library or go ahead and use peer-crdt (or any other CRDT library you find is useful).

The library that's being used underneath is delta-crdts, and these CRDTs do not (yet) provide the niceties of peer-crdt, like the change events. Having said that, and in the case of collaborative text editing, I think we can instead use diffing (see example) to make better sense of the changes. IMO, this does not have to be embedded in the CRDT, although it would be useful to have a library for this, perhaps in the future.

Authorization

Currently, pushers don't verify authorization from pullers before sending them data. While this is crucial for a live app, I think we can live with this for a while we work on other parts of our apps. I suspect that with a couple of days' work we should be able to add this to peer-star-app (please do!).

Encryption at rest

Currently, data is not encrypted at rest. It should be pretty easy to add this at the collaboration store level.

Identity

One thing that we will need to embed here is the identity. Deltas should be signed and verified by peers. I'm not sure which API we should expose, but I'm thinking of something along the lines of having a session intermediating collaborations:

const session = await app.session(credentials)
const collaboration = await session.collaborate('collab name', 'type', options)

If you have an opinion on what you require from peer-star-app on this, please file an issue and / or start working on a PR. :)

peer-star-app Documentation

Issues

Openeed issues for all of these:

https://travis-ci.org/ipfs-shipyard/peer-star-app/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment