Earthstar April Update '23
Published on April 19, 2023 by Sam Gwilym
A change of plans
Last year I shared that this year's package of developments funded by NLnet would include 'complete encryption' for Earthstar shares.
This is no longer the case. I wasn't able to work out how to do this within the constraints of the Earthstar project, those being: Earthstar's need to run in browsers, Deno, and Node; Earthstar's current usage of ed25519 keypairs; and me being not qualified to implement any cryptographic primitives myself in the face of a lack of off-the-shelf solutions. I apologise to everyone who was looking forward to this feature.
The question is then: what will be worked on instead? It's something derived from, entwined with, and separate from Earthstar, and deserves its own post. It's called Willow, and you can read about it here.
A new DNS-SD implementation
I’ve been working on getting Earthstar peers to automatically discover and sync with each other when they’re on the same LAN. I wanted to use something proven for the LAN discovery portion, and I went with DNS-SD.
DNS-SD is a companion protocol to multicast DNS. It’s often used by printers, smart home devices, and home-streaming protocols like Airplay or Chromecast.
Earthstar's reference implementation is written in TypeScript, and runs in browers, Deno, and Node. So whatever DNS-SD implementation I used had to be able to run in both of these runtimes, and be capable of advertising and browsing DNS-SD services.
But there wasn't anything that ticked all of these boxes. And complicating things further, Deno did not have the capability to receive or send multicast messages!
So, long story short:
- I've contributed new multicasting APIs to Deno, which for the time being are behind the --unstable flag.
- I've built a new, modern TypeScript implementation of DNS-SD.
This new implementation works on both Deno and Node, and exports modern promise / async-iterator style APIs, including:
- Service browsing
- Service advertising
- A generic multicast DNS responder
- A generic multicast DNS continuous querier
- DNS message encoders and decoders
Now I will start work on the new opt-in discovery API for Earthstar. As this work just wraps around the new DNS-SD implementation, I don’t expect it to take much longer until we see Earthstar v10.2.0 with local discovery and sync.
A small new feature release (v10.1.0) for Earthstar, which adds support for invitation URLs.
Syncing an Earthstar share with someone new requires that you share several items with them first: a share address, server URL(s) to sync with, and maybe event a share secret so they can write data to the share. This entails a lot of copying and sending long, weird looking strings, and pasting them in the right place.
Invitation URLs encode all of this information into a single URL, and make it so that apps can automatically ingest all of that data and put it to use. They look like this:
For example, a URL like this can be given to the newSharedSetting.redeemInvitationURL method, which will then automatically add this share and its secret, as well as the specified servers to persisted settings.